mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 12:32:40 +02:00
fix deco sample tool with 1 px brush, fix deco sample also sampling HUD/other text
This commit is contained in:
@@ -1790,6 +1790,7 @@ void GameView::OnDraw()
|
|||||||
{
|
{
|
||||||
ren->clearScreen(1.0f);
|
ren->clearScreen(1.0f);
|
||||||
ren->RenderBegin();
|
ren->RenderBegin();
|
||||||
|
ren->SetSample(c->PointTranslate(currentMouse).X, c->PointTranslate(currentMouse).Y);
|
||||||
if(selectMode == SelectNone && (!zoomEnabled || zoomCursorFixed) && activeBrush && currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES)
|
if(selectMode == SelectNone && (!zoomEnabled || zoomCursorFixed) && activeBrush && currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES)
|
||||||
{
|
{
|
||||||
ui::Point finalCurrentMouse = c->PointTranslate(currentMouse);
|
ui::Point finalCurrentMouse = c->PointTranslate(currentMouse);
|
||||||
|
@@ -24,7 +24,7 @@ void SampleTool::Draw(Simulation * sim, Brush * brush, ui::Point position)
|
|||||||
{
|
{
|
||||||
if(gameModel->GetColourSelectorVisibility())
|
if(gameModel->GetColourSelectorVisibility())
|
||||||
{
|
{
|
||||||
pixel colour = gameModel->GetRenderer()->GetPixel(position.X, position.Y);
|
pixel colour = gameModel->GetRenderer()->sampleColor;
|
||||||
gameModel->SetColourSelectorColour(ui::Colour(PIXR(colour), PIXG(colour), PIXB(colour), 255));
|
gameModel->SetColourSelectorColour(ui::Colour(PIXR(colour), PIXG(colour), PIXB(colour), 255));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -161,6 +161,11 @@ void Renderer::RenderEnd()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::SetSample(int x, int y)
|
||||||
|
{
|
||||||
|
sampleColor = GetPixel(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
void Renderer::clearScreen(float alpha)
|
void Renderer::clearScreen(float alpha)
|
||||||
{
|
{
|
||||||
#ifdef OGLR
|
#ifdef OGLR
|
||||||
@@ -2379,7 +2384,8 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
|
|||||||
colour_mode(0),
|
colour_mode(0),
|
||||||
gridSize(0),
|
gridSize(0),
|
||||||
blackDecorations(false),
|
blackDecorations(false),
|
||||||
debugLines(false)
|
debugLines(false),
|
||||||
|
sampleColor(0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
this->g = g;
|
this->g = g;
|
||||||
this->sim = sim;
|
this->sim = sim;
|
||||||
|
@@ -63,6 +63,7 @@ public:
|
|||||||
Simulation * sim;
|
Simulation * sim;
|
||||||
Graphics * g;
|
Graphics * g;
|
||||||
gcache_item *graphicscache;
|
gcache_item *graphicscache;
|
||||||
|
pixel sampleColor;
|
||||||
|
|
||||||
//Mouse position for debug information
|
//Mouse position for debug information
|
||||||
int mousePosX, mousePosY;
|
int mousePosX, mousePosY;
|
||||||
@@ -94,8 +95,7 @@ public:
|
|||||||
|
|
||||||
void ClearAccumulation();
|
void ClearAccumulation();
|
||||||
void clearScreen(float alpha);
|
void clearScreen(float alpha);
|
||||||
|
void SetSample(int x, int y);
|
||||||
//class SolidsRenderer;
|
|
||||||
|
|
||||||
#ifdef OGLR
|
#ifdef OGLR
|
||||||
void checkShader(GLuint shader, char * shname);
|
void checkShader(GLuint shader, char * shname);
|
||||||
|
Reference in New Issue
Block a user