-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bunny.h
85 lines (56 loc) · 1.41 KB
/
Bunny.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
#pragma once
#include <string>
#include <vector>
#include "copy_blocker.h"
// Forward declaration
class Img;
struct Position {
Position(int x = 0, int y = 0, int width = -1, int height = -1) {
m_x = x;
m_y = y;
m_width = width;
m_height = height;
m_is_occupied = false;
}
bool operator==(const Position& pos) {
return ((m_x == pos.m_x) && (m_y == pos.m_x));
}
int m_x;
int m_y;
int m_width;
int m_height;
bool m_is_occupied;
};
class Bunny {
public:
Bunny();
~Bunny();
void Draw(HDC hDc);
void MakeOlder() { ++m_age; };
int get_age() const { return m_age; }
std::wstring get_name() const { return m_name; }
Img* get_img() const { return m_image; }
void set_img(Img* img);
bool is_male() const { return m_is_male; }
bool is_hazardous_vampire() const { return m_is_hazardous_vampire; }
void MakeHazardousVampire() { m_is_hazardous_vampire = true; }
// Returns copy of bunny's image
Img* MakeImgCopy() const;
Position* get_pos() const { return m_pos; }
void set_pos(Position* pos);
static int get_bunnies_overall();
private:
Position* m_pos;
bool RandomHazardous();
// Returns random name from the list of names
std::wstring RandomName();
// Retuns path to random bunny img
std::wstring RandomImgPath();
std::wstring m_name;
bool m_is_male;
short m_age;
bool m_is_hazardous_vampire;
Img* m_image;
static int m_bunnies_overall;
DISALLOW_COPY_AND_ASSING(Bunny);
};