* 671 Posts in 238 Topics by 75 Members Latest Member: BrodyB   **
IFSO PORTAL
  Advanced search
June 20, 2013, 12:57:16 am
HomeforumHelpSearchLoginRegister**
Recent Posts
[May 08, 2013, 10:38:33 pm]

[April 26, 2013, 02:00:31 pm]

[April 14, 2013, 12:39:49 pm]

[December 21, 2012, 06:13:17 am]

[November 13, 2012, 02:21:49 pm]

[August 28, 2012, 06:38:27 pm]

[May 28, 2012, 10:12:41 pm]

[May 05, 2012, 01:01:38 pm]

[May 03, 2012, 02:11:03 pm]

[April 30, 2012, 12:48:25 pm]
IFSO Portal  |  Forum  |  ifsoGUI  |  ifsoGUI Discussion  |  Topic: Making it faster? « previous next »
Pages: [1] Go Down Print
Author Topic: Making it faster?  (Read 3759 times)
jhanson
ifsoGUI Owner
Newbie
*
Offline Offline

Posts: 8



View Profile
« on: November 16, 2010, 10:40:42 am »

Are there any tips for making ifsoGUI run faster?  I am working on a game, and without ifsoGUI running it is currently about 400 fps.  As soon as I put an ifsoGUI panel on my screen with three buttons and two progress bars, it drops to about 230 fps.  In the grand scheme of things, this probably doesn't sound that bad, but I have a lot more buttons that I want to add.  If I go up to 9 buttons it gets down to 160-ish fps.  I haven't tested past that point

It seems like the bulk of the fps hit is coming from the DrawBox routine.  Digging through what it's doing in there, it seems that it's doing a lot of calculations to determine how to stretch/tile the images that are used to make up the controls.  I'm considering making a "simple button" type where I pre-render the button as an image of the size I want and skip DrawBox altogether, but am hoping there's a better way.

Thanks!
Logged
TaskMaster
Administrator
Sr. Member
*****
Offline Offline

Posts: 462


TaskyZ
View Profile
« Reply #1 on: November 16, 2010, 12:26:40 pm »

Are there any tips for making ifsoGUI run faster?  I am working on a game, and without ifsoGUI running it is currently about 400 fps.  As soon as I put an ifsoGUI panel on my screen with three buttons and two progress bars, it drops to about 230 fps.  In the grand scheme of things, this probably doesn't sound that bad, but I have a lot more buttons that I want to add.  If I go up to 9 buttons it gets down to 160-ish fps.  I haven't tested past that point

It seems like the bulk of the fps hit is coming from the DrawBox routine.  Digging through what it's doing in there, it seems that it's doing a lot of calculations to determine how to stretch/tile the images that are used to make up the controls.  I'm considering making a "simple button" type where I pre-render the button as an image of the size I want and skip DrawBox altogether, but am hoping there's a better way.

Thanks!

The GUI does a lot of work to allow the gadgets to be resizeable.

You could easily make a simple button gadgets that does not have any resizing capabilities.  You could also use the ImageButton gadget and SetShowButton(False) so it does not draw the button and set your button graphic as the image to be drawn.  That should help.

You also have to remember that the hit to performance is not linear.  It takes more and more time to reduce each successive frame of performance.

It would also be possible to make a set of gadgets that are not resizeable.  Each could be drawn in just one DrawImage rather than a series of them.  But your graphics would have to be drawn to size, and you could not resize them on the fly, which kind of defeats the purpose of a GUI.  If you had to draw each panel and buttons graphics to size, then you could just easily draw them to the screen and a GUI system would not really be necessary as it would be very basic.
Logged
jhanson
ifsoGUI Owner
Newbie
*
Offline Offline

Posts: 8



View Profile
« Reply #2 on: November 16, 2010, 01:36:08 pm »

Ooh, the ImageButton technique sounds like it would work.  Thanks!

I understand it has to do a lot to make things resizable, but once they're resized to where you want them, if they're not going to change, it would be nice if it didn't have to recalculate everything every frame.  Then recalculate when something actually changes.
Logged
jhanson
ifsoGUI Owner
Newbie
*
Offline Offline

Posts: 8



View Profile
« Reply #3 on: November 16, 2010, 03:13:37 pm »

ImageButton seems to speed things up considerably.  With three buttons displayed, it went from 230 fps to 290 fps.  The only catch is that I'll have to bake-in my labels, since ImageButton seems to put the label adjacent to the image rather than on top of it.  That's no big deal though.  Thanks!
Logged
TaskMaster
Administrator
Sr. Member
*****
Offline Offline

Posts: 462


TaskyZ
View Profile
« Reply #4 on: November 16, 2010, 03:43:12 pm »

I don't think the speed issue comes from figuring the image calculations as much as it does the need to use different images.  I am going to try a new technique that will draw the images differently.  I think it is going to speed it up.  Currently, each image is broken into 9 images for drawing.  Then it draws the 9 images at the correct positions.  But, I am redesigning it to use just one image, so with no texture swapping, it should be faster.

I am fairly certain it is the texture swapping that is the slowdown.
Logged
jhanson
ifsoGUI Owner
Newbie
*
Offline Offline

Posts: 8



View Profile
« Reply #5 on: November 19, 2010, 06:24:11 pm »

Very nice!  1.15 speeds things up a lot.  My panel with 3 image buttons and 2 progress bars jumped a solid 30-40 fps.
Logged
TaskMaster
Administrator
Sr. Member
*****
Offline Offline

Posts: 462


TaskyZ
View Profile
« Reply #6 on: November 19, 2010, 06:27:09 pm »

Very nice!  1.15 speeds things up a lot.  My panel with 3 image buttons and 2 progress bars jumped a solid 30-40 fps.

Glad to hear it.  Thanks for the feedback, it is appreciated.
Logged
Pages: [1] Go Up Print 
IFSO Portal  |  Forum  |  ifsoGUI  |  ifsoGUI Discussion  |  Topic: Making it faster? « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.17 | SMF © 2011, Simple Machines
TinyPortal v0.9.8 © Bloc
TechHead design by Bloc
Valid XHTML 1.0! Valid CSS!