forked from vishusmartishus/CS330
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Base.h
97 lines (90 loc) · 2.52 KB
/
Base.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
// Jamie Veals, Jay Bondzeleske, John (Jack) Johnson
//------------------------------------------------------------
//If Base.h is not defined, defines it
#ifndef _BASE_H
#define _BASE_H
//------------------------------------------------------------
// object types
const int flag_ = 1;
const int breakable_ = 2;
const int question_ = 3;
const int fireflower_ = 4;
const int coin_ = 5;
const int mario_ = 6;
const int goomba_ = 7;
const int mushroom_ = 8;
const int plant_ = 9;
const int shell_ = 10;
const int star_ = 11;
const int turtle_ = 12;
const int enemyfireball_ = 13;
const int mariofireball_ = 14;
const int regular_ = 15;
// Base class
class Base {
//------------------------------------------------------------
public:
// Constructor for Base
Base()
{
}
// Destructor for Base
virtual ~Base()
{
}
// Returns an int to indicate an object
// Is called by movable and drawable classes to determine which object is in that spot: a reward, enemy, or block
virtual int objectType();
// OpenGL abstract method to draw object
virtual void draw()=0;
//Sets the isMovable to false
virtual bool isMovable() const { return false; }
// Getters for the left, right, top, and bottom
int left() const { return left_; }
int right() const { return right_; }
int top() const { return top_; }
int bottom() const { return bottom_; }
// Setters for the left, right, top, and bottom
void setLeft(int left);
void setRight(int right);
void setTop(int top);
void setBottom(int bottom);
//------------------------------------------------------------
private:
// Private variables for the left, right, top, and bottom
int left_, right_, bottom_, top_;
};
//------------------------------------------------------------
// Inline methods
//------------------------------------------------------------
// set the object type to 0
inline int Base::objectType()
{
return 0;
}
//------------------------------------------------------------
// set left_
inline void Base::setLeft(int left)
{
left_ = left;
}
//------------------------------------------------------------
// set right_
inline void Base::setRight(int right)
{
right_ = right;
}
//------------------------------------------------------------
// set top_
inline void Base::setTop(int top)
{
top_ = top;
}
//------------------------------------------------------------
// set botttom_
inline void Base::setBottom(int bottom)
{
bottom_ = bottom;
}
//------------------------------------------------------------
#endif