mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
display selected color above the cursor
This commit is contained in:
parent
b960e7491a
commit
d46f067b74
|
@ -2162,14 +2162,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
|
|||
unsigned char *pPixelData = 0x0;
|
||||
Graphics()->ReadBackbuffer(&pPixelData, px, py, 1, 1); // get pixel at location (px, py)
|
||||
|
||||
vec3 PickedColor = vec3(pPixelData[0] / 255.0f, pPixelData[1] / 255.0f, pPixelData[2] / 255.0f);
|
||||
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(PickedColor.r, PickedColor.g, PickedColor.b, 1.0f);
|
||||
IGraphics::CQuadItem QuadItem(0.0f, 0.0f, 20.0f, 20.0f);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
m_SelectedColor = vec4(pPixelData[0] / 255.0f, pPixelData[1] / 255.0f, pPixelData[2] / 255.0f, 1.0f);
|
||||
|
||||
mem_free(pPixelData);
|
||||
}
|
||||
|
@ -4273,9 +4266,11 @@ void CEditor::Render()
|
|||
|
||||
if(m_ShowMousePointer)
|
||||
{
|
||||
// render butt ugly mouse cursor
|
||||
float mx = UI()->MouseX();
|
||||
float my = UI()->MouseY();
|
||||
|
||||
{
|
||||
// render butt ugly mouse cursor
|
||||
Graphics()->TextureSet(m_CursorTexture);
|
||||
Graphics()->QuadsBegin();
|
||||
if(ms_pUiGotContext == UI()->HotItem())
|
||||
|
@ -4284,6 +4279,18 @@ void CEditor::Render()
|
|||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
}
|
||||
|
||||
if(m_MouseEdMode == MOUSE_PIPETTE)
|
||||
{
|
||||
// display selected color (pipette)
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(m_SelectedColor.r, m_SelectedColor.g, m_SelectedColor.b, m_SelectedColor.a);
|
||||
IGraphics::CQuadItem QuadItem(mx+1.0f,my-20.0f, 16.0f, 16.0f);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CEditor::Reset(bool CreateDefault)
|
||||
|
|
|
@ -586,6 +586,8 @@ public:
|
|||
m_SelectedQuadEnvelope = -1;
|
||||
m_SelectedEnvelopePoint = -1;
|
||||
|
||||
m_SelectedColor = vec4(0,0,0,0);
|
||||
|
||||
ms_pUiGotContext = 0;
|
||||
}
|
||||
|
||||
|
@ -726,6 +728,8 @@ public:
|
|||
int m_SelectedQuadEnvelope;
|
||||
int m_SelectedImage;
|
||||
|
||||
vec4 m_SelectedColor;
|
||||
|
||||
IGraphics::CTextureHandle m_CheckerTexture;
|
||||
IGraphics::CTextureHandle m_BackgroundTexture;
|
||||
IGraphics::CTextureHandle m_CursorTexture;
|
||||
|
|
Loading…
Reference in a new issue