-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameObject.h
56 lines (39 loc) · 1.05 KB
/
gameObject.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
#pragma once
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;
using namespace sf;
#define WINDOW_SIZE_X 1280
#define WINDOW_SIZE_Y 720
#define CAMERA_SIZE_X WINDOW_SIZE_X / 2
#define CAMERA_SIZE_Y WINDOW_SIZE_Y / 2
//ñìåùåíèå ìåæäó àäðåñîâ ðîäèòåëüñêîãî îáúåêòà òèïà parent_type è àäðåñîì åãî ïîëÿ member
#define offsetof(parent_type, member) ((size_t)&((parent_type *)0)->member)
#define container_of(ptr, type, member) ({
void *_mptr = (void *)(ptr);
((type *)(_mptr - offsetof(type, member))); })
enum ObjectType {
humantype = 0,
robottype,
weapontype,
itemtype,
projectiletype,
walltype,
msgtype,
flowertype
};
class gameObject {
protected:
ObjectType type;
RectangleShape body;
RectangleShape lowSide;
public:
gameObject();
gameObject(Vector2f& size, Vector2f& position, ObjectType t, Texture* texture = NULL);
gameObject(RectangleShape& recSh, ObjectType t, Texture* texture = NULL);
RectangleShape getBody();
RectangleShape getLowSide();
Vector2f getCenter();
ObjectType getType();
void setColor(Color color);
};