Engine+Example: Improve entrypoint via manual singleton

This commit is contained in:
Riyyi
2022-09-26 13:07:05 +02:00
parent 1dcb25ea5e
commit ae8bb46a7d
5 changed files with 67 additions and 22 deletions
+20 -11
View File
@@ -4,17 +4,26 @@
* SPDX-License-Identifier: MIT
*/
#include "inferno.h"
#include "inferno/entrypoint.h"
#include "game.h"
class Game : public Inferno::Application
Game::Game()
: Application()
{
public:
Game() : Application({}) {}
~Game() {}
};
Inferno::Application& Inferno::createApplication()
{
return Game::the();
}
Game::~Game()
{
}
void Game::update()
{
}
void Game::render()
{
}
Inferno::Application* Inferno::createApplication(int argc, char* argv[])
{
return new Game;
}
+19
View File
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2022 Riyyi
*
* SPDX-License-Identifier: MIT
*/
#include "inferno.h"
#include "inferno/entrypoint.h"
class Game final : public Inferno::Application {
public:
Game();
~Game();
void update() override;
void render() override;
};
Inferno::Application* Inferno::createApplication(int argc, char* argv[]);