Changed drawdata names to a struct.
Fixed text drawing. svn-id: r33112
This commit is contained in:
parent
cf3832fcce
commit
b5081a02ec
2 changed files with 40 additions and 31 deletions
|
@ -39,41 +39,42 @@ namespace GUI {
|
||||||
|
|
||||||
using namespace Graphics;
|
using namespace Graphics;
|
||||||
|
|
||||||
const char *ThemeRenderer::kDrawDataStrings[] = {
|
const ThemeRenderer::DrawDataInfo ThemeRenderer::kDrawData[] = {
|
||||||
"mainmenu_bg",
|
{kDDMainDialogBackground, "mainmenu_bg", true},
|
||||||
"special_bg",
|
{kDDSpecialColorBackground, "special_bg", true},
|
||||||
"plain_bg",
|
{kDDPlainColorBackground, "plain_bg", true},
|
||||||
"default_bg",
|
{kDDDefaultBackground, "default_bg", true},
|
||||||
|
|
||||||
"widget_default",
|
{kDDWidgetBackgroundDefault, "widget_default", true},
|
||||||
"widget_small",
|
{kDDWidgetBackgroundSmall, "widget_small", true},
|
||||||
"widget_textedit",
|
{kDDWidgetBackgroundEditText, "widget_textedit", true},
|
||||||
"widget_slider",
|
{kDDWidgetBackgroundSlider, "widget_slider", true},
|
||||||
|
|
||||||
"button_idle",
|
{kDDButtonIdle, "button_idle", true},
|
||||||
"button_hover",
|
{kDDButtonHover, "button_hover", false},
|
||||||
"button_disabled",
|
{kDDButtonDisabled, "button_disabled", true},
|
||||||
|
|
||||||
"slider_full",
|
{kDDSliderFull,"slider_full", false},
|
||||||
"slider_empty",
|
{kDDSliderEmpty, "slider_empty", true},
|
||||||
|
|
||||||
"checkbox_enabled",
|
{kDDCheckboxEnabled, "checkbox_enabled", false},
|
||||||
"checkbox_disabled",
|
{kDDCheckboxDisabled, "checkbox_disabled", true},
|
||||||
|
|
||||||
"tab_active",
|
{kDDTabActive, "tab_active", false},
|
||||||
"tab_inactive",
|
{kDDTabInactive, "tab_inactive", true},
|
||||||
|
|
||||||
"scrollbar_base",
|
{kDDScrollbarBase, "scrollbar_base", true},
|
||||||
"scrollbar_handle",
|
{kDDScrollbarHandle, "scrollbar_handle", false},
|
||||||
|
|
||||||
"popup_idle",
|
{kDDPopUpIdle, "popup_idle", true},
|
||||||
"popup_hover",
|
{kDDPopUpHover, "popup_hover", false},
|
||||||
|
|
||||||
"caret",
|
{kDDCaret, "caret", false},
|
||||||
"separator",
|
{kDDSeparator, "separator", true},
|
||||||
"default_text"
|
{kDDDefaultText, "default_text", false}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ThemeRenderer::ThemeRenderer(Common::String themeName, GraphicsMode mode) :
|
ThemeRenderer::ThemeRenderer(Common::String themeName, GraphicsMode mode) :
|
||||||
_vectorRenderer(0), _system(0), _graphicsMode(kGfxDisabled),
|
_vectorRenderer(0), _system(0), _graphicsMode(kGfxDisabled),
|
||||||
_screen(0), _backBuffer(0), _bytesPerPixel(0), _initOk(false),
|
_screen(0), _backBuffer(0), _bytesPerPixel(0), _initOk(false),
|
||||||
|
@ -523,6 +524,7 @@ void ThemeRenderer::drawText(const Common::Rect &r, const Common::String &str, W
|
||||||
if (!_initOk)
|
if (!_initOk)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
restoreBackground(r);
|
||||||
getFont(font)->drawString(_screen, str, r.left, r.top, r.width(), getTextColor(state), convertAligment(align), deltax, useEllipsis);
|
getFont(font)->drawString(_screen, str, r.left, r.top, r.width(), getTextColor(state), convertAligment(align), deltax, useEllipsis);
|
||||||
addDirtyRect(r);
|
addDirtyRect(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
struct WidgetDrawData;
|
struct WidgetDrawData;
|
||||||
|
struct DrawDataInfo;
|
||||||
|
|
||||||
struct WidgetDrawData {
|
struct WidgetDrawData {
|
||||||
/** List of all the steps needed to draw this widget */
|
/** List of all the steps needed to draw this widget */
|
||||||
|
@ -80,7 +81,6 @@ class ThemeRenderer : public Theme {
|
||||||
friend class GUI::GuiObject;
|
friend class GUI::GuiObject;
|
||||||
|
|
||||||
/** Strings representing each value in the DrawData enum */
|
/** 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 */
|
/** Constant value to expand dirty rectangles, to make sure they are fully copied */
|
||||||
static const int kDirtyRectangleThreshold = 2;
|
static const int kDirtyRectangleThreshold = 2;
|
||||||
|
@ -139,6 +139,13 @@ public:
|
||||||
kTextColorMAX
|
kTextColorMAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct DrawDataInfo {
|
||||||
|
DrawData id;
|
||||||
|
const char *name;
|
||||||
|
bool buffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const DrawDataInfo kDrawData[];
|
||||||
ThemeRenderer(Common::String themeName, GraphicsMode mode);
|
ThemeRenderer(Common::String themeName, GraphicsMode mode);
|
||||||
|
|
||||||
~ThemeRenderer() {
|
~ThemeRenderer() {
|
||||||
|
@ -195,8 +202,8 @@ public:
|
||||||
// custom stuff - tanoku
|
// custom stuff - tanoku
|
||||||
DrawData getDrawDataId(Common::String &name) {
|
DrawData getDrawDataId(Common::String &name) {
|
||||||
for (int i = 0; i < kDrawDataMAX; ++i)
|
for (int i = 0; i < kDrawDataMAX; ++i)
|
||||||
if (name.compareToIgnoreCase(kDrawDataStrings[i]) == 0)
|
if (name.compareToIgnoreCase(kDrawData[i].name) == 0)
|
||||||
return (DrawData)i;
|
return kDrawData[i].id;
|
||||||
|
|
||||||
return (DrawData)-1;
|
return (DrawData)-1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue