diff --git a/data b/data index e2a11a47..06ad8a0d 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit e2a11a47031f0b8b8c5bc6aa71dca3ab283b143b +Subproject commit 06ad8a0d365033e86e5716273bd17e46d94ca7bc diff --git a/src/ui/controls/edit.cpp b/src/ui/controls/edit.cpp index d2888986..8d77d853 100644 --- a/src/ui/controls/edit.cpp +++ b/src/ui/controls/edit.cpp @@ -953,7 +953,7 @@ void CEdit::Draw() end.x = dim.x-MARGX*2.0f; start.y = ppos.y-(m_bMulti?0.0f:MARGY1)-m_lineHeight*(BIG_FONT-1.0f); end.y = m_lineHeight*BIG_FONT; - DrawPart(start, end, 2); // blue gradient background -> + DrawHorizontalGradient(start, end, Gfx::Color(0.549f, 0.514f, 0.376f, 1.0f), Gfx::Color(0.733f, 0.706f, 0.600f, 1.0f)); // blue gradient background size *= BIG_FONT; ppos.y -= m_lineHeight*(BIG_FONT-1.0f); @@ -967,7 +967,7 @@ void CEdit::Draw() end.x = dim.x-MARGX*2.0f; start.y = ppos.y-(m_bMulti?0.0f:MARGY1); end.y = m_lineHeight; - DrawPart(start, end, 2); // blue gradient background -> + DrawHorizontalGradient(start, end, Gfx::Color(0.549f, 0.514f, 0.376f, 1.0f), Gfx::Color(0.733f, 0.706f, 0.600f, 1.0f)); // blue gradient background } // Subtitle \s;? @@ -978,7 +978,7 @@ void CEdit::Draw() end.x = dim.x-MARGX*2.0f; start.y = ppos.y-(m_bMulti?0.0f:MARGY1); end.y = m_lineHeight; - DrawPart(start, end, 3); // yellow background gradient -> + DrawHorizontalGradient(start, end, Gfx::Color(0.996f, 0.859f, 0.325f, 1.0f), Gfx::Color(0.996f, 0.953f, 0.792f, 1.0f)); // yellow background gradient } // Table \tab;? @@ -989,7 +989,7 @@ void CEdit::Draw() end.x = dim.x-MARGX*2.0f; start.y = ppos.y-(m_bMulti?0.0f:MARGY1); end.y = m_lineHeight; - DrawPart(start, end, 11); // fond orange d�grad� -> + DrawHorizontalGradient(start, end, Gfx::Color(0.996f, 0.675f, 0.329f, 1.0f), Gfx::Color(1.000f, 0.898f, 0.788f, 1.0f)); // fond orange d�grad� -> } // Image \image; ? @@ -1043,7 +1043,7 @@ void CEdit::Draw() start.y = ppos.y-(m_bMulti?0.0f:MARGY1); end.y = m_lineHeight; if ( m_format.size() > static_cast(beg) && (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG) end.y *= BIG_FONT; - DrawPart(start, end, 1); // plain yellow background + DrawColor(start, end, Gfx::Color(1.000f, 0.620f, 0.075f, 1.0f)); // plain yellow background } eol = 16; // > @@ -1121,7 +1121,7 @@ void CEdit::Draw() pos.x -= 1.0f / 640.0f; dim.x = 2.0f / 640.0f; dim.y = m_lineHeight; - DrawPart(pos, dim, 0); // red + DrawColor(pos, dim, Gfx::Color(1.0f, 0.0f, 0.0f, 1.0f)); // red } if (m_scroll != nullptr && !m_bGeneric) @@ -1214,28 +1214,31 @@ void CEdit::DrawBack(Math::Point pos, Math::Point dim) } } -// Draws an icon background. - -void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon) +void CEdit::DrawHorizontalGradient(Math::Point pos, Math::Point dim, Gfx::Color color1, Gfx::Color color2) { - Math::Point uv1, uv2; - float dp; + m_engine->SetState(Gfx::ENG_RSTATE_OPAQUE_COLOR); - m_engine->SetTexture("textures/effect03.png"); - m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); + Math::Point p1, p2; + p1.x = pos.x; + p1.y = pos.y; + p2.x = pos.x + dim.x; + p2.y = pos.y + dim.y; - uv1.x = (16.0f/256.0f)*(icon%16); - uv1.y = (240.0f/256.0f); - uv2.x = (16.0f/256.0f)+uv1.x; - uv2.y = (16.0f/256.0f)+uv1.y; + Gfx::VertexCol quad[] = + { + Gfx::VertexCol(Math::Vector(p1.x, p1.y, 0.0f), color1), + Gfx::VertexCol(Math::Vector(p1.x, p2.y, 0.0f), color1), + Gfx::VertexCol(Math::Vector(p2.x, p1.y, 0.0f), color2), + Gfx::VertexCol(Math::Vector(p2.x, p2.y, 0.0f), color2) + }; - dp = 0.5f/256.0f; - uv1.x += dp; - uv1.y += dp; - uv2.x -= dp; - uv2.y -= dp; + m_engine->GetDevice()->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, quad, 4); + m_engine->AddStatisticTriangle(2); +} - DrawIcon(pos, dim, uv1, uv2); +void CEdit::DrawColor(Math::Point pos, Math::Point dim, Gfx::Color color) +{ + DrawHorizontalGradient(pos, dim, color, color); } diff --git a/src/ui/controls/edit.h b/src/ui/controls/edit.h index 8ac6f194..be523f10 100644 --- a/src/ui/controls/edit.h +++ b/src/ui/controls/edit.h @@ -196,7 +196,9 @@ protected: void DrawImage(Math::Point pos, std::string name, float width, float offset, float height, int nbLine); void DrawBack(Math::Point pos, Math::Point dim); - void DrawPart(Math::Point pos, Math::Point dim, int icon); + + void DrawHorizontalGradient(Math::Point pos, Math::Point dim, Gfx::Color color1, Gfx::Color color2); + void DrawColor(Math::Point pos, Math::Point dim, Gfx::Color color); void FreeImage(); void LoadImage(std::string name);