[Scummvm-cvs-logs] SF.net SVN: scummvm:[33112] scummvm/branches/gsoc2008-gui/gui

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Sat Jul 19 17:49:15 CEST 2008


Revision: 33112
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33112&view=rev
Author:   Tanoku
Date:     2008-07-19 15:49:08 +0000 (Sat, 19 Jul 2008)

Log Message:
-----------
Changed drawdata names to a struct.
Fixed text drawing.

Modified Paths:
--------------
    scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
    scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp	2008-07-19 12:05:02 UTC (rev 33111)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp	2008-07-19 15:49:08 UTC (rev 33112)
@@ -39,41 +39,42 @@
 
 using namespace Graphics;
 
-const char *ThemeRenderer::kDrawDataStrings[] = {
-	"mainmenu_bg",
-	"special_bg",
-	"plain_bg",
-	"default_bg",
-	
-	"widget_default",
-	"widget_small",
-	"widget_textedit",
-	"widget_slider",
+const ThemeRenderer::DrawDataInfo ThemeRenderer::kDrawData[] = {
+	{kDDMainDialogBackground, "mainmenu_bg", true},
+	{kDDSpecialColorBackground, "special_bg", true},
+	{kDDPlainColorBackground, "plain_bg", true},
+	{kDDDefaultBackground, "default_bg", true},
 
-	"button_idle",
-	"button_hover",
-	"button_disabled",
+	{kDDWidgetBackgroundDefault, "widget_default", true},
+	{kDDWidgetBackgroundSmall, "widget_small", true},
+	{kDDWidgetBackgroundEditText, "widget_textedit", true},
+	{kDDWidgetBackgroundSlider, "widget_slider", true},
 
-	"slider_full",
-	"slider_empty",
+	{kDDButtonIdle, "button_idle", true},
+	{kDDButtonHover, "button_hover", false},
+	{kDDButtonDisabled, "button_disabled", true},
 
-	"checkbox_enabled",
-	"checkbox_disabled",
+	{kDDSliderFull,"slider_full", false},
+	{kDDSliderEmpty, "slider_empty", true},
 
-	"tab_active",
-	"tab_inactive",
+	{kDDCheckboxEnabled, "checkbox_enabled", false},
+	{kDDCheckboxDisabled, "checkbox_disabled", true},
 
-	"scrollbar_base",
-	"scrollbar_handle",
+	{kDDTabActive, "tab_active", false},
+	{kDDTabInactive, "tab_inactive", true},
 
-	"popup_idle",
-	"popup_hover",
-	
-	"caret",
-	"separator",
-	"default_text"
+	{kDDScrollbarBase, "scrollbar_base", true},
+	{kDDScrollbarHandle, "scrollbar_handle", false},
+
+	{kDDPopUpIdle, "popup_idle", true},
+	{kDDPopUpHover, "popup_hover", false},
+
+	{kDDCaret, "caret", false},
+	{kDDSeparator, "separator", true},
+	{kDDDefaultText, "default_text", false}
 };
 
+
 ThemeRenderer::ThemeRenderer(Common::String themeName, GraphicsMode mode) : 
 	_vectorRenderer(0), _system(0), _graphicsMode(kGfxDisabled), 
 	_screen(0), _backBuffer(0), _bytesPerPixel(0), _initOk(false), 
@@ -523,6 +524,7 @@
 	if (!_initOk)
 		return;
 
+	restoreBackground(r);
 	getFont(font)->drawString(_screen, str, r.left, r.top, r.width(), getTextColor(state), convertAligment(align), deltax, useEllipsis);
 	addDirtyRect(r);
 }

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h	2008-07-19 12:05:02 UTC (rev 33111)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h	2008-07-19 15:49:08 UTC (rev 33112)
@@ -40,6 +40,7 @@
 namespace GUI {
 
 struct WidgetDrawData;
+struct DrawDataInfo;
 
 struct WidgetDrawData {
 	/** List of all the steps needed to draw this widget */
@@ -80,7 +81,6 @@
 	friend class GUI::GuiObject;
 
 	/** Strings representing each value in the DrawData enum */
-	static const char *kDrawDataStrings[];
 
 	/** Constant value to expand dirty rectangles, to make sure they are fully copied */
 	static const int kDirtyRectangleThreshold = 2;
@@ -138,7 +138,14 @@
 		kTextColorInverted,
 		kTextColorMAX
 	};
-
+	
+	struct DrawDataInfo {
+		DrawData id;
+		const char *name;
+		bool buffer;
+	};
+	
+	static const DrawDataInfo kDrawData[];
 	ThemeRenderer(Common::String themeName, GraphicsMode mode);
 
 	~ThemeRenderer() {
@@ -195,8 +202,8 @@
 	// custom stuff - tanoku
 	DrawData getDrawDataId(Common::String &name) {
 		for (int i = 0; i < kDrawDataMAX; ++i)
-			if (name.compareToIgnoreCase(kDrawDataStrings[i]) == 0)
-				return (DrawData)i;
+			if (name.compareToIgnoreCase(kDrawData[i].name) == 0)
+				return kDrawData[i].id;
 
 		return (DrawData)-1;
 	}


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