Changeset 3610 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Mar 21, 2005, 1:36:16 AM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r3609 r3610 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 12 10 13 11 ### File Specific: 14 main-programmer: ...12 main-programmer: Benjamin Grauer 15 13 co-programmer: ... 16 14 */ 17 15 18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ WORLD_ENTITY16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS 19 17 20 #include "proto_class.h" 21 22 #include "stdincl.h" // maybe 18 #include "graphics_engine.h" 23 19 24 20 using namespace std; … … 29 25 \todo this constructor is not jet implemented - do it 30 26 */ 31 ProtoClass::ProtoClass()27 GraphicsEngine::GraphicsEngine () 32 28 { 33 this->setClassName ("ProtoClass"); 29 this->setClassName ("GraphicsEngine"); 30 31 32 33 if (SDL_Init(SDL_INIT_VIDEO) == -1) 34 { 35 printf ("could not initialize SDL Video\n"); 36 // return -1; 37 } 38 // Set video mode 39 // TO DO: parse arguments for settings 40 //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); 41 //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); 42 //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); 43 //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 44 45 46 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); 47 SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16); 48 SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 49 SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0); 50 SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0); 51 SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0); 52 SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0); 53 54 55 56 int bpp = 16; 57 int width = 640; 58 int height = 480; 59 //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/ 60 //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER; 61 62 Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE; 63 64 /* query SDL for information about our video hardware */ 65 const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo (); 66 67 if( videoInfo == NULL) 68 { 69 printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError()); 70 SDL_Quit (); 71 } 72 if( videoInfo->hw_available) 73 videoFlags |= SDL_HWSURFACE; 74 else 75 videoFlags |= SDL_SWSURFACE; 76 /* 77 if(VideoInfo -> blit_hw) 78 VideoFlags |= SDL_HWACCEL; 79 */ 80 81 if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL) 82 { 83 printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError()); 84 SDL_Quit(); 85 // return -1; 86 } 87 88 // Set window labeling 89 SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION); 90 91 // TO DO: Create a cool icon and use it here 92 // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); 93 94 95 96 } 97 98 GraphicsEngine* GraphicsEngine::singletonRef = NULL; 99 100 GraphicsEngine* GraphicsEngine::getInstance() 101 { 102 if (!GraphicsEngine::singletonRef) 103 GraphicsEngine::singletonRef = new GraphicsEngine(); 104 return GraphicsEngine::singletonRef; 34 105 } 35 106 … … 39 110 40 111 */ 41 ProtoClass::~ProtoClass()112 GraphicsEngine::~GraphicsEngine () 42 113 { 43 114 // delete what has to be deleted here 44 115 } 45 116 46 /**47 \brief nonsense - delete this method48 \param realy nothing to give49 \returns true or false - probably nothing?50 51 this is just to show the doxygen abilities (this for example is an extension for a long comment)52 */53 bool ProtoClass::doNonSense (int nothing) {} -
orxonox/trunk/src/lib/graphics/graphics_engine.h
r3609 r3610 1 1 /*! 2 \file proto_class.h3 \brief Definition of the proto class template, used quickly start work4 \ todo Example: this shows how to use simply add a Marker that here has to be done something.2 \file graphics_engine.h 3 4 \brief defines a Interface between orxonox and graphical input 5 5 6 The Protoclass exists, to help you quikly getting the run for how to develop in orxonox. 7 It is an example for the CODING-CONVENTION, and a starting-point for every class. 6 handles graphical SDL-initialisation, textures, resolutions, and so on 8 7 */ 9 8 10 #ifndef _ PROTO_CLASS_H11 #define _ PROTO_CLASS_H9 #ifndef _GRAPHICS_ENGINE_H 10 #define _GRAPHICS_ENGINE_H 12 11 13 #include "what realy has to be included" 12 #include <SDL/SDL.h> 13 14 14 #include "base_object.h" 15 15 16 16 // FORWARD DEFINITION \\ 17 class someClassWeNeed;18 17 19 18 20 /*class Test;*/ /* forward definition of class Test (without including it here!)*/ 21 22 //! A default class that aids you to start creating a new class 23 /** 24 here can be some longer description of this class 25 */ 26 class ProtoClass : public BaseObject { 27 19 class GraphicsEngine : public BaseObject 20 { 28 21 public: 29 ProtoClass(); 30 virtual ~ProtoClass(); 31 32 bool doNonSense (int nothing); 22 static GraphicsEngine* getInstance(); 23 virtual ~GraphicsEngine(); 33 24 34 25 private: 35 int nonSense; //!< doxygen tag here like this for all the variables - delete this variable if you use this 26 GraphicsEngine(); 27 static GraphicsEngine* singletonRef; 36 28 29 30 SDL_Surface* screen; 37 31 }; 38 32 39 #endif /* _ PROTO_CLASS_H */33 #endif /* _GRAPHICS_ENGINE_H */
Note: See TracChangeset
for help on using the changeset viewer.