JNGL
effects.hpp
Go to the documentation of this file.
1 // Copyright 2020-2021 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
5 #pragma once
6 
7 #include <functional>
8 
9 namespace jngl {
10 
11 class Effect {
12 public:
13  enum class Action {
14  NONE,
15  REMOVE_EFFECT,
16  REMOVE_WIDGET,
17  };
18 
19  virtual ~Effect();
20  [[nodiscard]] virtual Action step() = 0;
21  virtual void beginDraw() const = 0;
22  virtual void endDraw() const = 0;
23 };
24 
25 class Zoom : public Effect {
26 public:
27  explicit Zoom(std::function<float(float)>);
28  Action step() override;
29  void beginDraw() const override;
30  void endDraw() const override;
31 
32 private:
33  std::function<float(float)> function;
34  float time = 0;
35 };
36 
37 class Executor : public Effect {
38 public:
39  explicit Executor(std::function<Action(float)>);
40  Action step() override;
41 
43  void beginDraw() const override;
44  void endDraw() const override;
45 
46 private:
47  std::function<Action(float)> function;
48  float time = 0;
49 };
50 
51 } // namespace jngl
void beginDraw() const override
Does nothing.
JNGL's main namespace.
Definition: App.hpp:10