-
Notifications
You must be signed in to change notification settings - Fork 0
/
CLife.h
109 lines (69 loc) · 2.06 KB
/
CLife.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef _CLIFE_H_
#define _CLIFE_H_
#include <cstdlib>
#include <ctime>
#include <string>
#include <iostream>
#include "CEvent.h"
#include "CCell.h"
#include "CCellGrid.h"
#include "CGraphicCell.h"
#include "CGraphicGrid.h"
#include "CFPSControl.h"
#include "CColourScheme.h"
class CLife : public CEvent
{
public:
enum GridStep
{
STEP_FULL = 1,
STEP_HALF
};
private:
bool Running;
bool Paused;
bool StepOnce;
bool EditMode;
bool Initialized;
GridStep Stepping;
std::vector< CColourScheme* >::iterator Colours;
std::vector< CColourScheme* > ColourSchemes;
std::string InFile;
std::string OutFile;
std::string Caption;
CCellGrid* LifeGrid;
CGraphicGrid* GraphicGrid;
SDL_Surface* Surf_Display;
CFPSControl* Framerate;
private:
void CommonInit( int CellSize, GridStep stepping, std::string OutFile );
public:
CLife();
~CLife();
void Initialize( int GridCols, int GridRows, int CellSize, GridStep stepping, std::string OutFile = "" );
void Initialize( std::string InFile, int CellSize, GridStep stepping, std::string OutFile = "" );
int OnExecute();
bool OnInit();
void OnEvent( SDL_Event* Event );
void OnLoop();
void OnRender();
void OnExit();
void OnKeyDown( SDLKey sym, SDLMod mod, Uint16 unicode );
void OnKeyUp( SDLKey sym, SDLMod mod, Uint16 unicode );
void OnMouseMove( int mX, int mY, int relX, int relY, bool Left, bool Right, bool Middle );
void OnLButtonDown( int mX, int mY );
void SyncGrids();
//bool CheckStable();
void Stabilize();
void Pause();
void UnPause();
void TogglePause();
void Flash();
void Reset();
void Save();
void ToggleEditMode();
void ToggleStepping();
void SwitchColours();
void Patternify( int pattern );
};
#endif // _CLIFE_H_