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 / Button Demo for the masses

Author
Message
kordman916
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location:
Posted: 23rd Feb 2009 22:43 Edited at: 24th Aug 2009 05:44
Ok about a week ago i needed a button demo on how to create click-able buttons but the ones i found didn't have a demo to explain it all for me. so i decided to make my own! the download teaches how to make buttons so yea have fun.

P.S if needed I can write a tutorial on how to do it for better clarification

edit: I'll try to come up with a demo for mishapen buttons


Dell Optiplex GX280,3.4 GHZ Pentium 4 processor
1 Gig DDR2 ram,Geforce 8500 GT 512mb

Attachments

Login to view attachments
kordman916
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location:
Posted: 23rd Feb 2009 22:46 Edited at: 25th Aug 2009 19:11
Heres a pic.

Edit: I reuploaded the pic from .bmp to jpg
and yes you can use the buttons in the demo they were created by me so no worries and if you need a button i'll draw one (or some) for you.


Dell Optiplex GX280,3.4 GHZ Pentium 4 processor
1 Gig DDR2 ram,Geforce 8500 GT 512mb

Attachments

Login to view attachments
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 23rd Feb 2009 22:51 Edited at: 23rd Feb 2009 22:51
I can't test the demo at the moment, but that picture, wow... it's 3.8MB. You really should convert it to jpg and reducing the size before uploading it. Other than that it looks good. Are they 3D buttons or 2D ones?

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
kordman916
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location:
Posted: 23rd Feb 2009 22:53 Edited at: 23rd Feb 2009 22:54
The buttons are 2d idk on how to make 3d buttons and thx i will reupload the pic so cya.

Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 23rd Feb 2009 23:02 Edited at: 23rd Feb 2009 23:06
I made this snippet awhile ago to produce an object button, then I just built on it, now I have a sort of Dead Space menu, the code:



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
kordman916
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location:
Posted: 23rd Feb 2009 23:15
Thats confusing code but thx i might be able to use it and since you gave me this cool code i'll draw you any buttons or backdrop you need to the best of my ability.

Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 23rd Feb 2009 23:23
Thanks for the offer, but no worries, I kind of excel in this area. Btw, what confused you in that code?

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
kordman916
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location:
Posted: 23rd Feb 2009 23:25
idel button image?

Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 23rd Feb 2009 23:33
Strange, I just copied and pasted it here and for some reason the 'e' and the 'l' have switched round. Should be 'idle'.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Tom0001
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location:
Posted: 24th Feb 2009 11:55
Here's a function I made for a simple button -- all the variable names are fairly self-explanatory and I assume that you know how to use it.



Have fun. ;]

Tom
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 24th Feb 2009 12:13 Edited at: 24th Feb 2009 12:14
In the long run I would say it's best to go for image/sprite based buttons, also there much easier to manage. But mainly because alot of 2D kills performance.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sid Sinister
18
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 24th Feb 2009 15:26
Silence! When Sasuke posts code, it is like honey to the bees!

I liked Dead Space's menu, I'll have to tinker with your code.

"If I have seen a little further it is by standing on the shoulders of Giants" - Isaac Newton
-Computer Animation Major @Baker.edu-
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 24th Feb 2009 16:41 Edited at: 24th Feb 2009 16:42
Quote: "it is like honey to the bees!"


Or salt to the slugs, guess it depends on how you look at it. It's like when I first looked at Frustum Culling, I was jumped up on speed for the first ten minutes before blacking out into a chaotic vertex driven nightmare. Now it like half your annual dose of sugar in your tea, every sip is not quite right but it's nearly there. Oh... that reminds me, buy sugar when I go out next, running low

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
kordman916
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location:
Posted: 24th Feb 2009 23:31
Even thought i like the conversation i'd like to hear of what people think of my demo

Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 25th Feb 2009 08:08
[slightlyofftopic]
eh, i like button functions that return values, so that they're alot more flexible.
also, you could have an init function that creates the images and saves them, then you can paste them later.




[/slightlyofftopic]

Aaaaanyways
the demo loooks good. I'd still reccomend more general functions that you can use for anything though. like, instead of this:

if MX# > 382 and MY# > 419 and MX# < 638 and MY# < 483
clear camera view RGB(0,0,0)
text 0,0,"you pressed button 2"
endif

you could have
tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 26th Feb 2009 06:11 Edited at: 26th Feb 2009 06:13
You know functions can be used to RETURN VARIABLES. ie by creating a function that returns a 1 when pressed you can use it as part of a condition then the button can be used for everything. For every program i write i create a general button function, that allows me to include a button label in the function declaration. Therefore i can use the button as part of a condition ie

if button(x,y,"label)=1 then etc...

I'd give you an example but I'm on a work pc.

If you want to make the button look smarter you can create a shadow effect by simply having 2 boxes 1 with a darker shade positioned slightly offset the other.

Cwatson
tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 26th Feb 2009 06:16

Login to post a reply

Server time is: 2024-04-25 08:14:27
Your offset time is: 2024-04-25 08:14:27