Page 1 of 1
Fullscreen renderer sequence
Posted: Thu Mar 08, 2012 10:08 pm
by Gambit37
^^ Not sure you ever saw the above tutorial request?
Also, another one

How can I create a sequence of fullscreen renderers that play in sequence, and each one fades frm one to the next after either (a) a period of time and/or (b) a mouse click?
For example, I'd like a sort of "attract" sequence that after a set amount of time on the title screen will then rotate through 2-3 screens in a sequence and then return to the title screen... I can string together a bunch of renderers one after the other which will work on a mouse click, but I can't work out how to set them to work automatically in sequence on a timer...?
Re: Fullscreen renderer sequence
Posted: Sat Mar 10, 2012 4:03 am
by Sophia
Gambit37 wrote:^^ Not sure you ever saw the above tutorial request?
I saw it. I haven't gotten around to it, yet, sorry.
Gambit37 wrote:How can I create a sequence of fullscreen renderers that play in sequence, and each one fades frm one to the next after either (a) a period of time and/or (b) a mouse click?
A non-nil return value from any of the functions called by a fullscreen renderer will end it.
There is a helpful click function called
EXIT_ON_CLICK that will handle the mouse clicks, and you can do the timing in an update function, which is called 5 times a second, the same rate as DSB's game timer.
Here is code to display
gfx.full_screen_graphic for 30 seconds, or end it early if the user clicks.
Code: Select all
function my_graphics_timer()
gt_timer = gt_timer + 1
if (gt_timer > 5*30) then
return true
end
end
gt_timer = 0
dsb_fullscreen(gfx.full_screen_graphic, EXIT_ON_CLICK, my_graphics_timer, false, true)
Re: Fullscreen renderer sequence
Posted: Sat Mar 10, 2012 9:14 am
by Gambit37
Aha, right, thank you. I saw that the fullscreen renderer had an update_func but I still wasn't sure how that would work. I keep having this mental block that the renderer "locks up" the running of the rest of the game, so I forget it's doing stuff every tick anyway!
Re: Fullscreen renderer sequence
Posted: Sun Mar 11, 2012 8:49 am
by ian_scho
Gambit37 wrote:I keep having this mental block that the renderer "locks up" the running of the rest of the game, so I forget it's doing stuff every tick anyway!
My pseudo-code is from the 0.40 version, so things
may have changed somewhat:
Code: Select all
-- During an event, pause the planet.
dsb_lock_game(LOCK_MONSTERS)
dsb_lock_game(LOCK_MOVEMENT)
dsb_lock_game(LOCK_INVENTORY)
dsb_lock_game(LOCK_CONDITIONS)
dsb_lock_game(LOCK_MAGIC)
-- The full-screen renderer will run until any of its associated functions returns something other than false or nil.
dsb_fullscreen(
PARM Draw Function for each frame,
PARM Click Function,
PARM Update Function, called each 'game tick'. It takes no parameters,
PARM Mouse cursor (== true to show the yellow cursor)
)
-- End. Let the world move on.
dsb_unlock_game(LOCK_MONSTERS)
dsb_unlock_game(LOCK_MOVEMENT)
dsb_unlock_game(LOCK_INVENTORY)
dsb_unlock_game(LOCK_CONDITIONS)
dsb_unlock_game(LOCK_MAGIC)
Re: Fullscreen renderer sequence
Posted: Sun Mar 11, 2012 5:49 pm
by Sophia
I would like to clarify that this is pseudo-code explaining what is going on.
You do not need to actually lock anything, because the game logic does not advance while in dsb_fullscreen.
Re: Fullscreen renderer sequence
Posted: Sun Mar 11, 2012 6:44 pm
by ian_scho
Sophia wrote:the game logic does not advance while in dsb_fullscreen.
I never knew this! Thanks for clarifying.