Widgets can now rotate :O

This commit is contained in:
Eduardo Bart
2013-01-19 14:44:07 -02:00
parent 2fcaf2cc40
commit f389c3b3fe
8 changed files with 41 additions and 3 deletions

View File

@@ -226,6 +226,19 @@ void Painter::rotate(float x, float y, float angle)
translate(x, y);
}
void Painter::pushTransformMatrix()
{
m_transformMatrixStack.push_back(m_transformMatrix);
assert(m_transformMatrixStack.size() < 100);
}
void Painter::popTransformMatrix()
{
assert(m_transformMatrixStack.size() > 0);
setTransformMatrix(m_transformMatrixStack.back());
m_transformMatrixStack.pop_back();
}
void Painter::updateGlTexture()
{
if(m_glTextureId != 0)

View File

@@ -106,6 +106,9 @@ public:
void rotate(float x, float y, float angle);
void rotate(const Point& p, float angle) { rotate(p.x, p.y, angle); }
void pushTransformMatrix();
void popTransformMatrix();
Matrix3 getTransformMatrix() { return m_transformMatrix; }
Matrix3 getProjectionMatrix() { return m_projectionMatrix; }
Matrix3 getTextureMatrix() { return m_textureMatrix; }
@@ -137,6 +140,7 @@ protected:
CoordsBuffer m_coordsBuffer;
std::vector<Matrix3> m_transformMatrixStack;
Matrix3 m_transformMatrix;
Matrix3 m_projectionMatrix;
Matrix3 m_textureMatrix;

View File

@@ -89,8 +89,10 @@ TexturePtr TextureManager::getTexture(const std::string& fileName)
texture = g_textures.getEmptyTexture();
}
if(texture)
if(texture) {
texture->setSmooth(true);
m_textures[filePath] = texture;
}
}
return texture;