-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathitem.hpp
More file actions
65 lines (55 loc) · 1.24 KB
/
item.hpp
File metadata and controls
65 lines (55 loc) · 1.24 KB
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
#ifndef ITEM_HPP
#define ITEM_HPP
#include "AnimatedSprite.hpp"
#include "soundBuffer_container.hpp"
#include "soundHandler.hpp"
#include "effectHandler.hpp"
#include "texture_container.hpp"
class Item: public AnimSprite{
public:
enum ItemType {
BOOK,
CLOCK,
CLOCK_HAND,
DOOR,
GLASS,
POOL,
SINK,
TRASH,
TREE,
GAMEPAD,
BED,
RADIO,
ONOFF_BUTTON,
TV,
TABLE,
CD,
TV_ON_OFF
};
enum ItemState {
ERRORSTATE = 0,
BROKEN = 1,
DEFAULT = 1<<1,
DELETED = 1<<2,
TRASHED = 1<<3,
};
Item(Anim* a, ItemType i, float _layer = 1.0f);
virtual ~Item() = default;
bool clickable=true;
bool draggable=true;
bool isTrashable=false;
float layer;
unsigned int type;
unsigned int state = DEFAULT;
virtual void update(sf::Time);
virtual void onClick() = 0;
virtual void onDrag(int dx, int dy);
virtual void onDrop();
virtual void onRightClick();
virtual void onTrash(Item* trash);
virtual void changeState();
static bool cmpLayer(Item* lhs, Item* rhs) {
return lhs->layer < rhs->layer;
}
};
#endif // ITEM_HPP