Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Gosu::Graphics::flush() / Gosu::Window#flush
- - By jlnr (dev) Date 2010-08-01 00:30
My game is seperated into game states, as seen in Chingu or benko's shooter example game. One of them is a menu with a background (Z_MENU_BG) and two buttons (Z_MENU_BUTTONS). Now I want to draw a dialog on top of that which has a background and buttons itself, drawn with the same Z values. To be sure that Gosu doesn't first draw both background, then both buttons, I need to flush/separate the Z ordering between drawing both things. Which is exactly what this new method will do in 0.7.23.

I run into lots of little things that I need lately, like this tiny method. At the same time I am concerned that Gosu's interface will get all wobbly and bloaty until I am done.

Any other suggestions for the name, or any other ideas so I don't have to add *yet another method* which is going to be called only a dozen times in Gosu's existence? ;) Does flushZ()/flush_z make it more clear?
Parent - - By AmIMeYet Date 2010-08-01 11:40
A small question: does this flushing mean that you can't 'draw below stuff that's already drawn' anymore?
Parent - - By erisdiscord Date 2010-08-01 16:10
Precisely. The way it is now, Gosu actually maintains a priority queue of drawing operations, and when you call a drawing method, it's inserted into the queue sorted by Z order. After your Window#draw method returns, then all the drawing is done from back to front. flush goes ahead and draws everything so that you can draw, say, a second layer on top of your game without worrying about making sure your Z indices are higher than anything else that you've drawn.

This is good news. Now I can get rid of the Z option for my ring menu and just make it flush the draw op queue after drawing the previous state. :)
Parent - - By mathias Date 2010-08-04 13:32
flush makes perfect sense for me too, I have been (ab)using beginGL(); endGL(); to do exactly the same for quite a time now :)
Parent - By erisdiscord Date 2010-08-04 16:40
Hah, clever—I never thought of doing that.
Parent - By Maverick Date 2010-08-01 18:02
Parent - By kyonides Date 2010-08-03 00:05
Well, flush_z or reset_z or anything like that seems to be fine.
Up Topic Gosu / Gosu Exchange / Gosu::Graphics::flush() / Gosu::Window#flush

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill