Computer Science Canada Help Making Buttons |
Author: | PesticideUse [ 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 ![]() |
Author: | michaelp [ 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... |
Author: | PesticideUse [ Thu Aug 21, 2008 7:52 pm ] |
Post subject: | Re: Help Making Buttons |
Thanks ![]() |
Author: | michaelp [ 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! ![]() |
Author: | PesticideUse [ Thu Aug 21, 2008 9:43 pm ] |
Post subject: | Re: Help Making Buttons |
i did search, but not in the tutorial part... duh lol |
Author: | SNIPERDUDE [ 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! ![]() |
Author: | PesticideUse [ 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 ![]() |
Author: | SNIPERDUDE [ Thu Aug 21, 2008 10:45 pm ] |
Post subject: | RE:Help Making Buttons |
No prob. ![]() Just remember to give the proper credit... |
Author: | Insectoid [ 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.
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). |
Author: | PesticideUse [ Sat Aug 23, 2008 7:38 pm ] |
Post subject: | Re: Help Making Buttons |
will do sniperdude ![]() and thank you for the pointer insectoid i didnt think of that ![]() |
Author: | SNIPERDUDE [ 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. |
Author: | CodeMonkey2000 [ 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. |