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.

Code Snippets / DBC : Another Button Function

Author
Message
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th Oct 2006 01:14 Edited at: 23rd Nov 2006 01:31
[Edit]
I hadn't realized how much of performance hit this costs. It's ok for a menu selection screen, but using it as the background for a constantly updating application isn't very efficient. If any one has some ideas on how to improve the Frames for this, I'd be happy to hear! I've started work on a different button routine that uses sprites. It's much better - and I can get 300 buttons simultatneously without a performance hit right now. Anyway, if you have any, please post any improvements on this old routine.

[Old]
Here's a nifty button function to use. I was messing around with some of the examples that come with the DBC documentation and there was a simple selection menu on one of the progs. I used it's premise and designed a button function that has a few more bells and whistles.

It will autosize the button based on the text font and size, but there seems to be a problem overall that I can't quite track down. It seems that the last font size selected influences all the other button sizes. I don't get it because I thought variables in functions were local, and every instance of the function call should be "clean." If anyone has any ideas, I'd love to hear them.

Here's the code. If you decide to use it in your apps, a nanosecond of credit would be nice!



Enjoy your day.
Gamers for sale
19
Years of Service
User Offline
Joined: 19th Nov 2005
Location: Some where beneath the elements
Posted: 1st Jan 2007 06:06
I have a few tips for the code that I found to be quite useful.

First off it is harder to create a button in dark basic then it is to have an image.

I have attempted to do this before dark basic's drawing commands aren't that great.

You can do alot of fun things with the drawing commands but it isn't very efficent when you use alot of drawing commands.

If I were to guess the dark basic drawing commands would be accessing windows api drawing commands which aren't really good for drawing several hundred buttons.

I hope this is what you were looking for!

Your signature has been erased by a mod because it's larger than 600x120
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 2nd Jan 2007 05:21
Thanks GFS,

It's totally the drawing commands that slow it down. I abandoned this idea shortly after posting it, it was just based on a tutorial that used text and didn't have the overhead so I hadn't accounted for it. I have since moved on and created my own gui that has several different kinds of gadgets and runs pretty fast... it serves my purposes.

Enjoy your day.
Gamers for sale
19
Years of Service
User Offline
Joined: 19th Nov 2005
Location: Some where beneath the elements
Posted: 10th Jan 2007 02:49
What kind of gadgets. Just wondering. I was trying to make some gadgets but didn't have enough time to work on them because of the Dark World project.

Login to post a reply

Server time is: 2024-11-22 23:23:29
Your offset time is: 2024-11-22 23:23:29