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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
#ifndef TOOL_H_
#define TOOL_H_
#include <iostream>
using namespace std;
#include "gui/interface/Point.h"
class Simulation;
class Brush;
class VideoBuffer;
class Tool
{
protected:
VideoBuffer * (*textureGen)(int, int, int);
int toolID;
string toolName;
string toolDescription;
float strength;
int resolution;
std::string identifier;
public:
Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
int GetToolID() { return toolID; }
string GetName();
string GetDescription();
std::string GetIdentifier();
int GetResolution() { return resolution; }
void SetStrength(float value) { strength = value; }
float GetStrength() { return strength; }
VideoBuffer * GetTexture(int width, int height);
void SetTextureGen(VideoBuffer * (*textureGen)(int, int, int));
virtual ~Tool();
virtual void Start(Simulation * sim, Brush * brush, ui::Point position);
virtual void Click(Simulation * sim, Brush * brush, ui::Point position);
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2);
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
int colRed, colBlue, colGreen;
};
class SignTool: public Tool
{
public:
SignTool():
Tool(0, "SIGN", "Sign. Displays text. Click on a sign to edit it or anywhere else to place a new one.", 0, 0, 0, "DEFAULT_UI_SIGN", SignTool::GetIcon)
{
}
static VideoBuffer * GetIcon(int toolID, int width, int height);
virtual ~SignTool() {}
virtual void Click(Simulation * sim, Brush * brush, ui::Point position);
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position) { }
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) { }
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
class GameModel;
class SampleTool: public Tool
{
GameModel * gameModel;
public:
SampleTool(GameModel * model):
Tool(0, "SMPL", "Sample an element on the screen.", 0, 0, 0, "DEFAULT_UI_SAMPLE", SampleTool::GetIcon),
gameModel(model)
{
}
static VideoBuffer * GetIcon(int toolID, int width, int height);
virtual ~SampleTool() {}
virtual void Click(Simulation * sim, Brush * brush, ui::Point position) { }
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) { }
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
class PropertyTool: public Tool
{
public:
PropertyTool():
Tool(0, "PROP", "Property Edit. Click to alter the properties of elements in the field.", 0xfe, 0xa9, 0x00, "DEFAULT_UI_PROPERTY", NULL)
{
}
virtual ~PropertyTool() {}
virtual void Click(Simulation * sim, Brush * brush, ui::Point position);
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position) {}
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) { }
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
class Element_LIGH_Tool: public Tool
{
int nextUse;
public:
Element_LIGH_Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL):
Tool(id, name, description, r, g, b, identifier, textureGen),
nextUse(0)
{
}
virtual ~Element_LIGH_Tool() {}
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
virtual void Click(Simulation * sim, Brush * brush, ui::Point position) { }
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) { }
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
class ElementTool: public Tool
{
public:
ElementTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
virtual ~ElementTool();
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2);
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
};
class Element_TESC_Tool: public ElementTool
{
public:
Element_TESC_Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
virtual ~Element_TESC_Tool() {}
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2);
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
};
class PlopTool: public ElementTool
{
public:
PlopTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL):
ElementTool(id, name, description, r, g, b, identifier, textureGen)
{
}
virtual ~PlopTool() {}
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position) {}
virtual void Click(Simulation * sim, Brush * brush, ui::Point position);
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) { }
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
class WallTool: public Tool
{
public:
WallTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
virtual ~WallTool();
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2);
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
};
class WindTool: public Tool
{
public:
WindTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
virtual ~WindTool();
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2);
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
};
#endif /* TOOL_H_ */
|