X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2FABM2.git;a=blobdiff_plain;f=ABM2%2FEngine%2FVideoUpdate.cpp;h=270a67b07a22f9da440f72075da83c601969f0f1;hp=21cf1ab3b9be296118e7b957b6578f1e2d918422;hb=b17f47041c9259eb6b7487df06da0be5fc5d1609;hpb=74b9a225eda4a9c8d97da9f374fd444b3823e5c1 diff --git a/ABM2/Engine/VideoUpdate.cpp b/ABM2/Engine/VideoUpdate.cpp index 21cf1ab..270a67b 100755 --- a/ABM2/Engine/VideoUpdate.cpp +++ b/ABM2/Engine/VideoUpdate.cpp @@ -6,6 +6,7 @@ #include "../main.h" #include "VideoUpdate.h" + // include the Direct3D Library file #ifdef WIN32 #pragma comment (lib, "d3d9.lib") @@ -25,48 +26,10 @@ int CVideoUpdate::scrBPP=16; CVideoUpdate::CVideoUpdate() { -#ifdef WIN32 - d3d = Direct3DCreate9(D3D_SDK_VERSION); - - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - d3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm); - - ZeroMemory(&d3dpp, sizeof(d3dpp)); - d3dpp.Windowed = true; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.hDeviceWindow = hWnd; - //d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; - d3dpp.BackBufferWidth = scrWidth; - d3dpp.BackBufferHeight = scrHeight; - - - // create a device class using this information and the info from the d3dpp stuct - d3d->CreateDevice(D3DADAPTER_DEFAULT, - D3DDEVTYPE_HAL, - hWnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, - &d3dpp, - &d3ddev); - - // Turn on alpha-blending - d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); - // Set the render state up for source alpha blending. - d3ddev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); - d3ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); - // Get the alpha information solely from the texture. - d3ddev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); - d3ddev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); -#endif // WIN32 } CVideoUpdate::~CVideoUpdate() { -#ifdef WIN32 - if (d3ddev != NULL) d3ddev->Release(); - if (d3d != NULL) d3d->Release(); -#endif // WIN32 } bool CVideoUpdate::Start() @@ -96,29 +59,24 @@ bool CVideoUpdate::Start() //hide the mouse cursor SDL_ShowCursor(SDL_DISABLE); */ -#ifdef WIN32 - d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_COLORVALUE(0.0f, 0.4f, 1.0f, 1.0f), 1.0f, 0); - - d3ddev->BeginScene(); // begins the 3D scene -#endif // WIN32 + this->g = new Graphics(scrWidth, scrHeight, 16, false); + if (this->g->createDisplay()) + return false; + this->g->setCullingMode(AM_CULL_NONE); + this->g->setBackground(COLOUR_RGBA(127, 127, 127, 255)); - return true; + this->s = new Sprite("Data/POWBOMB.png", COLOUR_RGBA(0, 0, 255, 255), 64, 64, this->g); + return true; } void CVideoUpdate::Update() { -#ifdef WIN32 - // end frame - d3ddev->EndScene(); - d3ddev->Present(NULL, NULL, NULL, NULL); - - // start new frame - d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_COLORVALUE(0.0f, 0.4f, 1.0f, 1.0f), 1.0f, 0); - d3ddev->BeginScene(); -#endif // WIN32 + this->g->beginScene(); + this->s->blit(0, 0, 1.0, 1.0, 0, 0, COLOUR_RGBA(255, 255, 255, 255)); + this->g->endScene(); } void CVideoUpdate::Stop() { -// SDL_QuitSubSystem(SDL_INIT_VIDEO); + delete this->g; }