blob: ee838775c25ae04698b13459e7d27a0a336b2a9e (
plain)
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
|
#pragma once
#include <vector>
#include "cObject.h"
//movemodes
#define _MOVE_RELATIVE 0
#define _MOVE_ABSOULUTE 1
using namespace std;
class cObject; //Circular dependency break (Bad practice. I Know.)
class cObjectHandler
{
public:
cObjectHandler(cRender *_render);
int createObject(cObject *_object);
//Adds _object to managed objects vector
//returns Identifier for newly created vector
int moveObject(int _object, sPos _pos, int _mode);
//Alters position of _object by _pos either relative to old position or Absolute
//Depending on selected _mode (_MOVE_RELATIVE / _MOVE_ABSOLUTE).
int destroyObject(int _object);
//removes _object from vector after deleting it
int write();
//writes all objects in objects[] to render buffer
int clickEvent(sPos _pos, unsigned int _button);
//Calls onClick of cObject at _pos, focuses Object
//returns 0 if successfull, 1 if Object is empty
int charEvent(unsigned char _c);
//Calls onChar of active cObject, default 0
//returns 0 if successfull, 1 if focused Object is empty
void focusNext();
//Focuses next Object
void focus(unsigned int _id);
//Focuses specific Object
private:
void buildHitmap();
vector<cObject*> objects;
vector<vector<unsigned int>> iHitMap;
cRender *render;
unsigned long int iActiveObject;
};
|