Tuning imgui spacing parameters.

This commit is contained in:
Dario Manesku 2014-08-12 13:54:04 +01:00
parent 677ef2d6c5
commit 7225bba1a1

View file

@ -1348,8 +1348,10 @@ struct Imgui
int32_t height = BUTTON_HEIGHT; int32_t height = BUTTON_HEIGHT;
m_widgetY += BUTTON_HEIGHT + DEFAULT_SPACING; m_widgetY += BUTTON_HEIGHT + DEFAULT_SPACING;
const int32_t cx = xx + BUTTON_HEIGHT / 2 - CHECK_SIZE / 2; const int32_t cx = xx + BUTTON_HEIGHT/2 - CHECK_SIZE/2;
const int32_t cy = yy + BUTTON_HEIGHT / 2 - CHECK_SIZE / 2; const int32_t cy = yy + BUTTON_HEIGHT/2 - CHECK_SIZE/2 + DEFAULT_SPACING/2;
const int32_t textY = yy + BUTTON_HEIGHT/2 + TEXT_HEIGHT/2 + DEFAULT_SPACING/2;
bool enabled = _enabled && isEnabled(m_areaId); bool enabled = _enabled && isEnabled(m_areaId);
bool over = enabled && inRect(xx, yy, width, height); bool over = enabled && inRect(xx, yy, width, height);
@ -1379,7 +1381,7 @@ struct Imgui
if (enabled) if (enabled)
{ {
drawText(xx + BUTTON_HEIGHT drawText(xx + BUTTON_HEIGHT
, yy + BUTTON_HEIGHT / 2 + TEXT_HEIGHT / 2 , textY
, ImguiTextAlign::Left , ImguiTextAlign::Left
, _text , _text
, isHot(id) ? imguiRGBA(255, 196, 0, 255) : imguiRGBA(255, 255, 255, 200) , isHot(id) ? imguiRGBA(255, 196, 0, 255) : imguiRGBA(255, 255, 255, 200)
@ -1388,7 +1390,7 @@ struct Imgui
else else
{ {
drawText(xx + BUTTON_HEIGHT drawText(xx + BUTTON_HEIGHT
, yy + BUTTON_HEIGHT / 2 + TEXT_HEIGHT / 2 , textY
, ImguiTextAlign::Left , ImguiTextAlign::Left
, _text , _text
, imguiRGBA(128, 128, 128, 200) , imguiRGBA(128, 128, 128, 200)
@ -1398,7 +1400,7 @@ struct Imgui
if (_subtext) if (_subtext)
{ {
drawText(xx + width - BUTTON_HEIGHT / 2 drawText(xx + width - BUTTON_HEIGHT / 2
, yy + BUTTON_HEIGHT / 2 + TEXT_HEIGHT / 2 , textY
, ImguiTextAlign::Right , ImguiTextAlign::Right
, _subtext , _subtext
, imguiRGBA(255, 255, 255, 128) , imguiRGBA(255, 255, 255, 128)
@ -1501,9 +1503,9 @@ struct Imgui
int32_t xx = m_widgetX; int32_t xx = m_widgetX;
int32_t yy = m_widgetY; int32_t yy = m_widgetY;
m_widgetY += BUTTON_HEIGHT; m_widgetY += BUTTON_HEIGHT + DEFAULT_SPACING;
drawText(xx drawText(xx
, yy + BUTTON_HEIGHT / 2 + TEXT_HEIGHT / 2 , yy + BUTTON_HEIGHT/2 + TEXT_HEIGHT/2 + DEFAULT_SPACING/2
, ImguiTextAlign::Left , ImguiTextAlign::Left
, out , out
, _enabled?imguiRGBA(255, 255, 255, 255):imguiRGBA(255, 255, 255, 128) , _enabled?imguiRGBA(255, 255, 255, 255):imguiRGBA(255, 255, 255, 128)
@ -1650,18 +1652,18 @@ struct Imgui
void separatorLine(uint16_t _height) void separatorLine(uint16_t _height)
{ {
int32_t xx = m_widgetX; const int32_t rectWidth = m_widgetW;
int32_t yy = m_widgetY + _height/2; const int32_t rectHeight = 1;
int32_t width = m_widgetW; const int32_t xx = m_widgetX;
int32_t height = 1; const int32_t yy = m_widgetY + _height/2 - rectHeight;
m_widgetY += _height; m_widgetY += _height;
drawRect( (float)xx drawRect( (float)xx
, (float)yy , (float)yy
, (float)width , (float)rectWidth
, (float)height , (float)rectHeight
, imguiRGBA(255, 255, 255, 32) , imguiRGBA(255, 255, 255, 32)
); );
} }
void drawPolygon(const float* _coords, uint32_t _numCoords, float _r, uint32_t _abgr) void drawPolygon(const float* _coords, uint32_t _numCoords, float _r, uint32_t _abgr)