MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
ship.hpp
Go to the documentation of this file.
1#ifndef ASTEROIDS3D_SHIP_HPP
2#define ASTEROIDS3D_SHIP_HPP
3
4/**
5 * @file ship.hpp
6 * @brief Player ship state for the Asteroids simulation.
7 */
8
10
11namespace space {
12
13 /**
14 * @class Ship
15 * @brief Mutable gameplay and movement state for a player ship.
16 */
17 class Ship {
18 public:
19 /** @brief Current world-space position. */
20 glm::vec3 position{0.0f, 0.0f, 0.0f};
21 /** @brief Position from the previous simulation step. */
22 glm::vec3 prev_position{0.0f, 0.0f, 0.0f};
23 /** @brief Current world-space velocity. */
24 glm::vec3 velocity{0.0f};
25 /** @brief Euler rotation in degrees. */
26 glm::vec3 rotation{0.0f};
27 /** @brief Current forward speed. */
28 float current_speed = 1.0f;
29 /** @brief Minimum controllable speed. */
30 float min_speed = 0.1f;
31 /** @brief Maximum controllable speed. */
32 float max_speed = 25.0f;
33 /** @brief Yaw rate in degrees per second. */
34 float turn_speed = 140.0f;
35 /** @brief Pitch rate relative to the yaw rate. */
37 /** @brief Third-person camera distance. */
38 float camera_distance = 6.0f;
39 /** @brief Third-person camera height. */
40 float camera_height = 1.6f;
41 /** @brief Whether the ship is rendered. */
42 bool visible = true;
43 /** @brief Whether the ship is currently exploding. */
44 bool exploding = false;
45 /** @brief Remaining explosion animation frames. */
47 /** @brief Remaining lives. */
48 int lives = 5;
49 /** @brief Current score. */
50 int score = 0;
51 /** @brief Frames remaining before the next shot is allowed. */
53 /** @brief Shots already fired in the current burst. */
54 int burst_count = 0;
55 /** @brief Timer controlling continuous fire. */
57 /** @brief Whether firing is disabled by overheating. */
58 bool overheated = false;
59 /** @brief Frames remaining in the overheat cooldown. */
61
62 /** @brief Returns the normalized world-space direction in which the ship points. */
63 glm::vec3 forward() const;
64 };
65
66} // namespace space
67
68#endif
Shared simulation constants, data types, and utility functions.
Mutable gameplay and movement state for a player ship.
Definition ship.hpp:17
glm::vec3 position
Current world-space position.
Definition ship.hpp:20
glm::vec3 rotation
Euler rotation in degrees.
Definition ship.hpp:26
glm::vec3 prev_position
Position from the previous simulation step.
Definition ship.hpp:22
float max_speed
Maximum controllable speed.
Definition ship.hpp:32
float camera_height
Third-person camera height.
Definition ship.hpp:40
int continuous_fire_timer
Timer controlling continuous fire.
Definition ship.hpp:56
int overheat_cooldown
Frames remaining in the overheat cooldown.
Definition ship.hpp:60
float pitch_speed_multiplier
Pitch rate relative to the yaw rate.
Definition ship.hpp:36
int burst_count
Shots already fired in the current burst.
Definition ship.hpp:54
int score
Current score.
Definition ship.hpp:50
float camera_distance
Third-person camera distance.
Definition ship.hpp:38
float min_speed
Minimum controllable speed.
Definition ship.hpp:30
glm::vec3 velocity
Current world-space velocity.
Definition ship.hpp:24
int explosion_timer
Remaining explosion animation frames.
Definition ship.hpp:46
int fire_cooldown
Frames remaining before the next shot is allowed.
Definition ship.hpp:52
bool overheated
Whether firing is disabled by overheating.
Definition ship.hpp:58
float current_speed
Current forward speed.
Definition ship.hpp:28
bool exploding
Whether the ship is currently exploding.
Definition ship.hpp:44
glm::vec3 forward() const
Returns the normalized world-space direction in which the ship points.
Definition ship.cpp:5
float turn_speed
Yaw rate in degrees per second.
Definition ship.hpp:34
int lives
Remaining lives.
Definition ship.hpp:48
bool visible
Whether the ship is rendered.
Definition ship.hpp:42