JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
jngl
WorkFactory.hpp
Go to the documentation of this file.
1
// Copyright 2024 Jan Niklas Hasse <jhasse@bixense.com>
2
// For conditions of distribution and use, see copyright notice in LICENSE.txt
4
#pragma once
5
6
#include "
work.hpp
"
7
8
namespace
jngl
{
9
10
class
WorkFactory
:
public
jngl::Work
{
11
public
:
12
explicit
WorkFactory
(
std::function
<
std::shared_ptr<Work>
()>);
13
14
private
:
15
void
step
()
override
;
16
void
draw
()
const override
;
17
void
onLoad
()
override
;
18
19
std::shared_ptr<Work>
work;
20
std::function<std::shared_ptr<Work>
()> factory;
21
};
22
23
}
// namespace jngl
jngl::WorkFactory
Definition
WorkFactory.hpp:10
jngl::WorkFactory::draw
void draw() const override
Draw the game state.
jngl::WorkFactory::step
void step() override
Advance the game logic.
jngl::WorkFactory::onLoad
void onLoad() override
Gets called when the Work is activated by the main loop.
jngl::Work
Active state of the game, e.g. a menu or the game itself.
Definition
work.hpp:13
std::function
jngl
JNGL's main namespace.
Definition
Achievement.hpp:10
work.hpp