[Scummvm-cvs-logs] SF.net SVN: scummvm: [32640] scummvm/branches/gsoc2008-gui
Tanoku at users.sourceforge.net
Tanoku at users.sourceforge.net
Mon Jun 9 23:16:26 CEST 2008
Revision: 32640
http://scummvm.svn.sourceforge.net/scummvm/?rev=32640&view=rev
Author: Tanoku
Date: 2008-06-09 14:16:26 -0700 (Mon, 09 Jun 2008)
Log Message:
-----------
InterfaceManager is now a singleton
Modified Paths:
--------------
scummvm/branches/gsoc2008-gui/base/main.cpp
scummvm/branches/gsoc2008-gui/gui/InterfaceManager.cpp
scummvm/branches/gsoc2008-gui/gui/InterfaceManager.h
Modified: scummvm/branches/gsoc2008-gui/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/base/main.cpp 2008-06-09 18:03:11 UTC (rev 32639)
+++ scummvm/branches/gsoc2008-gui/base/main.cpp 2008-06-09 21:16:26 UTC (rev 32640)
@@ -70,9 +70,7 @@
#if 1
- GUI::InterfaceManager iManager(&system, GUI::InterfaceManager::kGfxStandard16bit);
-
- iManager.runGUI();
+ g_InterfaceManager.runGUI();
return true;
#else
Modified: scummvm/branches/gsoc2008-gui/gui/InterfaceManager.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/InterfaceManager.cpp 2008-06-09 18:03:11 UTC (rev 32639)
+++ scummvm/branches/gsoc2008-gui/gui/InterfaceManager.cpp 2008-06-09 21:16:26 UTC (rev 32640)
@@ -32,10 +32,20 @@
#include "gui/InterfaceManager.h"
#include "graphics/VectorRenderer.h"
+DECLARE_SINGLETON(GUI::InterfaceManager);
+
namespace GUI {
using namespace Graphics;
+InterfaceManager::InterfaceManager() :
+ _vectorRenderer(0), _system(0), _graphicsMode(kGfxDisabled),
+ _screen(0), _bytesPerPixel(0) {
+ _system = g_system;
+
+ setGraphicsMode(kGfxStandard16bit);
+}
+
template<typename PixelType>
void InterfaceManager::screenInit() {
freeScreen();
@@ -53,10 +63,6 @@
switch (mode) {
case kGfxStandard16bit:
- _bytesPerPixel = sizeof(uint16);
- screenInit<uint16>();
- break;
-
case kGfxAntialias16bit:
_bytesPerPixel = sizeof(uint16);
screenInit<uint16>();
@@ -70,8 +76,8 @@
_vectorRenderer->setSurface(_screen);
}
-void InterfaceManager::init() {
-
+bool InterfaceManager::init() {
+ return false;
}
void InterfaceManager::drawWidgetBackground(int x, int y, uint16 hints, WidgetBackground background, WidgetStateInfo state, float scale){
@@ -168,6 +174,7 @@
_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);
Modified: scummvm/branches/gsoc2008-gui/gui/InterfaceManager.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/InterfaceManager.h 2008-06-09 18:03:11 UTC (rev 32639)
+++ scummvm/branches/gsoc2008-gui/gui/InterfaceManager.h 2008-06-09 21:16:26 UTC (rev 32640)
@@ -37,11 +37,15 @@
namespace GUI {
+#define g_InterfaceManager (GUI::InterfaceManager::instance())
+
struct WidgetDrawData;
class InterfaceManager;
-class InterfaceManager {
+class InterfaceManager : public Common::Singleton<InterfaceManager> {
+ friend class Common::Singleton<SingletonBaseType>;
+
public:
enum Graphics_Mode {
kGfxDisabled = 0,
@@ -107,12 +111,15 @@
kTextAlignRight //! Text should be aligned to the right
};
+ //! Function used to process areas other than the current dialog
+ enum ShadingStyle {
+ kShadingNone, //! No special post processing
+ kShadingDim, //! Dimming unused areas
+ kShadingLuminance //! Converting colors to luminance for unused areas
+ };
- InterfaceManager(OSystem *system, Graphics_Mode mode) : _vectorRenderer(0),
- _system(system), _graphicsMode(kGfxDisabled), _screen(0), _bytesPerPixel(0) {
- setGraphicsMode(mode);
- }
+ InterfaceManager();
~InterfaceManager() {
freeRenderer();
@@ -121,8 +128,10 @@
void setGraphicsMode(Graphics_Mode mode);
int runGUI();
- void init();
+ bool init();
+ bool deinit();
+
/** Font management */
const Graphics::Font *getFont(FontStyle font) const { return _font; }
int getFontHeight(FontStyle font = kFontStyleBold) const { if (_initOk) return _font->getFontHeight(); return 0; }
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