mirror of
https://github.com/love2d/love.git
synced 2026-08-18 03:34:23 +02:00
Simplify Drawable code
--HG-- branch : minor
This commit is contained in:
@@ -182,21 +182,19 @@ void Text::set(const std::vector<Font::ColoredString> &text, float wrap, Font::A
|
||||
Font::ColoredCodepoints codepoints;
|
||||
Font::getCodepointsFromString(text, codepoints);
|
||||
|
||||
addTextData({codepoints, wrap, align, {}, false, false, Matrix3()});
|
||||
addTextData({codepoints, wrap, align, {}, false, false, Matrix4()});
|
||||
}
|
||||
|
||||
int Text::add(const std::vector<Font::ColoredString> &text, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
|
||||
int Text::add(const std::vector<Font::ColoredString> &text, const Matrix4 &m)
|
||||
{
|
||||
return addf(text, -1.0f, Font::ALIGN_MAX_ENUM, x, y, angle, sx, sy, ox, oy, kx, ky);
|
||||
return addf(text, -1.0f, Font::ALIGN_MAX_ENUM, m);
|
||||
}
|
||||
|
||||
int Text::addf(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
|
||||
int Text::addf(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align, const Matrix4 &m)
|
||||
{
|
||||
Font::ColoredCodepoints codepoints;
|
||||
Font::getCodepointsFromString(text, codepoints);
|
||||
|
||||
Matrix3 m(x, y, angle, sx, sy, ox, oy, kx, ky);
|
||||
|
||||
addTextData({codepoints, wrap, align, {}, true, true, m});
|
||||
|
||||
return (int) text_data.size() - 1;
|
||||
@@ -210,7 +208,7 @@ void Text::clear()
|
||||
vert_offset = 0;
|
||||
}
|
||||
|
||||
void Text::draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
|
||||
void Text::draw(const Matrix4 &m)
|
||||
{
|
||||
if (vbo == nullptr || draw_commands.empty())
|
||||
return;
|
||||
@@ -227,7 +225,7 @@ void Text::draw(float x, float y, float angle, float sx, float sy, float ox, flo
|
||||
const size_t stride = sizeof(Font::GlyphVertex);
|
||||
|
||||
OpenGL::TempTransform transform(gl);
|
||||
transform.get() *= Matrix4(x, y, angle, sx, sy, ox, oy, kx, ky);
|
||||
transform.get() *= m;
|
||||
|
||||
{
|
||||
GLBuffer::Bind bind(*vbo);
|
||||
|
||||
Reference in New Issue
Block a user