[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/games/magazynier
From: Tadeusz Andrzej Kadłubowski <yess () hell ! org ! pl>
Date: 2010-01-06 20:11:48
Message-ID: 1262808708.777679.10608.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1070816 by tkadlubo:
More work on rendering Player from 4 directions
M +19 -12 renderer.cpp
M +1 -0 renderer.h
--- trunk/playground/games/magazynier/renderer.cpp #1070815:1070816
@@ -82,6 +82,7 @@
{
Q_ASSERT(m_itemSize > 0);
QString name;
+ QPixmap pixmap;
switch(cellType) {
case Empty:
name = "Empty";
@@ -110,6 +111,12 @@
} else {
name = "Player";
}
+ pixmap = findPixmap(name, name, m_itemSize, m_itemSize);
+ if (!pixmap) {
+ return findPixmap("Player", name, m_itemSize, m_itemSize);
+ } else {
+ return pixmap;
+ }
break;
case Wall:
@@ -119,24 +126,24 @@
kDebug() << "Requested unknown cell pixmap" << cellType;
break;
}
-
- QPixmap ret;
- if (m_pixmapCache->find(name, ret)) {
- return ret;
- }
-
- return renderNewPixmap(name, name, m_itemSize, m_itemSize);
+
+ return findPixmap(name, name, m_itemSize, m_itemSize);
} //}}}
QPixmap Renderer::getBackground() //{{{
{
- QPixmap cachedBackground;
- if (m_pixmapCache->find("Background", cachedBackground)) {
- return cachedBackground;
+ return findPixmap("Background", "Background", m_viewWidth, m_viewHeight);
+} //}}}
+
+QPixmap Renderer::findPixmap(const QString elementName, const QString cacheName, int \
width, int height) +{
+ QPixmap ret;
+ if (m_pixmapCache->find(cacheName, ret)) {
+ return ret;
}
- return renderNewPixmap("Background", "Background", m_viewWidth, m_viewHeight);
-} //}}}
+ return renderNewPixmap(elementName, cacheName, width, height);
+}
QPixmap Renderer::renderNewPixmap(const QString elementName, const QString \
cacheName, int width, int height) //{{{ {
--- trunk/playground/games/magazynier/renderer.h #1070815:1070816
@@ -52,6 +52,7 @@
KGameTheme *m_theme;
QPixmap renderNewPixmap(const QString elementName, const QString cacheName, int \
width, int height); + QPixmap findPixmap(const QString elementName, const QString \
cacheName, int width, int height);
public slots:
void sizeChanged();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic