-
Notifications
You must be signed in to change notification settings - Fork 0
/
simobject.h
67 lines (46 loc) · 2.07 KB
/
simobject.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
/******************************************************************************
This is the super-class for almost all twodee classes. It is quite
simple. It simply contains a couple of public accessible methods. Its
main feature is that it uses recursive parent-child
relationships. This allows for events such as keypresses, a new
simulation cycle, and rendering to be done recursively.
It also allows all objects to have distinct names - and invaluable
tool for debugging.
*******************************************************************************/
#ifndef SIMOBJECT_H_
#define SIMOBJECT_H_
/******************************************************************************/
/******************************************************************************/
#include <math.h>
#include <vector>
#include <list>
#include "general.h"
using namespace std;
/******************************************************************************/
/******************************************************************************/
class CRender;
class CSimObject;
typedef vector<CSimObject*> TSimObjectsVector;
typedef vector<CSimObject*>::iterator TSimObjectsIterator;
/******************************************************************************/
/******************************************************************************/
class CSimObject
{
public:
CSimObject(const char* pch_name);
virtual ~CSimObject();
const char* GetName() const;
virtual void Draw(CRender* pc_render);
virtual void SimulationStep(unsigned int n_step_number, double f_time, double f_step_interval);
virtual void Keypressed(int keycode);
virtual void AddChild(CSimObject* pc_child);
virtual void RemoveChild(CSimObject* pc_child);
virtual void PrintfChildren(unsigned indent);
virtual TSimObjectsVector* GetChildren();
protected:
char* m_pchName;
TSimObjectsVector m_vecSimObjectChildren;
};
/******************************************************************************/
/******************************************************************************/
#endif