[Scummvm-cvs-logs] SF.net SVN: scummvm: [32898] scummvm/branches/gsoc2008-gui
Tanoku at users.sourceforge.net
Tanoku at users.sourceforge.net
Thu Jul 3 21:42:05 CEST 2008
Revision: 32898
http://scummvm.svn.sourceforge.net/scummvm/?rev=32898&view=rev
Author: Tanoku
Date: 2008-07-03 12:42:04 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
Rendering pipeline. WIP.
(I see working buttons)
Modified Paths:
--------------
scummvm/branches/gsoc2008-gui/common/xmlparser.h
scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp
scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
scummvm/branches/gsoc2008-gui/gui/newgui.cpp
Modified: scummvm/branches/gsoc2008-gui/common/xmlparser.h
===================================================================
--- scummvm/branches/gsoc2008-gui/common/xmlparser.h 2008-07-03 19:32:57 UTC (rev 32897)
+++ scummvm/branches/gsoc2008-gui/common/xmlparser.h 2008-07-03 19:42:04 UTC (rev 32898)
@@ -63,7 +63,7 @@
_pos = idx;
- return _stream->readSByte();
+ return _stream->readByte();
}
void loadStream(SeekableReadStream *s) {
@@ -331,6 +331,13 @@
return (*key == 0);
}
+ /**
+ * Overload if your parser needs to support parsing the same file
+ * several times, so you can clean up the internal state of the
+ * parser before each parse.
+ */
+ virtual void cleanup() {}
+
int _pos; /** Current position on the XML buffer. */
XMLStream _text; /** Buffer with the text being parsed */
Common::String _fileName;
Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h 2008-07-03 19:32:57 UTC (rev 32897)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h 2008-07-03 19:42:04 UTC (rev 32898)
@@ -536,11 +536,11 @@
*/
virtual void copyFrame(OSystem *sys, const Common::Rect &r) {
#ifdef OVERLAY_MULTIPLE_DEPTHS // TODO: change OSystem to support templated copyRectToOverlay
- sys->copyRectToOverlay((const PixelType*)_activeSurface->pixels,
- _activeSurface->pitch, r.top, r.left, r.width(), r.height());
+ sys->copyRectToOverlay((const PixelType*)_activeSurface->getBasePtr(r.left, r.top),
+ _activeSurface->w, r.top, r.left, r.width(), r.height());
#else
- sys->copyRectToOverlay((const OverlayColor*)_activeSurface->pixels,
- _activeSurface->pitch, r.top, r.left, r.width(), r.height());
+ sys->copyRectToOverlay((const OverlayColor*)_activeSurface->getBasePtr(r.left, r.top),
+ _activeSurface->w, r.top, r.left, r.width(), r.height());
#endif
}
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp 2008-07-03 19:32:57 UTC (rev 32897)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp 2008-07-03 19:42:04 UTC (rev 32898)
@@ -58,7 +58,7 @@
"<layout_info>"
"</layout_info>";
- if (!parser()->loadBuffer(defaultXML, false))
+ if (!parser()->loadBuffer((const byte*)defaultXML, strlen(defaultXML), false))
return false;
return parser()->parse();
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp 2008-07-03 19:32:57 UTC (rev 32897)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp 2008-07-03 19:42:04 UTC (rev 32898)
@@ -47,6 +47,7 @@
"button_idle",
"button_hover",
+ "button_disabled",
"surface",
@@ -70,7 +71,7 @@
ThemeRenderer::ThemeRenderer(Common::String themeName, GraphicsMode mode) :
_vectorRenderer(0), _system(0), _graphicsMode(kGfxDisabled),
- _screen(0), _bytesPerPixel(0), _initOk(false), _themeOk(false) {
+ _screen(0), _bytesPerPixel(0), _initOk(false), _themeOk(false), _enabled(false) {
_system = g_system;
_parser = new ThemeParser(this);
@@ -81,8 +82,7 @@
_graphicsMode = mode;
setGraphicsMode(_graphicsMode);
- if (isThemeLoadingRequired())
- loadTheme(themeName);
+ loadConfigFile("classic");
_initOk = true;
_themeName = themeName;
@@ -99,9 +99,21 @@
resetDrawArea();
}
- if (isThemeLoadingRequired())
+ if (!_themeOk || isThemeLoadingRequired()) {
loadTheme(_themeName);
+ Theme::loadTheme(_defaultConfig);
+ Theme::loadTheme(_configFile, false, true);
+ }
+
+ if (_fontName.empty()) {
+ if (_screen->w >= 400 && _screen->h >= 300) {
+ _font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+ } else {
+ _font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+ }
+ }
+
return true;
}
@@ -110,7 +122,6 @@
_system->hideOverlay();
freeRenderer();
freeScreen();
- unloadTheme();
_initOk = false;
}
}
@@ -119,11 +130,23 @@
if (!_initOk)
return;
- _vectorRenderer->clearSurface();
- _vectorRenderer->copyWholeFrame(_system);
- _system->updateScreen();
+ _system->clearOverlay();
+ _system->grabOverlay((OverlayColor*)_screen->pixels, _screen->w);
}
+void ThemeRenderer::enable() {
+ init();
+ resetDrawArea();
+ _system->showOverlay();
+ clearAll();
+ _enabled = true;
+}
+
+void ThemeRenderer::disable() {
+ _system->hideOverlay();
+ _enabled = false;
+}
+
template<typename PixelType>
void ThemeRenderer::screenInit() {
freeScreen();
@@ -228,7 +251,7 @@
void ThemeRenderer::drawDD(DrawData type, const Common::Rect &r) {
if (isWidgetCached(type, r)) {
drawCached(type, r);
- } else {
+ } else if (_widgets[type] != 0) {
for (uint i = 0; i < _widgets[type]->_steps.size(); ++i)
_vectorRenderer->drawStep(r, *_widgets[type]->_steps[i]);
}
@@ -242,6 +265,8 @@
drawDD(kDDButtonIdle, r);
else if (state == kStateHighlight)
drawDD(kDDButtonHover, r);
+ else if (state == kStateDisabled)
+ drawDD(kDDButtonDisabled, r);
// TODO: Add text drawing.
@@ -290,6 +315,11 @@
return;
}
+void ThemeRenderer::updateScreen() {
+// renderDirtyScreen();
+ _vectorRenderer->copyWholeFrame(_system);
+}
+
void ThemeRenderer::renderDirtyScreen() {
// TODO: This isn't really optimized. Check dirty squares for collisions
// and all that.
@@ -299,7 +329,7 @@
for (uint i = 0; i < _dirtyScreen.size(); ++i)
_vectorRenderer->copyFrame(_system, _dirtyScreen[i]);
- _system->updateScreen();
+// _system->updateScreen();
_dirtyScreen.clear();
}
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h 2008-07-03 19:32:57 UTC (rev 32897)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h 2008-07-03 19:42:04 UTC (rev 32898)
@@ -87,6 +87,7 @@
kDDButtonIdle,
kDDButtonHover,
+ kDDButtonDisabled,
kDDSurface,
@@ -124,13 +125,13 @@
void clearAll();
void refresh() {}
- void enable() {}
- void disable() {}
+ void enable();
+ void disable();
void openDialog() {}
void closeAllDialogs() {}
- void updateScreen() {}
+ void updateScreen(); //{}
void resetDrawArea() {}
void openDialog(bool top) {}
@@ -210,6 +211,8 @@
delete _widgets[i];
_widgets[i] = 0;
}
+
+ _themeOk = false;
}
void screenChange() {}
@@ -268,6 +271,7 @@
bool _initOk;
bool _themeOk;
bool _caching;
+ bool _enabled;
Common::String _themeName;
};
Modified: scummvm/branches/gsoc2008-gui/gui/newgui.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/newgui.cpp 2008-07-03 19:32:57 UTC (rev 32897)
+++ scummvm/branches/gsoc2008-gui/gui/newgui.cpp 2008-07-03 19:42:04 UTC (rev 32898)
@@ -242,7 +242,7 @@
while (!_dialogStack.empty() && activeDialog == getTopDialog()) {
if (_needRedraw) {
redraw();
- _needRedraw = false;
+// _needRedraw = false;
}
// Don't "tickle" the dialog until the theme has had a chance
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list