Game Development Reference
In-Depth Information
Extending the SandboxApplication class
Once your project has been set up, you need to create three blank files for Premake to dis-
cover.
Create the source and header files as follows:
src/my_sandbox/include/MySandbox.h
src/my_sandbox/src/MySandbox.cpp
src/my_sandbox/src/main.cpp
Now, it's time to regenerate the Visual Studio solution by executing
vs2008.bat
,
vs2010.bat
,
vs2012.bat
, or
vs2013.bat
. When you open the Visual Studio solu-
tion, you'll see your brand new
My_Sandbox
project!
Each of the sandbox demos is set up to extend the base
SandboxApplication
class
and declare where to find the corresponding Lua script files for the executable.
Declaring your
MySandbox
class follows the same pattern and looks as follows:
MySandbox.h
:
#include "demo_framework/include/SandboxApplication.h"
class MySandbox : public SandboxApplication {
public:
MySandbox(void);
virtual ~MySandbox(void);
virtual void Initialize();
};
Inheriting from
SandboxApplication
gives you a base to start with. For now, we're
only going to override the default behavior of
Initialize
in order to add the resource
location for our Lua scripts.