Open main menu

Difference between revisions of "HOWTO-Backends"

291 bytes added ,  21:50, 3 April 2006
Add main() example
(Mention deinit of backend code)
(Add main() example)
Line 25: Line 25:
# Modify <tt>common/system.cpp</tt> and <tt>backends/intern.h</tt> to make it aware of your backend. Mostly, this means telling it about your OSystem factory function (I'll leave the code there to document itself, if you don't understand it, ask us on IRC or on our mailing list).
# Modify <tt>common/system.cpp</tt> and <tt>backends/intern.h</tt> to make it aware of your backend. Mostly, this means telling it about your OSystem factory function (I'll leave the code there to document itself, if you don't understand it, ask us on IRC or on our mailing list).
# Modify <tt>backends/intern.h</tt> if you want to set a custom default sample rate.
# Modify <tt>backends/intern.h</tt> if you want to set a custom default sample rate.
==== Example of minimal main() ====
  int main(int argc, char *argv[]) {
      g_system = OSystem_X11::create(0, 0);
      assert(g_system);
     
      // Invoke the actual ScummVM main entry point:
      int res = scummvm_main(argc, argv);
      g_system->quit();
      return res;
  }


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!