JNGL
Easy to use cross-platform 2D game library
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
Fade.hpp
Go to the documentation of this file.
1// Copyright 2025 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include "work.hpp"
8
9namespace jngl {
10
12class Fade : public jngl::Work {
13public:
14 explicit Fade(std::shared_ptr<jngl::Work>, int speed = 20);
15 ~Fade() override;
16 void step() override;
17 void draw() const override;
18
19private:
20 void onQuitEvent() override;
21
24 double fadeCount;
25 int speed;
26 bool quit = false;
27};
28
29} // namespace jngl
Fades between two scenes, first fading to black and then fading to the new scene.
Definition Fade.hpp:12
void draw() const override
Draw the game state.
void onQuitEvent() override
Gets called when the user closes the main window or quit() has been called.
void step() override
Advance the game logic.
Active state of the game, e.g. a menu or the game itself.
Definition work.hpp:13
JNGL's main namespace.