summary refs log tree commit diff stats
path: root/src/menu_system.h
blob: ded57b5e20f0e045011f0cadf16b4f8c771f420f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef MENU_SYSTEM_H_205861EC
#define MENU_SYSTEM_H_205861EC

#include "system.h"
#include "interpolation.h"

class Game;

class MenuSystem : public System {
public:

  static constexpr SystemKey Key = SystemKey::Menu;

  explicit MenuSystem(Game& game) : game_(game) {}

  void tick(double dt) override;

  // Commands

  void openPauseMenu();

  void closePauseMenu();

  // Info

  double getPauseAnimationProgress() const { return pauseAnimation_.getProgress(); }

  bool isMenuOpen() const { return openState_ == OpenState::Open; }

private:

  enum class OpenState {
    Closed,
    Animating,
    Open
  };

  Game& game_;
  Interpolation pauseAnimation_;
  OpenState openState_ = OpenState::Closed;
};

#endif /* end of include guard: MENU_SYSTEM_H_205861EC */