1 // VideoUpdate.cpp: implementation of the CVideoUpdate class.
\r
3 //////////////////////////////////////////////////////////////////////
\r
7 #include "VideoUpdate.h"
\r
10 // include the Direct3D Library file
\r
12 #pragma comment (lib, "d3d9.lib")
\r
13 #pragma comment (lib, "d3dx9.lib")
\r
15 //////////////////////////////////////////////////////////////////////
\r
16 // Construction/Destruction
\r
17 //////////////////////////////////////////////////////////////////////
\r
18 LPDIRECT3DDEVICE9 d3ddev; // the pointer to the device class
\r
20 CMMPointer<Dator<int> > CVideoUpdate::screenWidth=0;
\r
21 CMMPointer<Dator<int> > CVideoUpdate::screenHeight=0;
\r
22 CMMPointer<Dator<int> > CVideoUpdate::screenBPP=0;
\r
23 int CVideoUpdate::scrWidth=640;
\r
24 int CVideoUpdate::scrHeight=480;
\r
25 int CVideoUpdate::scrBPP=16;
\r
27 CVideoUpdate::CVideoUpdate()
\r
31 CVideoUpdate::~CVideoUpdate()
\r
35 bool CVideoUpdate::Start()
\r
37 assert(screenWidth && screenHeight && screenBPP);
\r
39 if(-1==SDL_InitSubSystem(SDL_INIT_VIDEO))
\r
41 CLog::Get().Write(LOG_CLIENT,IDS_GENERIC_SUB_INIT_FAIL,"Video",SDL_GetError());
\r
44 SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 );
\r
45 SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
\r
46 SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
\r
47 SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
\r
48 SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
\r
49 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
\r
51 int flags = SDL_OPENGL | SDL_ANYFORMAT | SDL_FULLSCREEN;
\r
53 if(!SDL_SetVideoMode(scrWidth, scrHeight, scrBPP, flags))
\r
55 CLog::Get().Write(LOG_CLIENT, IDS_BAD_DISPLAYMODE, scrWidth, scrHeight, scrBPP, SDL_GetError());
\r
59 //hide the mouse cursor
\r
60 SDL_ShowCursor(SDL_DISABLE);
\r
62 this->g = new Graphics(scrWidth, scrHeight, 16, false);
\r
63 if (this->g->createDisplay())
\r
65 this->g->setCullingMode(AM_CULL_NONE);
\r
66 this->g->setBackground(COLOUR_RGBA(127, 127, 127, 255));
\r
68 this->s = new Sprite("Data/POWBOMB.png", COLOUR_RGBA(0, 0, 255, 255), 64, 64, this->g);
\r
72 void CVideoUpdate::Update()
\r
74 this->g->beginScene();
\r
75 this->s->blit(0, 0, 1.0, 1.0, 0, 0, COLOUR_RGBA(255, 255, 255, 255));
\r
76 this->g->endScene();
\r
79 void CVideoUpdate::Stop()
\r