|
Tutorial_General_Initialisation
Tutorial on setting up the Elf2D framework. Include Elf.h and link to Elf2D.lib. Make sure you have Elf2D.dll available. The framework handles most of the things for you, including the main loop - your update and render functions will be called at the correct time. Declare them as: void myUpdateOrRenderFunction(const float deltaTime); elfConfig calls can only be made before the framework is initialised. Call the following functions to set up your callbacks: elfConfig_SetUpdateCallback(&myGameUpdateFunction); elfConfig_SetRenderCallback(&myGameRenderFunction); That's it! If the framework initialises successfully, run it and shutdown it afterwards. if (elfSystem_Initialise())
{
elfSystem_Run();
elfSystem_Shutdown();
}C++ - Full code example Also available in Samples/Simple #include "../../../Include/Elf.h" // Make sure to set up paths correctly
#pragma comment(lib, "../../../Dll/Elf2D.lib") // Linking like this only works in MSVC++
void myGameUpdate(const float deltaTime)
{
// TODO: your update code
}
void myGameRender(const float deltaTime)
{
// TODO: your render code
}
void main()
{
elfConfig_SetUpdateCallback(&myGameUpdate);
elfConfig_SetRenderCallback(&myGameRender);
if (elfSystem_Initialise())
{
elfSystem_Run();
elfSystem_Shutdown();
}
}
|
► Sign in to add a comment