Engine+Example: Improve entrypoint via manual singleton
This commit is contained in:
+20
-11
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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[]);
|
||||
Reference in New Issue
Block a user