Index: /orxonox/trunk/src/Makefile.am
===================================================================
--- /orxonox/trunk/src/Makefile.am	(revision 3609)
+++ /orxonox/trunk/src/Makefile.am	(revision 3610)
@@ -52,4 +52,5 @@
 		 lib/coord/helper_parent.cc \
 		 lib/data/data_tank.cc \
+		 lib/graphics/graphics_engine.cc \
 		 lib/graphics/light.cc \
 		 lib/graphics/font/fontset.cc \
@@ -104,4 +105,5 @@
 		 lib/coord/null_parent.h \
 		 lib/coord/helper_parent.h \
+		 lib/graphics/graphics_engine.h \
 		 lib/graphics/light.h \
 		 lib/graphics/font/fontset.h \
Index: /orxonox/trunk/src/Makefile.in
===================================================================
--- /orxonox/trunk/src/Makefile.in	(revision 3609)
+++ /orxonox/trunk/src/Makefile.in	(revision 3610)
@@ -62,10 +62,10 @@
 	projectile.$(OBJEXT) character_attributes.$(OBJEXT) \
 	ai.$(OBJEXT) p_node.$(OBJEXT) null_parent.$(OBJEXT) \
-	helper_parent.$(OBJEXT) data_tank.$(OBJEXT) light.$(OBJEXT) \
-	fontset.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \
-	model.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \
-	base_entity.$(OBJEXT) base_object.$(OBJEXT) \
-	ini_parser.$(OBJEXT) list.$(OBJEXT) vector.$(OBJEXT) \
-	curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
+	helper_parent.$(OBJEXT) data_tank.$(OBJEXT) \
+	graphics_engine.$(OBJEXT) light.$(OBJEXT) fontset.$(OBJEXT) \
+	array.$(OBJEXT) objModel.$(OBJEXT) model.$(OBJEXT) \
+	material.$(OBJEXT) texture.$(OBJEXT) base_entity.$(OBJEXT) \
+	base_object.$(OBJEXT) ini_parser.$(OBJEXT) list.$(OBJEXT) \
+	vector.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
 orxonox_OBJECTS = $(am_orxonox_OBJECTS)
 orxonox_LDADD = $(LDADD)
@@ -83,4 +83,5 @@
 @AMDEP_TRUE@	./$(DEPDIR)/game_loader.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/glmenu_imagescreen.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/graphics_engine.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/helper_parent.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \
@@ -253,4 +254,5 @@
 		 lib/coord/helper_parent.cc \
 		 lib/data/data_tank.cc \
+		 lib/graphics/graphics_engine.cc \
 		 lib/graphics/light.cc \
 		 lib/graphics/font/fontset.cc \
@@ -305,4 +307,5 @@
 		 lib/coord/null_parent.h \
 		 lib/coord/helper_parent.h \
+		 lib/graphics/graphics_engine.h \
 		 lib/graphics/light.h \
 		 lib/graphics/font/fontset.h \
@@ -405,4 +408,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glmenu_imagescreen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_parent.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@
@@ -718,4 +722,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o data_tank.obj `if test -f 'lib/data/data_tank.cc'; then $(CYGPATH_W) 'lib/data/data_tank.cc'; else $(CYGPATH_W) '$(srcdir)/lib/data/data_tank.cc'; fi`
+
+graphics_engine.o: lib/graphics/graphics_engine.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.o -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.o `test -f 'lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`lib/graphics/graphics_engine.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/graphics/graphics_engine.cc' object='graphics_engine.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.o `test -f 'lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`lib/graphics/graphics_engine.cc
+
+graphics_engine.obj: lib/graphics/graphics_engine.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.obj -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.obj `if test -f 'lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) 'lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/graphics_engine.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='lib/graphics/graphics_engine.cc' object='graphics_engine.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.obj `if test -f 'lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) 'lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/graphics_engine.cc'; fi`
 
 light.o: lib/graphics/light.cc
Index: /orxonox/trunk/src/defs/debug.h
===================================================================
--- /orxonox/trunk/src/defs/debug.h	(revision 3609)
+++ /orxonox/trunk/src/defs/debug.h	(revision 3610)
@@ -62,4 +62,5 @@
 #define DEBUG_MODULE_WORLD_ENTITY       0
 #define DEBUG_MODULE_COMMAND_NODE       0
+#define DEBUG_MODULE_GRAPHICS           0
 
 #define DEBUG_MODULE_IMPORTER           0
