Sample tool samples decoration colour when deco menu is visible. fixes #146
This commit is contained in:
parent
52ec84198b
commit
1c443ceb57
@ -171,6 +171,7 @@ GameView::GameView():
|
||||
toolTipPosition(-1, -1),
|
||||
shiftBehaviour(false),
|
||||
ctrlBehaviour(false),
|
||||
altBehaviour(false),
|
||||
showHud(true),
|
||||
showDebug(false),
|
||||
introText(2048),
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "graphics/Graphics.h"
|
||||
#include "Tool.h"
|
||||
#include "GameModel.h"
|
||||
#include "interface/Colour.h"
|
||||
|
||||
VideoBuffer * SampleTool::GetIcon(int toolID, int width, int height)
|
||||
{
|
||||
@ -21,16 +22,24 @@ VideoBuffer * SampleTool::GetIcon(int toolID, int width, int height)
|
||||
|
||||
void SampleTool::Draw(Simulation * sim, Brush * brush, ui::Point position)
|
||||
{
|
||||
int particleType = 0;
|
||||
if(sim->pmap[position.Y][position.X])
|
||||
particleType = sim->parts[sim->pmap[position.Y][position.X]>>8].type;
|
||||
else if(sim->photons[position.Y][position.X])
|
||||
particleType = sim->parts[sim->photons[position.Y][position.X]>>8].type;
|
||||
|
||||
if(particleType)
|
||||
if(gameModel->GetColourSelectorVisibility())
|
||||
{
|
||||
Tool * elementTool = gameModel->GetElementTool(particleType);
|
||||
if(elementTool)
|
||||
gameModel->SetActiveTool(0, elementTool);
|
||||
pixel colour = gameModel->GetRenderer()->GetPixel(position.X, position.Y);
|
||||
gameModel->SetColourSelectorColour(ui::Colour(PIXR(colour), PIXG(colour), PIXB(colour), 255));
|
||||
}
|
||||
else
|
||||
{
|
||||
int particleType = 0;
|
||||
if(sim->pmap[position.Y][position.X])
|
||||
particleType = sim->parts[sim->pmap[position.Y][position.X]>>8].type;
|
||||
else if(sim->photons[position.Y][position.X])
|
||||
particleType = sim->parts[sim->photons[position.Y][position.X]>>8].type;
|
||||
|
||||
if(particleType)
|
||||
{
|
||||
Tool * elementTool = gameModel->GetElementTool(particleType);
|
||||
if(elementTool)
|
||||
gameModel->SetActiveTool(0, elementTool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2272,6 +2272,17 @@ void Renderer::drawblob(int x, int y, unsigned char cr, unsigned char cg, unsign
|
||||
blendpixel(x-1, y+1, cr, cg, cb, 64);
|
||||
}
|
||||
|
||||
pixel Renderer::GetPixel(int x, int y)
|
||||
{
|
||||
if (x<0 || y<0 || x>=VIDXRES || y>=VIDYRES)
|
||||
return 0;
|
||||
#ifdef OGLR
|
||||
return 0;
|
||||
#else
|
||||
return vid[(y*VIDXRES)+x];
|
||||
#endif
|
||||
}
|
||||
|
||||
Renderer::Renderer(Graphics * g, Simulation * sim):
|
||||
sim(NULL),
|
||||
g(NULL),
|
||||
|
@ -115,6 +115,8 @@ public:
|
||||
VideoBuffer DumpFrame();
|
||||
|
||||
void drawblob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb);
|
||||
|
||||
pixel GetPixel(int x, int y);
|
||||
//...
|
||||
//Display mode modifiers
|
||||
void CompileDisplayMode();
|
||||
|
Reference in New Issue
Block a user