1 // VideoUpdate.cpp: implementation of the CVideoUpdate class.
\r
3 //////////////////////////////////////////////////////////////////////
\r
7 #include "VideoUpdate.h"
\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
17 CVideoUpdate::CVideoUpdate(CKernel* kernel) : ITask(kernel)
\r
19 assert(screenWidth && screenHeight && screenBPP);
\r
20 this->g = new Graphics(scrWidth, scrHeight, 16, false);
\r
23 CVideoUpdate::~CVideoUpdate()
\r
27 bool CVideoUpdate::Start()
\r
30 if(-1==SDL_InitSubSystem(SDL_INIT_VIDEO))
\r
32 CLog::Get().Write(LOG_CLIENT,IDS_GENERIC_SUB_INIT_FAIL,"Video",SDL_GetError());
\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
42 int flags = SDL_OPENGL | SDL_ANYFORMAT | SDL_FULLSCREEN;
\r
44 if(!SDL_SetVideoMode(scrWidth, scrHeight, scrBPP, flags))
\r
46 CLog::Get().Write(LOG_CLIENT, IDS_BAD_DISPLAYMODE, scrWidth, scrHeight, scrBPP, SDL_GetError());
\r
50 //hide the mouse cursor
\r
51 SDL_ShowCursor(SDL_DISABLE);
\r
53 if (this->g->createDisplay())
\r
55 this->g->setCullingMode(AM_CULL_NONE);
\r
56 this->g->setBackground(COLOUR_RGBA(127, 127, 127, 255));
\r
58 /* Start a first scene */
\r
59 this->g->beginScene();
\r
63 void CVideoUpdate::Update()
\r
65 this->g->endScene();
\r
66 this->g->beginScene();
\r
69 void CVideoUpdate::Stop()
\r
71 /* End the last scene */
\r
72 this->g->endScene();
\r