Difference between revisions of "HOWTO-Backends"

Jump to navigation Jump to search
738 bytes added ,  20:39, 21 November 2006
Add notes about updateScreen()
m (typo)
(Add notes about updateScreen())
Line 46: Line 46:
=== Misc notes ===
=== Misc notes ===
There is [[Small Devices Backend]] in the works which is planned to be common for all devices with limited resources. If you are working on a backend for such a system, you may want to take a look on that page!
There is [[Small Devices Backend]] in the works which is planned to be common for all devices with limited resources. If you are working on a backend for such a system, you may want to take a look on that page!
==== updateScreen() method ====
updateScreen() method is called by an engine when it finished drawing something on the screen. It may happen quite often, up to several hundred times per second, but some devices have restriction on how many times per second screen bliting takes place. For example, some NTSC version can not physically update more often that 60Hz, and attempts to make it more often will result in the machine hang.
If you're writing a backend for such system, you may use code like this:
  void updateScreen() {
      uint32 newTime = getMillis();
      if (newTime - _oldTime < 1000 / MAX_FPS)
          return;
 
      _oldTime = newTime;
 
      // do actual screen update
  }
That should do the trick for you,

Navigation menu