-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCShip.h
103 lines (87 loc) · 2.87 KB
/
CShip.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* @file CShip.h
* @brief Declaration of the CShip class.
*
* This file contains the declaration of the CShip class, which represents a ship object in the game.
* It extends the CGameObject class and adds functionality specific to the ship.
*
* @author Faniel Yemane
*/
#pragma once
#include "CGameObject.h"
/**
* @class CShip
* @brief A class representing a ship object in the game.
*
* This class extends the CGameObject class and adds functionality specific to the ship.
*/
class CShip : public CGameObject {
private:
int m_missileCount; ///< The count of missiles of the ship.
int m_missileStack; ///< The stack of missiles of the ship.
std::vector<CGameObject*>& gameobjects; ///< Reference to the vector of all game objects.
std::vector<CGameObject*>& missileobjects; ///< Reference to the vector of missile objects.
std::vector<CGameObject*>& allobjects; ///< Reference to the vector of all objects.
public:
/**
* @brief Constructor for CShip.
* @param position The position of the ship.
* @param shape The shape of the ship.
* @param color The color of the ship.
* @param missileObjects Reference to the vector of missile objects.
* @param allObjects Reference to the vector of all objects.
*/
CShip(cv::Point position, std::string shape, std::string color, std::vector<CGameObject*>& missileObjects, std::vector<CGameObject*>& allObjects);
/**
* @brief Destructor for CShip.
*/
~CShip();
/**
* @brief Function to rotate the ship left.
*/
void rotate_left();
/**
* @brief Function to rotate the ship right.
*/
void rotate_right();
/**
* @brief Function to stop the rotation of the ship.
*/
void stop_rotation();
/**
* @brief Function to accelerate the ship.
*/
void accelerate();
/**
* @brief Function to decelerate the ship.
*/
void deccelerate();
/**
* @brief Function to update the state of the ship.
* @param canvasSize The size of the canvas.
*/
void update(cv::Rect& canvasSize) override;
/**
* @brief Function to draw the ship on the canvas.
* @param canvas The canvas to draw on.
*/
void draw(cv::Mat& canvas) override;
/**
* @brief Function to fire a missile from the ship.
*/
void fire();
/**
* @brief Function to set the vector of game objects.
* @param gameObjects Reference to the vector of game objects.
*/
void setGameObjects(std::vector<CGameObject*>& gameObjects) {
gameobjects = gameObjects;
}
/**
* @brief Function to set the vector of missile objects.
* @param missileObjects Reference to the vector of missile objects.
*/
void setMissileObjects(std::vector<CGameObject*>& missileObjects) {
missileobjects = missileObjects;
}
};