Open main menu

Difference between revisions of "HOWTO-Backends"

195 bytes added ,  21:44, 3 April 2006
Now backends have to instatiate OSystem
(Mention that backends must implement main)
(Now backends have to instatiate OSystem)
Line 20: Line 20:
# Subclass OSystem. You could copy the content of <tt>backends/null/null.cpp</tt> to <tt>backends/foobar/foobar.cpp</tt> to get a skeleton. As you progress, it might be helpful to look at other backends to learn how they do things.
# Subclass OSystem. You could copy the content of <tt>backends/null/null.cpp</tt> to <tt>backends/foobar/foobar.cpp</tt> to get a skeleton. As you progress, it might be helpful to look at other backends to learn how they do things.
# Make sure to provide the <tt>main</tt> function in your backend (the actual main function of ScummVM is <tt>scummvm_main</tt>, which your backend must invoke at some point).
# Make sure to provide the <tt>main</tt> function in your backend (the actual main function of ScummVM is <tt>scummvm_main</tt>, which your backend must invoke at some point).
# Instantiate OSystem class and assign it to <tt>g_system</tt>, do that before calling <tt>scumm_main</tt> i.e.:
  g_system = new OSystem_SDL();
  assert(g_system);
 
  scummvm_main(argc, argv);
# If appropriate, edit <tt>configure</tt> to add your backend (this is only necessary if you are going to use the "./configure && make" build system).
# If appropriate, edit <tt>configure</tt> to add your backend (this is only necessary if you are going to use the "./configure && make" build system).
# 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).
Line 25: Line 30:


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!


=== Subclassing OSystem ===
=== Subclassing OSystem ===