summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-26 22:33:53 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-26 22:33:53 +0000
commit9e4f25acd69489d949104eebec690ce5586849e6 (patch)
treedc4fe4483ece1a374bc44280c72e43cfd5725feb /src/graphics.cpp
parent34e18a818a7696629515c39b920ba35b64832748 (diff)
downloadmana-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/graphics.cpp')
-rw-r--r--src/graphics.cpp51
1 files changed, 47 insertions, 4 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 2ebbc146..8fc60abb 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -46,19 +46,62 @@ Graphics::Graphics(SDL_Surface *screen):
#endif
}
else {
-#ifndef USE_OPENGL
setTarget(mScreen);
-#endif
}
// Initialize for drawing
- _beginDraw();
+ if (useOpenGL) {
+ gcn::OpenGLGraphics::_beginDraw() ;
+ }
+ else {
+ gcn::SDLGraphics::_beginDraw();
+ }
+ //_beginDraw();
}
Graphics::~Graphics()
{
// Deinitialize for drawing
- _endDraw();
+ if (useOpenGL) {
+ gcn::OpenGLGraphics::_endDraw() ;
+ }
+ else {
+ gcn::SDLGraphics::_endDraw();
+ }
+ //_endDraw();
+}
+
+void Graphics::setFont(gcn::ImageFont *font)
+{
+ if (useOpenGL) {
+ gcn::OpenGLGraphics::setFont(font);
+ }
+ else {
+ gcn::SDLGraphics::setFont(font);
+ }
+}
+
+void Graphics::drawText(const std::string &text,
+ int x,
+ int y,
+ unsigned int alignment)
+{
+ if (useOpenGL) {
+ gcn::OpenGLGraphics::drawText(text, x, y, alignment);
+ }
+ else {
+ gcn::SDLGraphics::drawText(text, x, y, alignment);
+ }
+}
+
+void Graphics::setColor(gcn::Color color)
+{
+ if (useOpenGL) {
+ gcn::OpenGLGraphics::setColor(color);
+ }
+ else {
+ gcn::SDLGraphics::setColor(color);
+ }
}
int Graphics::getWidth()