]> git.tdb.fi Git - libs/game.git/blob - examples/bassteroids/source/playercontroller.h
Load the various setups through resources
[libs/game.git] / examples / bassteroids / source / playercontroller.h
1 #ifndef PLAYERCONTROLLER_H_
2 #define PLAYERCONTROLLER_H_
3
4 #include <msp/game/eventobserver.h>
5 #include <msp/game/owned.h>
6 #include <msp/game/system.h>
7 #include "bullet.h"
8 #include "ship.h"
9
10 class Controls;
11
12 class PlayerController: public Msp::Game::System
13 {
14 private:
15         Controls *controls = nullptr;
16         const ShipSetup &player_setup;
17         const BulletSetup &bullet_setup;
18         Msp::Game::Owned<Ship> player_ship;
19         std::vector<Msp::Game::Owned<Bullet>> bullets;
20
21 public:
22         PlayerController(Msp::Game::Stage &);
23
24         void set_controls(Controls *);
25
26         void tick(Msp::Time::TimeDelta) override;
27         void deferred_tick() override;
28 private:
29         void fire();
30 };
31
32 #endif