Index: /orxonox/trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- /orxonox/trunk/src/lib/graphics/graphics_engine.cc	(revision 3610)
+++ /orxonox/trunk/src/lib/graphics/graphics_engine.cc	(revision 3610)
@@ -0,0 +1,116 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "graphics_engine.h"
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+   \todo this constructor is not jet implemented - do it
+*/
+GraphicsEngine::GraphicsEngine () 
+{
+   this->setClassName ("GraphicsEngine");
+
+
+
+  if (SDL_Init(SDL_INIT_VIDEO) == -1)
+    {
+      printf ("could not initialize SDL Video\n");
+      //      return -1;
+    }
+  // Set video mode
+  // TO DO: parse arguments for settings
+  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+  
+
+  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
+  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);    
+  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);  
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
+
+
+
+  int bpp = 16;
+  int width = 640;
+  int height = 480;
+  //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
+  //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
+
+  Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
+
+  /* query SDL for information about our video hardware */
+  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
+  
+  if( videoInfo == NULL)
+    {
+      printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError()); 
+      SDL_Quit ();
+    }
+  if( videoInfo->hw_available)
+    videoFlags |= SDL_HWSURFACE;
+  else 
+    videoFlags |= SDL_SWSURFACE;
+  /*
+  if(VideoInfo -> blit_hw)                            
+    VideoFlags |= SDL_HWACCEL;
+  */
+  
+  if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
+  {
+    printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
+    SDL_Quit();
+    //    return -1;
+  }
+  
+  // Set window labeling
+  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
+  
+  // TO DO: Create a cool icon and use it here
+  // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);  
+
+
+
+}
+
+GraphicsEngine* GraphicsEngine::singletonRef = NULL;
+
+GraphicsEngine* GraphicsEngine::getInstance()
+{
+  if (!GraphicsEngine::singletonRef)
+    GraphicsEngine::singletonRef = new GraphicsEngine();
+  return GraphicsEngine::singletonRef;
+}
+
+
+/**
+   \brief standard deconstructor
+
+*/
+GraphicsEngine::~GraphicsEngine () 
+{
+  // delete what has to be deleted here
+}
+
Index: /orxonox/trunk/src/lib/graphics/graphics_engine.h
===================================================================
--- /orxonox/trunk/src/lib/graphics/graphics_engine.h	(revision 3610)
+++ /orxonox/trunk/src/lib/graphics/graphics_engine.h	(revision 3610)
@@ -0,0 +1,33 @@
+/*! 
+    \file graphics_engine.h
+    
+    \brief defines a Interface between orxonox and graphical input
+
+    handles graphical SDL-initialisation, textures, resolutions, and so on
+*/
+
+#ifndef _GRAPHICS_ENGINE_H
+#define _GRAPHICS_ENGINE_H
+
+#include <SDL/SDL.h>
+
+#include "base_object.h"
+
+// FORWARD DEFINITION \\
+
+
+class GraphicsEngine : public BaseObject 
+{
+ public:
+  static GraphicsEngine* getInstance();
+  virtual ~GraphicsEngine();
+
+ private:
+  GraphicsEngine();
+  static GraphicsEngine* singletonRef;
+
+
+  SDL_Surface* screen;
+};
+
+#endif /* _GRAPHICS_ENGINE_H */
Index: /orxonox/trunk/src/orxonox.cc
===================================================================
--- /orxonox/trunk/src/orxonox.cc	(revision 3609)
+++ /orxonox/trunk/src/orxonox.cc	(revision 3610)
@@ -25,4 +25,5 @@
 
 #include "orxonox.h"
+
 #include "world.h"
 #include "camera.h"
@@ -30,4 +31,6 @@
 #include "command_node.h"
 #include "game_loader.h"
+#include "graphics_engine.h"
+
 #include <string.h>
 int verbose = 4;
@@ -111,65 +114,7 @@
 {
   printf("> Initializing video\n");
-  if (SDL_Init(SDL_INIT_VIDEO) == -1)
-    {
-      printf ("could not initialize SDL Video\n");
-      return -1;
-    }
-  // Set video mode
-  // TO DO: parse arguments for settings
-  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
-  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
-  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
-  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
-  
-
-  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
-  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);    
-  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);  
-  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
-  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
-  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
-  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
-
-
-
-  int bpp = 16;
-  int width = 640;
-  int height = 480;
-  //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
-  //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
-
-  Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
-
-  /* query SDL for information about our video hardware */
-  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
-  
-  if( videoInfo == NULL)
-    {
-      printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError()); 
-      SDL_Quit ();
-    }
-  if( videoInfo->hw_available)
-    videoFlags |= SDL_HWSURFACE;
-  else 
-    videoFlags |= SDL_SWSURFACE;
-  /*
-  if(VideoInfo -> blit_hw)                            
-    VideoFlags |= SDL_HWACCEL;
-  */
-  
-  if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
-  {
-    printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
-    SDL_Quit();
-    return -1;
-  }
-  
-  // Set window labeling
-  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
-  
-  // TO DO: Create a cool icon and use it here
-  // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);  
-
+  
+  GraphicsEngine::getInstance();
+  
   return 0;
 }
