The Render Engine
Learn how the Render Engine works
Launch The Render Engine
Below is the minimal code you have to write in order to get the Render Engine running. The result will be a black window of size 800 x 600.
#include <Nero/engine/RenderEngine.h> int main() { nero::RenderEngine engine; engine.run(); return 0; }
Window Size
You can change the default window size of the Render Engine through its constructor. The code below will create a window of size 1280 x 720.
#include <Nero/engine/RenderEngine.h> int main() { nero::RenderEngine engine(1280, 720); engine.run(); return 0; }
Set Your Scene
You can provide your Scene class to the Render Engine using its setScene() template method. The method requires the Scene Class and the name of your game
engine.setScene<Scene Class>("Game Name");
#include <Nero/engine/RenderEngine.h> #include <Nero/scene/Scene.h> class MyScene : public nero::Scene { public: MyScene(nero::Scene::Context context): nero::Scene(context) { } }; int main() { nero::RenderEngine engine(1280, 720); engine.setScene<MyScene>("My Scene"); engine.run(); return 0; }
Add A Startup Screen
Once you have your Startup Screen you can provide it to the Render Engine through its constructor. First you have to create a Share Pointer of your Screen, then you can provide the share pointer as the first argument of the Render Engine.
#include <Nero/engine/RenderEngine.h> #include <Nero/engine/StartupScreen.h> class MyStartupScreen : public nero::StartupScreen { public: //overriden methods here } int main() { //instantiate your screen auto startupScreen = std::make_shared<nero::MyStartupScreen>(); nero::RenderEngine engine(startupScreen, 1280, 720); engine.run(); return 0; }
Quick Navigation