Add way of uniquely identifying tools, preserve active menu and tools when rebuilding menus (fixes #170)
This commit is contained in:
parent
d256439c40
commit
5904844e96
@ -16,8 +16,8 @@ public:
|
|||||||
unsigned char Blue;
|
unsigned char Blue;
|
||||||
unsigned char Alpha;
|
unsigned char Alpha;
|
||||||
|
|
||||||
DecorationTool(ToolType decoMode_, string name, string description, int r, int g, int b):
|
DecorationTool(ToolType decoMode_, string name, string description, int r, int g, int b, std::string identifier):
|
||||||
Tool(0, name, description, r, g, b),
|
Tool(0, name, description, r, g, b, identifier),
|
||||||
decoMode(decoMode_),
|
decoMode(decoMode_),
|
||||||
Red(0),
|
Red(0),
|
||||||
Green(0),
|
Green(0),
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "game/DecorationTool.h"
|
#include "game/DecorationTool.h"
|
||||||
#include "GameModelException.h"
|
#include "GameModelException.h"
|
||||||
#include "QuickOptions.h"
|
#include "QuickOptions.h"
|
||||||
|
#include "Format.h"
|
||||||
|
|
||||||
GameModel::GameModel():
|
GameModel::GameModel():
|
||||||
sim(NULL),
|
sim(NULL),
|
||||||
@ -27,12 +28,13 @@ GameModel::GameModel():
|
|||||||
placeSave(NULL),
|
placeSave(NULL),
|
||||||
colour(255, 0, 0, 255),
|
colour(255, 0, 0, 255),
|
||||||
toolStrength(1.0f),
|
toolStrength(1.0f),
|
||||||
activeColourPreset(-1)
|
activeColourPreset(-1),
|
||||||
|
activeMenu(NULL)
|
||||||
{
|
{
|
||||||
sim = new Simulation();
|
sim = new Simulation();
|
||||||
ren = new Renderer(ui::Engine::Ref().g, sim);
|
ren = new Renderer(ui::Engine::Ref().g, sim);
|
||||||
|
|
||||||
memset(activeTools, 0, sizeof(activeTools));
|
std::fill(activeTools, activeTools+3, (Tool*)NULL);
|
||||||
|
|
||||||
//Load config into renderer
|
//Load config into renderer
|
||||||
try
|
try
|
||||||
@ -176,6 +178,18 @@ void GameModel::BuildQuickOptionMenu()
|
|||||||
|
|
||||||
void GameModel::BuildMenus()
|
void GameModel::BuildMenus()
|
||||||
{
|
{
|
||||||
|
char lastMenu = 0;
|
||||||
|
if(activeMenu)
|
||||||
|
lastMenu = activeMenu->GetIcon();
|
||||||
|
|
||||||
|
std::string activeToolIdentifiers[3];
|
||||||
|
if(activeTools[0])
|
||||||
|
activeToolIdentifiers[0] = activeTools[0]->GetIdentifier();
|
||||||
|
if(activeTools[1])
|
||||||
|
activeToolIdentifiers[1] = activeTools[1]->GetIdentifier();
|
||||||
|
if(activeTools[2])
|
||||||
|
activeToolIdentifiers[2] = activeTools[2]->GetIdentifier();
|
||||||
|
|
||||||
//Empty current menus
|
//Empty current menus
|
||||||
for(std::vector<Menu*>::iterator iter = menuList.begin(), end = menuList.end(); iter != end; ++iter)
|
for(std::vector<Menu*>::iterator iter = menuList.begin(), end = menuList.end(); iter != end; ++iter)
|
||||||
{
|
{
|
||||||
@ -205,19 +219,19 @@ void GameModel::BuildMenus()
|
|||||||
Tool * tempTool;
|
Tool * tempTool;
|
||||||
if(i == PT_LIGH)
|
if(i == PT_LIGH)
|
||||||
{
|
{
|
||||||
tempTool = new Element_LIGH_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
tempTool = new Element_LIGH_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].Identifier, sim->elements[i].IconGenerator);
|
||||||
}
|
}
|
||||||
else if(i == PT_TESC)
|
else if(i == PT_TESC)
|
||||||
{
|
{
|
||||||
tempTool = new Element_TESC_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
tempTool = new Element_TESC_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].Identifier, sim->elements[i].IconGenerator);
|
||||||
}
|
}
|
||||||
else if(i == PT_STKM || i == PT_FIGH || i == PT_STKM2)
|
else if(i == PT_STKM || i == PT_FIGH || i == PT_STKM2)
|
||||||
{
|
{
|
||||||
tempTool = new PlopTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
tempTool = new PlopTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].Identifier, sim->elements[i].IconGenerator);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tempTool = new ElementTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
tempTool = new ElementTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].Identifier, sim->elements[i].IconGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sim->elements[i].MenuSection < 12 && sim->elements[i].MenuVisible)
|
if(sim->elements[i].MenuSection < 12 && sim->elements[i].MenuVisible)
|
||||||
@ -235,14 +249,14 @@ void GameModel::BuildMenus()
|
|||||||
//Build menu for GOL types
|
//Build menu for GOL types
|
||||||
for(int i = 0; i < NGOL; i++)
|
for(int i = 0; i < NGOL; i++)
|
||||||
{
|
{
|
||||||
Tool * tempTool = new GolTool(i, sim->gmenu[i].name, std::string(sim->gmenu[i].description), PIXR(sim->gmenu[i].colour), PIXG(sim->gmenu[i].colour), PIXB(sim->gmenu[i].colour));
|
Tool * tempTool = new GolTool(i, sim->gmenu[i].name, std::string(sim->gmenu[i].description), PIXR(sim->gmenu[i].colour), PIXG(sim->gmenu[i].colour), PIXB(sim->gmenu[i].colour), "DEFAULT_PT_LIFE_"+std::string(sim->gmenu[i].name));
|
||||||
menuList[SC_LIFE]->AddTool(tempTool);
|
menuList[SC_LIFE]->AddTool(tempTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Build other menus from wall data
|
//Build other menus from wall data
|
||||||
for(int i = 0; i < UI_WALLCOUNT; i++)
|
for(int i = 0; i < UI_WALLCOUNT; i++)
|
||||||
{
|
{
|
||||||
Tool * tempTool = new WallTool(i, "", std::string(sim->wtypes[i].descs), PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour), sim->wtypes[i].textureGen);
|
Tool * tempTool = new WallTool(i, "", std::string(sim->wtypes[i].descs), PIXR(sim->wtypes[i].colour), PIXG(sim->wtypes[i].colour), PIXB(sim->wtypes[i].colour), "DEFAULT_WL_"+format::NumberToString<int>(i), sim->wtypes[i].textureGen);
|
||||||
menuList[SC_WALL]->AddTool(tempTool);
|
menuList[SC_WALL]->AddTool(tempTool);
|
||||||
//sim->wtypes[i]
|
//sim->wtypes[i]
|
||||||
}
|
}
|
||||||
@ -251,24 +265,24 @@ void GameModel::BuildMenus()
|
|||||||
menuList[SC_TOOL]->AddTool(new SampleTool(this));
|
menuList[SC_TOOL]->AddTool(new SampleTool(this));
|
||||||
menuList[SC_TOOL]->AddTool(new SignTool());
|
menuList[SC_TOOL]->AddTool(new SignTool());
|
||||||
menuList[SC_TOOL]->AddTool(new PropertyTool());
|
menuList[SC_TOOL]->AddTool(new PropertyTool());
|
||||||
menuList[SC_TOOL]->AddTool(new WindTool(0, "WIND", "Create air movement", 64, 64, 64));
|
menuList[SC_TOOL]->AddTool(new WindTool(0, "WIND", "Create air movement", 64, 64, 64, "DEFAULT_UI_WIND"));
|
||||||
|
|
||||||
//Build menu for simtools
|
//Build menu for simtools
|
||||||
for(int i = 0; i < sim->tools.size(); i++)
|
for(int i = 0; i < sim->tools.size(); i++)
|
||||||
{
|
{
|
||||||
Tool * tempTool;
|
Tool * tempTool;
|
||||||
tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour));
|
tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour), sim->tools[i]->Identifier);
|
||||||
menuList[SC_TOOL]->AddTool(tempTool);
|
menuList[SC_TOOL]->AddTool(tempTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add decoration tools to menu
|
//Add decoration tools to menu
|
||||||
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendAdd, "ADD", "Colour blending: Add", 0, 0, 0));
|
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendAdd, "ADD", "Colour blending: Add", 0, 0, 0, "DEFAULT_DECOR_ADD"));
|
||||||
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendRemove, "SUB", "Colour blending: Subtract", 0, 0, 0));
|
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendRemove, "SUB", "Colour blending: Subtract", 0, 0, 0, "DEFAULT_DECOR_SUB"));
|
||||||
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendMultiply, "MUL", "Colour blending: Multiply", 0, 0, 0));
|
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendMultiply, "MUL", "Colour blending: Multiply", 0, 0, 0, "DEFAULT_DECOR_MUL"));
|
||||||
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendDivide, "DIV", "Colour blending: Divide" , 0, 0, 0));
|
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendDivide, "DIV", "Colour blending: Divide" , 0, 0, 0, "DEFAULT_DECOR_DIV"));
|
||||||
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSmudge, "SMDG", "Smudge colour", 0, 0, 0));
|
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSmudge, "SMDG", "Smudge colour", 0, 0, 0, "DEFAULT_DECOR_SMDG"));
|
||||||
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSet, "SET", "Set colour (No blending)", 0, 0, 0));
|
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSet, "SET", "Set colour (No blending)", 0, 0, 0, "DEFAULT_DECOR_SET"));
|
||||||
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::Remove, "CLR", "Clear any set decoration", 0, 0, 0));
|
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::Remove, "CLR", "Clear any set decoration", 0, 0, 0, "DEFAULT_DECOR_CLR"));
|
||||||
|
|
||||||
//Set default brush palette
|
//Set default brush palette
|
||||||
brushList.push_back(new EllipseBrush(ui::Point(4, 4)));
|
brushList.push_back(new EllipseBrush(ui::Point(4, 4)));
|
||||||
@ -276,14 +290,35 @@ void GameModel::BuildMenus()
|
|||||||
brushList.push_back(new TriangleBrush(ui::Point(4, 4)));
|
brushList.push_back(new TriangleBrush(ui::Point(4, 4)));
|
||||||
|
|
||||||
//Set default tools
|
//Set default tools
|
||||||
activeTools[0] = menuList[SC_POWDERS]->GetToolList()[0];
|
activeTools[0] = GetToolFromIdentifier("DEFAULT_PT_DUST");//menuList[SC_POWDERS]->GetToolList()[0];
|
||||||
activeTools[1] = menuList[SC_SPECIAL]->GetToolList()[0];
|
activeTools[1] = GetToolFromIdentifier("DEFAULT_UI_SAMPLE");//menuList[SC_SPECIAL]->GetToolList()[0];
|
||||||
activeTools[2] = menuList[SC_TOOL]->GetToolList()[0];
|
activeTools[2] = GetToolFromIdentifier("DEFAULT_PT_NONE");//menuList[SC_TOOL]->GetToolList()[0];
|
||||||
|
|
||||||
|
if(activeToolIdentifiers[0].length())
|
||||||
|
activeTools[0] = GetToolFromIdentifier(activeToolIdentifiers[0]);
|
||||||
|
if(activeToolIdentifiers[1].length())
|
||||||
|
activeTools[1] = GetToolFromIdentifier(activeToolIdentifiers[1]);
|
||||||
|
if(activeToolIdentifiers[2].length())
|
||||||
|
activeTools[2] = GetToolFromIdentifier(activeToolIdentifiers[2]);
|
||||||
|
|
||||||
lastTool = activeTools[0];
|
lastTool = activeTools[0];
|
||||||
|
|
||||||
//Set default menu
|
//Set default menu
|
||||||
activeMenu = menuList[SC_POWDERS];
|
activeMenu = menuList[SC_POWDERS];
|
||||||
toolList = menuList[SC_POWDERS]->GetToolList();
|
|
||||||
|
if(lastMenu)
|
||||||
|
{
|
||||||
|
for(std::vector<Menu*>::iterator iter = menuList.begin(), end = menuList.end(); iter != end; ++iter)
|
||||||
|
{
|
||||||
|
if((*iter)->GetIcon() == lastMenu)
|
||||||
|
activeMenu = *iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(activeMenu)
|
||||||
|
toolList = activeMenu->GetToolList();
|
||||||
|
else
|
||||||
|
toolList = std::vector<Tool*>();
|
||||||
|
|
||||||
notifyMenuListChanged();
|
notifyMenuListChanged();
|
||||||
notifyToolListChanged();
|
notifyToolListChanged();
|
||||||
@ -291,6 +326,20 @@ void GameModel::BuildMenus()
|
|||||||
notifyLastToolChanged();
|
notifyLastToolChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Tool * GameModel::GetToolFromIdentifier(std::string identifier)
|
||||||
|
{
|
||||||
|
for(std::vector<Menu*>::iterator iter = menuList.begin(), end = menuList.end(); iter != end; ++iter)
|
||||||
|
{
|
||||||
|
std::vector<Tool*> menuTools = (*iter)->GetToolList();
|
||||||
|
for(std::vector<Tool*>::iterator titer = menuTools.begin(), tend = menuTools.end(); titer != tend; ++titer)
|
||||||
|
{
|
||||||
|
if(identifier == (*titer)->GetIdentifier())
|
||||||
|
return *titer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
std::deque<Snapshot*> GameModel::GetHistory()
|
std::deque<Snapshot*> GameModel::GetHistory()
|
||||||
{
|
{
|
||||||
return history;
|
return history;
|
||||||
|
@ -98,6 +98,8 @@ public:
|
|||||||
GameModel();
|
GameModel();
|
||||||
~GameModel();
|
~GameModel();
|
||||||
|
|
||||||
|
Tool * GetToolFromIdentifier(std::string identifier);
|
||||||
|
|
||||||
void SetActiveColourPreset(int preset);
|
void SetActiveColourPreset(int preset);
|
||||||
int GetActiveColourPreset();
|
int GetActiveColourPreset();
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Tool::Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)):
|
Tool::Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
toolID(id),
|
toolID(id),
|
||||||
toolName(name),
|
toolName(name),
|
||||||
toolDescription(description),
|
toolDescription(description),
|
||||||
@ -22,7 +22,8 @@ Tool::Tool(int id, string name, string description, int r, int g, int b, VideoBu
|
|||||||
colBlue(b),
|
colBlue(b),
|
||||||
textureGen(textureGen),
|
textureGen(textureGen),
|
||||||
strength(1.0f),
|
strength(1.0f),
|
||||||
resolution(1)
|
resolution(1),
|
||||||
|
identifier(identifier)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
VideoBuffer * Tool::GetTexture(int width, int height)
|
VideoBuffer * Tool::GetTexture(int width, int height)
|
||||||
@ -37,6 +38,7 @@ void Tool::SetTextureGen(VideoBuffer * (*textureGen)(int, int, int))
|
|||||||
{
|
{
|
||||||
this->textureGen = textureGen;
|
this->textureGen = textureGen;
|
||||||
}
|
}
|
||||||
|
std::string Tool::GetIdentifier() { return identifier; }
|
||||||
string Tool::GetName() { return toolName; }
|
string Tool::GetName() { return toolName; }
|
||||||
string Tool::GetDescription() { return toolDescription; }
|
string Tool::GetDescription() { return toolDescription; }
|
||||||
Tool::~Tool() {}
|
Tool::~Tool() {}
|
||||||
@ -52,8 +54,8 @@ void Tool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Po
|
|||||||
}
|
}
|
||||||
void Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {};
|
void Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {};
|
||||||
|
|
||||||
ElementTool::ElementTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)):
|
ElementTool::ElementTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
Tool(id, name, description, r, g, b, textureGen)
|
Tool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ElementTool::~ElementTool() {}
|
ElementTool::~ElementTool() {}
|
||||||
@ -71,8 +73,8 @@ void ElementTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WallTool::WallTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)):
|
WallTool::WallTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
Tool(id, name, description, r, g, b, textureGen)
|
Tool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
resolution = CELL;
|
resolution = CELL;
|
||||||
}
|
}
|
||||||
@ -112,8 +114,8 @@ void WallTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GolTool::GolTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)):
|
GolTool::GolTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
Tool(id, name, description, r, g, b, textureGen)
|
Tool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
GolTool::~GolTool() {}
|
GolTool::~GolTool() {}
|
||||||
@ -130,8 +132,8 @@ void GolTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
|
|||||||
sim->FloodParts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0);
|
sim->FloodParts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindTool::WindTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)):
|
WindTool::WindTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
Tool(id, name, description, r, g, b, textureGen)
|
Tool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
WindTool::~WindTool() {}
|
WindTool::~WindTool() {}
|
||||||
@ -187,8 +189,8 @@ void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Element_TESC_Tool::Element_TESC_Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)):
|
Element_TESC_Tool::Element_TESC_Tool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
ElementTool(id, name, description, r, g, b, textureGen)
|
ElementTool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void Element_TESC_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position){
|
void Element_TESC_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position){
|
||||||
|
@ -27,11 +27,13 @@ protected:
|
|||||||
string toolDescription;
|
string toolDescription;
|
||||||
float strength;
|
float strength;
|
||||||
int resolution;
|
int resolution;
|
||||||
|
std::string identifier;
|
||||||
public:
|
public:
|
||||||
Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
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; }
|
int GetToolID() { return toolID; }
|
||||||
string GetName();
|
string GetName();
|
||||||
string GetDescription();
|
string GetDescription();
|
||||||
|
std::string GetIdentifier();
|
||||||
int GetResolution() { return resolution; }
|
int GetResolution() { return resolution; }
|
||||||
void SetStrength(float value) { strength = value; }
|
void SetStrength(float value) { strength = value; }
|
||||||
float GetStrength() { return strength; }
|
float GetStrength() { return strength; }
|
||||||
@ -50,7 +52,7 @@ class SignTool: public Tool
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SignTool():
|
SignTool():
|
||||||
Tool(0, "SIGN", "Sign. Click a sign to edit or anywhere else to create a new one", 0, 0, 0, SignTool::GetIcon)
|
Tool(0, "SIGN", "Sign. Click a sign to edit or anywhere else to create a new one", 0, 0, 0, "DEFAULT_UI_SIGN", SignTool::GetIcon)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static VideoBuffer * GetIcon(int toolID, int width, int height);
|
static VideoBuffer * GetIcon(int toolID, int width, int height);
|
||||||
@ -69,7 +71,7 @@ class SampleTool: public Tool
|
|||||||
GameModel * gameModel;
|
GameModel * gameModel;
|
||||||
public:
|
public:
|
||||||
SampleTool(GameModel * model):
|
SampleTool(GameModel * model):
|
||||||
Tool(0, "SMPL", "Sample an element on the screen", 0, 0, 0, SampleTool::GetIcon),
|
Tool(0, "SMPL", "Sample an element on the screen", 0, 0, 0, "DEFAULT_UI_SAMPLE", SampleTool::GetIcon),
|
||||||
gameModel(model)
|
gameModel(model)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -86,7 +88,7 @@ class PropertyTool: public Tool
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertyTool():
|
PropertyTool():
|
||||||
Tool(0, "PROP", "Property Edit. Click to alter the properties of elements in the field", 0xfe, 0xa9, 0x00, NULL)
|
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 ~PropertyTool() {}
|
||||||
@ -101,8 +103,8 @@ class Element_LIGH_Tool: public Tool
|
|||||||
{
|
{
|
||||||
int nextUse;
|
int nextUse;
|
||||||
public:
|
public:
|
||||||
Element_LIGH_Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL):
|
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),
|
Tool(id, name, description, r, g, b, identifier, textureGen),
|
||||||
nextUse(0)
|
nextUse(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -118,7 +120,7 @@ public:
|
|||||||
class ElementTool: public Tool
|
class ElementTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElementTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
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 ~ElementTool();
|
||||||
virtual void Draw(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 DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
|
||||||
@ -129,7 +131,7 @@ public:
|
|||||||
class Element_TESC_Tool: public ElementTool
|
class Element_TESC_Tool: public ElementTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Element_TESC_Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
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 ~Element_TESC_Tool() {}
|
||||||
virtual void Draw(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 DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
|
||||||
@ -140,8 +142,8 @@ public:
|
|||||||
class PlopTool: public ElementTool
|
class PlopTool: public ElementTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlopTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL):
|
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)
|
ElementTool(id, name, description, r, g, b, identifier, textureGen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~PlopTool() {}
|
virtual ~PlopTool() {}
|
||||||
@ -155,7 +157,7 @@ public:
|
|||||||
class WallTool: public Tool
|
class WallTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WallTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
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 ~WallTool();
|
||||||
virtual void Draw(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 DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
|
||||||
@ -166,7 +168,7 @@ public:
|
|||||||
class GolTool: public Tool
|
class GolTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GolTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
GolTool(int id, string name, string description, int r, int g, int b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
||||||
virtual ~GolTool();
|
virtual ~GolTool();
|
||||||
virtual void Draw(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 DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
|
||||||
@ -177,7 +179,7 @@ public:
|
|||||||
class WindTool: public Tool
|
class WindTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WindTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
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 ~WindTool();
|
||||||
virtual void Draw(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 DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
|
||||||
|
Loading…
Reference in New Issue
Block a user