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

Username:   Password: 
 RegisterRegister   
 Help Making Buttons
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic
Author Message
PesticideUse




PostPosted: Thu Aug 21, 2008 7:06 pm   Post subject: Help Making Buttons

Hey, I've searched a bit for a good tutorial on how to make buttons but haven't really found one.

it was recently suggested that i add buttons to my games and i believe that's a good suggestion.

i can use mousewhere, but don't want to have to check that "mx" and "my" are inside a box of coordinates around the button every time i click, for my games that could take a lot of time to put in... whatdotcolor could be used with mx and my but again that could take a bit of work, i would like a simple way to add the button into my game.

if anyone can suggest a good tutorial or help me out thank you Smile
 
Sponsor
Sponsor
Sponsor
sponsor
michaelp




PostPosted: Thu Aug 21, 2008 7:31 pm   Post subject: RE:Help Making Buttons

http://compsci.ca/v3/viewtopic.php?t=3583

It was in the Turing Walkthrough...
 
PesticideUse




PostPosted: Thu Aug 21, 2008 7:52 pm   Post subject: Re: Help Making Buttons

Thanks Smile , didnt use the GUI thing cuz im totally clueless when it comes to that lol but i went the the walkthrough and found some stuff
 
michaelp




PostPosted: Thu Aug 21, 2008 8:25 pm   Post subject: RE:Help Making Buttons

Just remember to Search next time.
And I didn't even make that Turing Walkthrough thing a link, that's sweet! Razz
 
PesticideUse




PostPosted: Thu Aug 21, 2008 9:43 pm   Post subject: Re: Help Making Buttons

i did search, but not in the tutorial part... duh lol
 
SNIPERDUDE




PostPosted: Thu Aug 21, 2008 10:24 pm   Post subject: RE:Help Making Buttons

Yea. The Turing GUI really isn't that good, but it is a good simple start. Check out my package I made for custom buttons, you might like it.

http://compsci.ca/v3/viewtopic.php?p=167643#167643

And yes, anytime you mention the Turing Walkthrough it will auto link it for you! Very Happy
 
PesticideUse




PostPosted: Thu Aug 21, 2008 10:30 pm   Post subject: Re: Help Making Buttons

Very cool, probably wont put that in anything im working on now, but maybe one of my future projects Very Happy
 
SNIPERDUDE




PostPosted: Thu Aug 21, 2008 10:45 pm   Post subject: RE:Help Making Buttons

No prob. Very Happy
Just remember to give the proper credit...
 
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Aug 22, 2008 10:28 am   Post subject: RE:Help Making Buttons

If all your buttons have the same X values, then you can check once for the X and then check what the mouse's Y value is.

code:

if mousex > X1 and mousex < X2 and button = 1 then
    if mousey > button1y1 and mousey < button1y2 then
        %do some stuff
    elsif mousey > button2y1 and mousey < button2y2 then
        %do other stuff
    end if
end if


This way you save a lot of code (I once had 12 or so buttons in a column, I saved a lot of time & space this way).
 
PesticideUse




PostPosted: Sat Aug 23, 2008 7:38 pm   Post subject: Re: Help Making Buttons

will do sniperdude Smile
and thank you for the pointer insectoid i didnt think of that Smile
 
SNIPERDUDE




PostPosted: Sat Aug 23, 2008 7:49 pm   Post subject: RE:Help Making Buttons

If you want to compact Insectoid's code; if all of your buttons are equally spaced you can use a for loop to check the coordinates.
 
CodeMonkey2000




PostPosted: Sun Aug 24, 2008 12:25 pm   Post subject: RE:Help Making Buttons

Surprised that no one linked to this.

That's a solid introduction to classes, and object oriented programming. You probably should read all three parts, but the intro has a custom made button class.
 
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: