Difference between revisions of "HOWTO-Backends"

Jump to navigation Jump to search
19 bytes added ,  12:46, 27 August 2008
Use GeSHi syntax coloring extension
(→‎Overview: doxygen link updated)
(Use GeSHi syntax coloring extension)
Line 24: Line 24:


==== Example of minimal main() ====
==== Example of minimal main() ====
  int main(int argc, char *argv[]) {
<syntax type="C++">int main(int argc, char *argv[]) {
      g_system = new OSystem_Foobar();
    g_system = new OSystem_Foobar();
      assert(g_system);
    assert(g_system);
     
   
      // Invoke the actual ScummVM main entry point:
    // Invoke the actual ScummVM main entry point:
      int res = scummvm_main(argc, argv);
    int res = scummvm_main(argc, argv);
      g_system->quit();
    g_system->quit();
      return res;
    return res;
  }
}</syntax>
 


That's it. The difficult part is of course writing the OSystem subclass. More on that in the next section!
That's it. The difficult part is of course writing the OSystem subclass. More on that in the next section!
Line 49: Line 48:
If you're writing a backend for such system, you may use code like this:
If you're writing a backend for such system, you may use code like this:


  void updateScreen() {
<syntax type="C++">void updateScreen() {
      uint32 newTime = getMillis();
    uint32 newTime = getMillis();
      if (newTime - _oldTime < 1000 / MAX_FPS)
    if (newTime - _oldTime < 1000 / MAX_FPS)
          return;
        return;
 
 
      _oldTime = newTime;
    _oldTime = newTime;
 
 
      // do actual screen update
    // do actual screen update
  }
}</syntax>


That should do the trick for you,
That should do the trick for you,
1,079

edits

Navigation menu