* Remove most unused WIN32 stuff.
[matthijs/ABM2.git] / ABM2 / Engine / VideoUpdate.cpp
1 // VideoUpdate.cpp: implementation of the CVideoUpdate class.\r
2 //\r
3 //////////////////////////////////////////////////////////////////////\r
4 \r
5 #include "engine.h"\r
6 #include "../main.h"\r
7 #include "VideoUpdate.h"\r
8 \r
9 \r
10 CMMPointer<Dator<int> > CVideoUpdate::screenWidth=0;\r
11 CMMPointer<Dator<int> > CVideoUpdate::screenHeight=0;\r
12 CMMPointer<Dator<int> > CVideoUpdate::screenBPP=0;\r
13 int CVideoUpdate::scrWidth=640;\r
14 int CVideoUpdate::scrHeight=480;\r
15 int CVideoUpdate::scrBPP=16;\r
16 \r
17 CVideoUpdate::CVideoUpdate(CKernel* kernel) : ITask(kernel)\r
18 {\r
19         assert(screenWidth && screenHeight && screenBPP);\r
20         this->g = new Graphics(scrWidth, scrHeight, 16, false);\r
21 }\r
22 \r
23 CVideoUpdate::~CVideoUpdate()\r
24 {\r
25 }\r
26 \r
27 bool CVideoUpdate::Start()\r
28 {\r
29 /*\r
30         if(-1==SDL_InitSubSystem(SDL_INIT_VIDEO))\r
31         {\r
32                 CLog::Get().Write(LOG_CLIENT,IDS_GENERIC_SUB_INIT_FAIL,"Video",SDL_GetError());\r
33                 return false;\r
34         }\r
35         SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 );\r
36         SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );\r
37         SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );\r
38         SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );\r
39         SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );\r
40         SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );\r
41 \r
42         int flags = SDL_OPENGL | SDL_ANYFORMAT | SDL_FULLSCREEN;\r
43 \r
44         if(!SDL_SetVideoMode(scrWidth, scrHeight, scrBPP, flags))\r
45         {\r
46                 CLog::Get().Write(LOG_CLIENT, IDS_BAD_DISPLAYMODE, scrWidth, scrHeight, scrBPP, SDL_GetError());\r
47                 return false;\r
48         }\r
49 \r
50         //hide the mouse cursor\r
51         SDL_ShowCursor(SDL_DISABLE);\r
52 */\r
53         if (this->g->createDisplay())\r
54                 return false;\r
55         this->g->setCullingMode(AM_CULL_NONE);\r
56         this->g->setBackground(COLOUR_RGBA(127, 127, 127, 255));\r
57         \r
58         /* Start a first scene */\r
59         this->g->beginScene();\r
60         return true;\r
61 }\r
62 \r
63 void CVideoUpdate::Update()\r
64 {\r
65         this->g->endScene();\r
66         this->g->beginScene();\r
67 }\r
68 \r
69 void CVideoUpdate::Stop()\r
70 {\r
71         /* End the last scene */\r
72         this->g->endScene();\r
73         delete this->g;\r
74 }\r