-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch.h
56 lines (47 loc) · 1.09 KB
/
switch.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
#ifndef SWITCH_H_
#define SWITCH_H_
#include "lozobj.h"
class Switch: public LoZObject { //A switch. Like a Door, has a hash. In fact, is pretty much the same as a door in that everything else is figured out in room.h
private:
bool pressed;
bool stays;
int hash;
public:
Switch(int x, int y, bool t, int h) : LoZObject(x, y) {
id = 'S';
pressed = false;
stays = t;
hash = h;
}
void draw(QPainter& g) {
g.setPen(QPen(QColor(144,104,40)));
g.setBrush(QBrush(QColor(144,104,40), Qt::SolidPattern));
g.drawRect(x, y, 29, 29);
if (pressed) {
g.setPen(QPen(QColor(0,0,0)));
g.setBrush(QBrush(QColor(143,103,41), Qt::SolidPattern));
g.drawEllipse(x+10, y+10, 10, 10);
}
else {
g.setPen(QPen(QColor(0,0,0)));
g.setBrush(QBrush(QColor(205,154,88), Qt::SolidPattern));
g.drawEllipse(x+10, y+10, 10, 10);
}
}
int getHash() {
return hash;
}
void press() {
pressed = true;
}
void unpress() {
pressed = false;
}
bool getPressed() {
return pressed;
}
bool getStays() {
return stays;
}
};
#endif