Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turing Help Needed Please (Quicker The Better)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xsuperx




PostPosted: Sun Jun 07, 2015 2:06 pm   Post subject: Turing Help Needed Please (Quicker The Better)

What is it you are trying to achieve?
Hello members,
I got an assignment a week ago to make a hangman game and I've finished it BUT the GUI buttons look REALLY REALLY BAD.
First of all, the square shape is just bad, ontop of that, the colour is even worse. I know you can change the colour but I still don't
like it... We can't use mousewhere by the way.

Describe what you have tried to solve this problem
Im trying to solve this problem by putting a picture ONTOP of the GUI buttons so first there are 26 GUI buttons in the QWERTY layout and
above that is a picture of a keyboard. Everything is aligned and works seamlessly but my teacher doesn't like it Sad.

The problem is, when you click, for example 'Q' on the picture but you are actually clicking the GUI buttons, the GUI buttons pops up behind
it which makes it look bad. Is there a way to hide the GUI buttons and disable it's picture popups? (Seems impossible to me) Or any solution
to this?

I know, I know, this is confusing... Let me explain better:
You have 1 GUI button.
Ontop of that, you have a picture.
You clicked the picture and it activates the GUI buttons (Its supposed to do that)
However when you click or hold the button it show the GUI button behind the picture...
I don't like that...
Any solutions?

Turing:


%Code looks like this
import GUI
var button : int
button := (0, 0, 30, "Q", buttoncheck, 20, 'q', true)

var pic:= Pic.FileNew ("keyboard.bmp")
Pic.Draw (pic, 150, 70, picMerge)

%Again, the picture is not the problem

loop

end loop

Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Sun Jun 07, 2015 4:54 pm   Post subject: Re: Turing Help Needed Please (Quicker The Better)

The problem is that the clicked button is drawn over your picture. Here's an idea of how to fix this (very rough code, but it works).

Turing:
import GUI
View.Set("offscreenonly")

% I'm just creating a picture since I don't have your keyboard picture
Draw.FillBox (150, 70, 200, 100, 10)
var pic : int := Pic.New (150, 70, 200, 100)
cls

proc buttoncheck ()
    Pic.Draw (pic, 50, 50, picCopy) % Redraw button
    Draw.Box (0, 0, maxx, maxy, 12) % Give feedback that button was pressed
    View.Update()
    GUI.Quit()
end buttoncheck

var button : int
button := GUI.CreateButtonFull (50, 50, 30, "Q", buttoncheck, 20, 'q', true)
Pic.Draw (pic, 50, 50, picCopy)
View.Update()

loop
    exit when GUI.ProcessEvent
end loop


Basically I'm setting the view to "offscreenonly" mode to avoid having a button showing up for a split second before I hide it again.

EDIT: Just in case you aren't familiar with the "offscreenonly" behavior, here's a quick tutorial http://compsci.ca/v3/viewtopic.php?t=12533
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: