^^ 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...?
Fullscreen renderer sequence
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Fullscreen renderer sequence
I saw it. I haven't gotten around to it, yet, sorry.Gambit37 wrote:^^ Not sure you ever saw the above tutorial request?
A non-nil return value from any of the functions called by a fullscreen renderer will end it.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?
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)
- Gambit37
- Should eat more pies
- Posts: 13714
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Fullscreen renderer sequence
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
My pseudo-code is from the 0.40 version, so things may have changed somewhat: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!
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)
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Fullscreen renderer sequence
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.
You do not need to actually lock anything, because the game logic does not advance while in dsb_fullscreen.
Re: Fullscreen renderer sequence
I never knew this! Thanks for clarifying.Sophia wrote:the game logic does not advance while in dsb_fullscreen.