Rtl Foreground: Difference between revisions

From Uzebox Wiki
Jump to navigation Jump to search
Line 4: Line 4:
[[File:foreground1.png]]
[[File:foreground1.png]]


Looks pretty good eh? So, let's see how simple it is to add this functionality to your game!
See those deadly bunnies hiding in wait for their victims? Looks pretty good eh? So, let's see how simple it is to add this functionality to your game!


==Using rtl_Foreground==
==Using rtl_Foreground==

Revision as of 01:44, 13 December 2011

Foreground Effects For Uzebox

With rtl_Foreground there is now an easy and standard way to create objects your sprites can hide behind. This introduces a level of depth to your game's visuals, and perhaps can even be used as a gameplay element. Let's take a look at what we're talking about.

Foreground1.png

See those deadly bunnies hiding in wait for their victims? Looks pretty good eh? So, let's see how simple it is to add this functionality to your game!

Using rtl_Foreground

rtl_Foreground consumes only a few extra bytes of ram, minimal code space, and a moderate amount of cpu cycles depending on how many sprites are behind the foreground. There is built in functionality that provides some measure of protection from stack overflow, allowing the user's program to either WaitVsync(1) or simply stop the effect short to avoid running out of cycles. This is enabled with 2 switches added in your make file:

  • -DRTL_FOREGROUND_SAFETY - specifies that you would like RTL to take precautions against stack overflow.
  • -DRTL_VSYNC_WAIT - specify 0 to stop processing effects early, or 1 to WaitVsync(1) then continue with effect.

I highly recommend you first try WITHOUT either switch. If you are having problems try reducing ram usage, and free up some extra cycles with -DFIRST_RENDER_LINE. See rtl_Primer for more information on extra cycles. Unfortunately if you do not have enough time, it will likely have a poor visual result. Surprisingly, this works with not much extra time so generally this will be a non-issue.