Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Making clickable buttons?

Author
Message
Evilcatt09
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 30th Oct 2003 05:43
Can someone please tell me how I can make a button that sits at the bottom of the screen and will do something special when I click it. I found basically that in one of the example programs, but it has lots of excess stuff that I'm not sure if its needed or not for the button.

Thanks,

You want me to get a life? Ok, hold on a sec. *picks up the controller and presses Up,Down,Right,A,Left,B,Y* There you go now I have 50!
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 30th Oct 2003 06:05
make a sprite, place it on the screen, use mouseclick() to determine when mouse is clicked and use mousex() and mousey() to determine if your mouse is inside the boundaries of the button. When the click occurs, if the mouse coords meet the criteria your button was clicked, else it was not.

-RUST-
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 30th Oct 2003 07:51 Edited at: 30th Oct 2003 16:05
Check out my Comand buttons in code base

http://darkbasicpro.thegamecreators.com/?m=codebase_view&i=13ec69ca6af3f25fe89e934fbc54963a

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
Thialfi
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: Asgard
Posted: 30th Oct 2003 08:06
Err, you might want to change that link. When I clicked on it, it gave me the edit tab where I can change the code if I wanted to.

By Thor's hammer
By the sons of Odin
I shall avenge thee
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 30th Oct 2003 11:27
lol

"The trouble with the French is that they have no word for 'entreprenuer'" - Pres. George W Bush
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 30th Oct 2003 16:07
Link Change
thanks Thialfi

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
Evilcatt09
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 31st Oct 2003 04:45
Thanks but is there any, well, shorter way of doing that or is that the only way?

You want me to get a life? Ok, hold on a sec. *picks up the controller and presses Up,Down,Right,A,Left,B,Y* There you go now I have 50!
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 31st Oct 2003 05:03
you could do it in 3d and use pick object command instead of dealing with 2d screen coordinates

-RUST-
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 31st Oct 2003 11:43
Here's my effort:



Boo!
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 31st Oct 2003 17:00
You could look at my DLL...

Ratty Rat
23
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 31st Oct 2003 17:15
Using the Sprite as button method you can use a 1 pixel sprite placed at the mouse x,y coords and do a sprite collision to check if its over a button.

This has the advantage that you get the sprite no. that the mouse was over, which is useful when you have multiple buttons as you can use the spriteno. to lookup which button was pressed and decide what to do.

"Don`t try to engage my enthusiasm, I don`t have one"

Login to post a reply

Server time is: 2026-07-26 13:02:10
Your offset time is: 2026-07-26 13:02:10