diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/InterfaceManager.cpp | 71 | ||||
-rw-r--r-- | gui/InterfaceManager.h | 24 |
2 files changed, 21 insertions, 74 deletions
diff --git a/gui/InterfaceManager.cpp b/gui/InterfaceManager.cpp index ffe19dbe9c..ef7fa31a46 100644 --- a/gui/InterfaceManager.cpp +++ b/gui/InterfaceManager.cpp @@ -72,6 +72,7 @@ void InterfaceManager::setGraphicsMode(Graphics_Mode mode) { return; } + freeRenderer(); _vectorRenderer = createRenderer(mode); _vectorRenderer->setSurface(_screen); } @@ -80,46 +81,6 @@ bool InterfaceManager::init() { return false; } -void InterfaceManager::drawWidgetBackground(int x, int y, uint16 hints, WidgetBackground background, WidgetStateInfo state, float scale){ - -} - -void InterfaceManager::drawButton(int x, int y, const Common::String &str, WidgetStateInfo state, uint16 hints, float scale) { - -} - -void InterfaceManager::drawSurface(int x, int y, const Graphics::Surface &surface, WidgetStateInfo state, int alpha, bool themeTrans, float scale) { - -} - -void InterfaceManager::drawSlider(int x, int y, int width, WidgetStateInfo state, float scale) { - -} - -void InterfaceManager::drawCheckbox(int x, int y, const Common::String &str, bool checked, WidgetStateInfo state, float scale) { - -} - -void InterfaceManager::drawTab(int x, int y, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, int titleVPad, WidgetStateInfo state, float scale) { - -} - -void InterfaceManager::drawScrollbar(int x, int y, int sliderY, int sliderHeight, ScrollbarState, WidgetStateInfo state, float scale) { - -} - -void InterfaceManager::drawPopUpWidget(int x, int y, const Common::String &sel, int deltax, WidgetStateInfo state, TextAlign align, float scale) { - -} - -void InterfaceManager::drawCaret(int x, int y, bool erase, WidgetStateInfo state, float scale) { - -} - -void InterfaceManager::drawLineSeparator(int x, int y, WidgetStateInfo state, float scale) { - -} - int InterfaceManager::runGUI() { Common::EventManager *eventMan = _system->getEventManager(); _system->showOverlay(); @@ -142,42 +103,24 @@ int InterfaceManager::runGUI() { steps[1].color2.r = 173; steps[1].color2.g = 40; steps[1].color2.b = 8; - steps[1].x = 500; - steps[1].y = 95; - steps[1].r = 8; - steps[1].w = 120; - steps[1].h = 30; + steps[1].extra_data = 8; // radius steps[1].drawing_call = &VectorRenderer::drawCallback_ROUNDSQ; steps[1].flags = DrawStep::kStepSetGradient; - steps[2].x = 500; - steps[2].y = 135; - steps[2].r = 8; - steps[2].w = 120; - steps[2].h = 30; + steps[2].extra_data = 8; // radius steps[2].drawing_call = &VectorRenderer::drawCallback_ROUNDSQ; steps[2].flags = DrawStep::kStepCallbackOnly; - steps[3].x = 500; - steps[3].y = 175; - steps[3].r = 8; - steps[3].w = 120; - steps[3].h = 30; steps[3].drawing_call = &VectorRenderer::drawCallback_ROUNDSQ; steps[3].flags = DrawStep::kStepCallbackOnly; bool running = true; while (running) { // draw!! - for (int i = 0; i < 4; ++i) - _vectorRenderer->drawStep(&steps[i]); - - _vectorRenderer->setFillMode(VectorRenderer::kFillGradient); - _vectorRenderer->setFgColor(0, 0, 0); - _vectorRenderer->setBgColor(128, 64, 255); - _vectorRenderer->drawTriangle(32, 32, 64, 64, VectorRenderer::kTriangleUp); - - _vectorRenderer->drawBeveledSquare(128, 128, 256, 64, 4); + _vectorRenderer->drawStep(Common::Rect(), &steps[0]); + _vectorRenderer->drawStep(Common::Rect(32, 32, 256, 256), &steps[1]); + _vectorRenderer->drawStep(Common::Rect(128, 128, 512, 190), &steps[2]); +// _vectorRenderer->drawStep(Common::Rect(32, 32, 256, 256), &steps[3]); _vectorRenderer->copyFrame(_system); diff --git a/gui/InterfaceManager.h b/gui/InterfaceManager.h index ff8eee3de0..7820abd6c7 100644 --- a/gui/InterfaceManager.h +++ b/gui/InterfaceManager.h @@ -45,6 +45,7 @@ class InterfaceManager; class InterfaceManager : public Common::Singleton<InterfaceManager> { friend class Common::Singleton<SingletonBaseType>; + typedef Common::String String; public: enum Graphics_Mode { @@ -139,16 +140,16 @@ public: int getCharWidth(byte c, FontStyle font) const { if (_initOk) return _font->getCharWidth(c); return 0; } /** Widget drawing */ - void drawWidgetBackground(int x, int y, uint16 hints, WidgetBackground background, WidgetStateInfo state, float scale = 1.0f); - void drawButton(int x, int y, const Common::String &str, WidgetStateInfo state, uint16 hints, float scale = 1.0f); - void drawSurface(int x, int y, const Graphics::Surface &surface, WidgetStateInfo state, int alpha, bool themeTrans, float scale = 1.0f); - void drawSlider(int x, int y, int width, WidgetStateInfo state, float scale = 1.0f); - void drawCheckbox(int x, int y, const Common::String &str, bool checked, WidgetStateInfo state, float scale = 1.0f); - void drawTab(int x, int y, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, int titleVPad, WidgetStateInfo state, float scale = 1.0f); - void drawScrollbar(int x, int y, int sliderY, int sliderHeight, ScrollbarState, WidgetStateInfo state, float scale = 1.0f); - void drawPopUpWidget(int x, int y, const Common::String &sel, int deltax, WidgetStateInfo state, TextAlign align, float scale = 1.0f); - void drawCaret(int x, int y, bool erase, WidgetStateInfo state, float scale = 1.0f); - void drawLineSeparator(int x, int y, WidgetStateInfo state, float scale = 1.0f); + void drawWidgetBackground(const Common::Rect &r, uint16 hints, WidgetBackground background = kWidgetBackgroundPlain, WidgetStateInfo state = kStateEnabled) {} + void drawButton(const Common::Rect &r, const Common::String &str, WidgetStateInfo state = kStateEnabled, uint16 hints = 0) {} + void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, WidgetStateInfo state = kStateEnabled, int alpha = 256, bool themeTrans = false) {} + void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled) {} + void drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state = kStateEnabled) {} + void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, int titleVPad, WidgetStateInfo state = kStateEnabled) {} + void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState, WidgetStateInfo state = kStateEnabled) {} + void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, WidgetStateInfo state = kStateEnabled, TextAlign align = kTextAlignLeft) {} + void drawCaret(const Common::Rect &r, bool erase, WidgetStateInfo state = kStateEnabled) {} + void drawLineSeparator(const Common::Rect &r, WidgetStateInfo state = kStateEnabled) {} protected: template<typename PixelType> void screenInit(); @@ -183,6 +184,9 @@ protected: }; struct WidgetDrawData { + Common::Rect _realSize; + bool _scaled; + Graphics::DrawStep **_steps; int _stepCount; |