Add icons for erase, improve icons for certain walls, fix issue #45
This commit is contained in:
parent
f32cd872ca
commit
0558322709
@ -167,15 +167,15 @@ void GameModel::BuildMenus()
|
||||
Tool * tempTool;
|
||||
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));
|
||||
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);
|
||||
}
|
||||
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));
|
||||
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);
|
||||
}
|
||||
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));
|
||||
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);
|
||||
}
|
||||
menuList[sim->elements[i].MenuSection]->AddTool(tempTool);
|
||||
}
|
||||
|
@ -138,8 +138,8 @@ VideoBuffer * SignTool::GetIcon(int toolID, int width, int height)
|
||||
newTexture->SetPixel(x, y, PIXR(pc), PIXG(pc), PIXB(pc), 255);
|
||||
}
|
||||
}
|
||||
newTexture->SetCharacter((width/2)-5, (height/2)-4, 0xA1, 32, 64, 128, 255);
|
||||
newTexture->SetCharacter((width/2)-5, (height/2)-4, 0xA0, 255, 255, 255, 255);
|
||||
newTexture->SetCharacter((width/2)-5, (height/2)-5, 0xA1, 32, 64, 128, 255);
|
||||
newTexture->SetCharacter((width/2)-5, (height/2)-5, 0xA0, 255, 255, 255, 255);
|
||||
return newTexture;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,10 @@ VideoBuffer * Tool::GetTexture(int width, int height)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void Tool::SetTextureGen(VideoBuffer * (*textureGen)(int, int, int))
|
||||
{
|
||||
this->textureGen = textureGen;
|
||||
}
|
||||
string Tool::GetName() { return toolName; }
|
||||
string Tool::GetDescription() { return toolDescription; }
|
||||
Tool::~Tool() {}
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
string GetName();
|
||||
string GetDescription();
|
||||
VideoBuffer * GetTexture(int width, int height);
|
||||
void SetTextureGen(VideoBuffer * (*textureGen)(int, int, int));
|
||||
virtual ~Tool();
|
||||
virtual void Click(Simulation * sim, Brush * brush, ui::Point position);
|
||||
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
|
||||
|
@ -441,16 +441,17 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
|
||||
if (wt==WL_EWALL)
|
||||
{
|
||||
for (j=0; j<height; j++)
|
||||
for (i=0; i<width; i++)
|
||||
if(i > width/2)
|
||||
{
|
||||
for (i=0; i<(width/4)+j; i++)
|
||||
{
|
||||
if (!(i&j&1))
|
||||
newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255);
|
||||
}
|
||||
for (; i<width; i++)
|
||||
{
|
||||
if (i&j&1)
|
||||
newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(i&j&1))
|
||||
newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255);
|
||||
}
|
||||
}
|
||||
else if (wt==WL_WALLELEC)
|
||||
@ -467,18 +468,19 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
|
||||
else if (wt==WL_EHOLE)
|
||||
{
|
||||
for (j=0; j<height; j++)
|
||||
for (i=0; i<width; i++)
|
||||
if(i < width/2)
|
||||
{
|
||||
for (i=0; i<(width/4)+j; i++)
|
||||
{
|
||||
if (i&j&1)
|
||||
newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255);
|
||||
}
|
||||
else
|
||||
for (; i<width; i++)
|
||||
{
|
||||
if (!(i&j&1))
|
||||
newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (wt == WL_ERASE)
|
||||
{
|
||||
for (j=0; j<height; j+=2)
|
||||
@ -495,12 +497,12 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
|
||||
newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255);
|
||||
}
|
||||
}
|
||||
for (j=4; j<width/2; j++)
|
||||
for (j=3; j<(width-4)/2; j++)
|
||||
{
|
||||
newTexture->SetPixel(j+6, j, 0xFF, 0, 0, 255);
|
||||
newTexture->SetPixel(j+7, j, 0xFF, 0, 0, 255);
|
||||
newTexture->SetPixel(-j+21, j, 0xFF, 0, 0, 255);
|
||||
newTexture->SetPixel(-j+22, j, 0xFF, 0, 0, 255);
|
||||
newTexture->SetPixel(-j+19, j, 0xFF, 0, 0, 255);
|
||||
newTexture->SetPixel(-j+20, j, 0xFF, 0, 0, 255);
|
||||
}
|
||||
}
|
||||
else if(wt == WL_STREAM)
|
||||
@ -513,10 +515,10 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
|
||||
newTexture->SetPixel(i, j, PIXR(pc), PIXG(pc), PIXB(pc), 255);
|
||||
}
|
||||
}
|
||||
newTexture->SetCharacter(4, 3, 0x8D, 255, 255, 255, 255);
|
||||
newTexture->SetCharacter(4, 2, 0x8D, 255, 255, 255, 255);
|
||||
for (i=width/3; i<width; i++)
|
||||
{
|
||||
newTexture->SetPixel(i, 8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255);
|
||||
newTexture->SetPixel(i, 7+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255);
|
||||
}
|
||||
}
|
||||
return newTexture;
|
||||
|
@ -42,7 +42,8 @@ Element::Element():
|
||||
HighTemperatureTransition(NT),
|
||||
|
||||
Update(NULL),
|
||||
Graphics(&Element::defaultGraphics)
|
||||
Graphics(&Element::defaultGraphics),
|
||||
IconGenerator(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
unsigned int Properties;
|
||||
int (*Update) (UPDATE_FUNC_ARGS);
|
||||
int (*Graphics) (GRAPHICS_FUNC_ARGS);
|
||||
VideoBuffer * (*IconGenerator)(int, int, int);
|
||||
|
||||
float HighPressure;
|
||||
int HighPressureTransition;
|
||||
|
@ -43,7 +43,24 @@ Element_NONE::Element_NONE()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
|
||||
IconGenerator = &Element_NONE::iconGen;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_NONE static VideoBuffer * iconGen(int, int, int)
|
||||
VideoBuffer * Element_NONE::iconGen(int wallID, int width, int height)
|
||||
{
|
||||
VideoBuffer * newTexture = new VideoBuffer(width, height);
|
||||
|
||||
for (int j=3; j<(width-4)/2; j++)
|
||||
{
|
||||
newTexture->SetPixel(j+6, j, 0xFF, 0, 0, 255);
|
||||
newTexture->SetPixel(j+7, j, 0xFF, 0, 0, 255);
|
||||
newTexture->SetPixel(-j+19, j, 0xFF, 0, 0, 255);
|
||||
newTexture->SetPixel(-j+20, j, 0xFF, 0, 0, 255);
|
||||
}
|
||||
|
||||
return newTexture;
|
||||
}
|
||||
|
||||
|
||||
Element_NONE::~Element_NONE() {}
|
Reference in New Issue
Block a user