Simulant  21.12-574
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
hover_ship.h
1 #pragma once
2 
3 #include "../behaviour.h"
4 
5 namespace smlt {
6 
7 class Window;
8 
9 namespace behaviours {
10 
11 class RigidBody;
12 class RigidBodySimulation;
13 
14 class HoverShip:
15  public BehaviourWithInput,
16  public RefCounted<HoverShip> {
17 
18 public:
19  HoverShip(Window* window);
20 
21  const char* name() const {
22  return "Hover Ship";
23  }
24 
25  void set_hover_height(float h);
26  void set_hover_force(float f);
27 
28  void set_speed(float s);
29  float speed() const { return speed_; }
30 
31  void set_turn_speed(float s);
32  float turn_speed() const { return turn_speed_; }
33 
34  void update(float dt);
35  void fixed_update(float step);
36 
37 private:
38  void on_behaviour_first_update(Organism* owner);
39 
40  RigidBody* body_ = nullptr;
41  RigidBodySimulation* simulation_ = nullptr;
42 
43  float hover_height_ = 3.5f;
44  float hover_force_ = 64.0f;
45  float turn_speed_ = 5.0f;
46  float speed_ = 90.0f;
47 
48  float power_input_ = 0.0f;
49  float turn_input_ = 0.0f;
50 
51 protected:
52  float power_input() const { return power_input_; }
53  void set_power_input(float pi) { power_input_ = pi; }
54 
55  float turn_input() const { return turn_input_; }
56  void set_turn_input(float ti) { turn_input_ = ti; }
57 };
58 
59 }
60 }
smlt::behaviours::RigidBody
Definition: rigid_body.h:38
smlt::Organism
Definition: behaviour.h:132
smlt::RefCounted
Definition: managed.h:65
smlt
Definition: animation.cpp:25
smlt::Window
Definition: window.h:65
smlt::behaviours::HoverShip
Definition: hover_ship.h:16
smlt::behaviours::RigidBodySimulation
Definition: simulation.h:71
smlt::BehaviourWithInput
Definition: behaviour.h:100