[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/games/KGLEngineRefactoring
From: Charles Huet <packadal () gmail ! com>
Date: 2008-12-01 9:59:13
Message-ID: 1228125553.633985.26800.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 891120 by chuet:
fixed kglintro (updated to use the new texturemanager)
M +4 -2 kglbasictexturemanager.cpp
M +1 -0 kglenhancedtexturemanager.cpp
M +9 -5 kglintro.cpp
--- trunk/playground/games/KGLEngineRefactoring/kglbasictexturemanager.cpp \
#891119:891120 @@ -24,7 +24,9 @@
GLint KGLBasicTextureManager::addTexture(const QImage &texture, const QString &name)
{
- return m_textures.insert(pair<QString, GLint>(name, \
KGLEngine2d::getInstance()->bindTexture(texture))).second; + GLint res = \
KGLEngine2d::getInstance()->bindTexture(texture); + m_textures.insert(pair<QString, \
GLint>(name, res)); + return res;
}
GLint KGLBasicTextureManager::getTexture(const QString &name)
@@ -32,7 +34,7 @@
return (m_textures.find(name))->second;
}
-POINT& KGLBasicTextureManager::getTextureDim(const QString &name)
+POINT& KGLBasicTextureManager::getTextureDim(const QString)
{
return m_p;
}
--- trunk/playground/games/KGLEngineRefactoring/kglenhancedtexturemanager.cpp \
#891119:891120 @@ -34,6 +34,7 @@
GLint KGLEnhancedTextureManager::getTexture(const QString &name)
{
+ //TODO search for images with this name in the current dir or default kde dir
GLint res;
map<QString, pair<GLint, POINT> >::const_iterator it = m_textures.find(name);
if(it == m_textures.end())
--- trunk/playground/games/KGLEngineRefactoring/kglintro.cpp #891119:891120
@@ -22,6 +22,7 @@
#include "kglintro.h"
#include "kglspriteitem.h"
+#include "kglengine2d.h"
#include <QTimer>
@@ -33,21 +34,24 @@
m_timer = new QTimer;
m_timer->start(10);
- /*
+
QImage gear(":gear.png");
QImage title(":title.png");
- m_gear = new KGLSpriteItem(gear, typeName, POINT(0.5, 0.5));
+ GLint g = KGLEngine2d::getInstance()->textureManager()->addTexture(gear, "gear");
+ GLint t = KGLEngine2d::getInstance()->textureManager()->addTexture(title, "title");
+
+ m_gear = new KGLSpriteItem(g, typeName, POINT(0.5, 0.5));
m_gear->scale(0.8);
- m_gear2 = new KGLSpriteItem(gear, typeName, POINT(0.5, 0.5));
+ m_gear2 = new KGLSpriteItem(g, typeName, POINT(0.5, 0.5));
m_gear2->scale(0.6);
m_gear2->setPosition(0.28, 0.28);
m_gear2->rotate(90);
- m_title = new KGLSpriteItem(title, typeName, POINT(1.5, 0.25));
+ m_title = new KGLSpriteItem(t, typeName, POINT(1.5, 0.25));
m_title->setPosition(0.5, 0);
-*/
+
addChild(m_gear);
addChild(m_gear2);
addChild(m_title);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic