diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-26 22:33:53 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-26 22:33:53 +0000 |
commit | 9e4f25acd69489d949104eebec690ce5586849e6 (patch) | |
tree | dc4fe4483ece1a374bc44280c72e43cfd5725feb /src/gui/gui.cpp | |
parent | 34e18a818a7696629515c39b920ba35b64832748 (diff) | |
download | mana-9e4f25acd69489d949104eebec690ce5586849e6.tar.gz mana-9e4f25acd69489d949104eebec690ce5586849e6.tar.bz2 mana-9e4f25acd69489d949104eebec690ce5586849e6.tar.xz mana-9e4f25acd69489d949104eebec690ce5586849e6.zip |
OpenGL/SDL combined in the same exe. Not in the cutest way, but we'll find a
nicer approach after the release.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r-- | src/gui/gui.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 3babd746..ca5c8133 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -56,7 +56,13 @@ Gui::Gui(Graphics *graphics): { // Set graphics guiGraphics = graphics; - setGraphics(graphics); + //setGraphics(graphics); + if (useOpenGL) { + setGraphics((gcn::OpenGLGraphics*)graphics); + } + else { + setGraphics((gcn::SDLGraphics*)graphics); + } // Set input guiInput = new gcn::SDLInput(); @@ -112,7 +118,7 @@ Gui::Gui(Graphics *graphics): logger->error("Unable to load sansserif8.png!"); } } - + // Set speech font try { speechFont = new gcn::ImageFont( @@ -180,7 +186,7 @@ Gui::~Gui() delete hitRedFont; delete hitBlueFont; delete hitYellowFont; - + if (mMouseCursor) { mMouseCursor->decRef(); } @@ -220,9 +226,14 @@ void Gui::logic() void Gui::draw() { - guiGraphics->pushClipArea(guiTop->getDimension()); - - guiTop->draw(guiGraphics); + if (useOpenGL) { + dynamic_cast<gcn::OpenGLGraphics*>(guiGraphics)->pushClipArea(guiTop->getDimension()); + guiTop->draw((gcn::OpenGLGraphics*)guiGraphics); + } + else { + dynamic_cast<gcn::SDLGraphics*>(guiGraphics)->pushClipArea(guiTop->getDimension()); + guiTop->draw((gcn::SDLGraphics*)guiGraphics); + } int mouseX, mouseY; Uint8 button = SDL_GetMouseState(&mouseX, &mouseY); @@ -233,7 +244,12 @@ void Gui::draw() guiGraphics->drawImage(mMouseCursor, mouseX - 5, mouseY - 2); } - guiGraphics->popClipArea(); + if (useOpenGL) { + dynamic_cast<gcn::OpenGLGraphics*>(guiGraphics)->popClipArea(); + } + else { + dynamic_cast<gcn::SDLGraphics*>(guiGraphics)->popClipArea(); + } } void Gui::mousePress(int mx, int my, int button) |