App: scene_base tracks whether a scene is currently active
This commit is contained in:
parent
a7f259352c
commit
692da35066
1 changed files with 7 additions and 0 deletions
|
|
@ -42,6 +42,9 @@ namespace psemek::app
|
|||
struct scene_base
|
||||
: scene
|
||||
{
|
||||
void on_scene_enter() override { active_ = true; }
|
||||
void on_scene_exit() override { active_ = false; }
|
||||
|
||||
void on_resize(int width, int height) override { width_ = width; height_ = height; }
|
||||
|
||||
void on_mouse_move(int x, int y, int, int) override { mouse_ = geom::point{x, y}; }
|
||||
|
|
@ -54,6 +57,8 @@ namespace psemek::app
|
|||
void on_key_down(SDL_Keycode key) override { keys_.insert(key); }
|
||||
void on_key_up(SDL_Keycode key) override { keys_.erase(key); }
|
||||
|
||||
bool active() const { return active_; }
|
||||
|
||||
bool is_left_button_down() const { return left_button_down_; }
|
||||
bool is_middle_button_down() const { return middle_button_down_; }
|
||||
bool is_right_button_down() const { return right_button_down_; }
|
||||
|
|
@ -66,6 +71,8 @@ namespace psemek::app
|
|||
int height() const { return height_; }
|
||||
|
||||
private:
|
||||
bool active_ = false;
|
||||
|
||||
int width_ = 0;
|
||||
int height_ = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue