summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-07-13 09:50:11 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-07-13 09:50:11 +0000
commit360408fc4c04a72750ecfece7539260129b765ab (patch)
treed01bdddafa4dd0aa2cab4f3995dda1d0748cccee /src/graphics.cpp
parent6eb84fcfaf55c7e4baf13bfdff8f0a16a5b97d76 (diff)
downloadmana-360408fc4c04a72750ecfece7539260129b765ab.tar.gz
mana-360408fc4c04a72750ecfece7539260129b765ab.tar.bz2
mana-360408fc4c04a72750ecfece7539260129b765ab.tar.xz
mana-360408fc4c04a72750ecfece7539260129b765ab.zip
- Adding the wonderful new font by Bjorn to speech and player names
- Way to system cursor (now you can choose the original sdl cursor in config)
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 42c9bddc..5fbea504 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -34,7 +34,6 @@ SDL_Surface *screen;
Graphics::Graphics():
mouseCursor(NULL)
{
-#ifdef USE_OPENGL
if (useOpenGL) {
// Setup OpenGL
glViewport(0, 0, 800, 600);
@@ -43,23 +42,27 @@ Graphics::Graphics():
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &gotDoubleBuffer);
logger->log("Using OpenGL %s double buffering.",
(gotDoubleBuffer ? "with" : "without"));
+ #ifdef USE_OPENGL
+ setTargetPlane(800, 600);
+ #endif
}
-#endif
-
-#ifdef USE_OPENGL
- setTargetPlane(800, 600);
-#else
- setTarget(SDL_GetVideoSurface());
-#endif
-
- // Hide the system mouse cursor
- SDL_ShowCursor(SDL_DISABLE);
-
- // Load the mouse cursor
- ResourceManager *resman = ResourceManager::getInstance();
- mouseCursor = resman->getImage("graphics/gui/mouse.png");
- if (!mouseCursor) {
- logger->error("Unable to load mouse cursor.");
+ else {
+ #ifndef USE_OPENGL
+ setTarget(SDL_GetVideoSurface());
+ #endif
+ }
+
+ if (config.getValue("cursor", 1)==1)
+ {
+ // Hide the system mouse cursor
+ SDL_ShowCursor(SDL_DISABLE);
+
+ // Load the mouse cursor
+ ResourceManager *resman = ResourceManager::getInstance();
+ mouseCursor = resman->getImage("graphics/gui/mouse.png");
+ if (!mouseCursor) {
+ logger->error("Unable to load mouse cursor.");
+ }
}
// Initialize for drawing
@@ -142,10 +145,11 @@ void Graphics::updateScreen()
if (SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1))
{
// Draw mouse before flipping
- mouseCursor->draw(screen, mouseX - 5, mouseY - 2);
+ if (mouseCursor != NULL) {
+ mouseCursor->draw(screen, mouseX - 5, mouseY - 2);
+ }
}
-#ifdef USE_OPENGL
if (useOpenGL) {
glFlush();
glFinish();
@@ -154,9 +158,6 @@ void Graphics::updateScreen()
else {
SDL_Flip(screen);
}
-#else
- SDL_Flip(screen);
-#endif
// Decrement frame counter when using framerate limiting
if (framesToDraw > 1) framesToDraw--;