X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2FABM2.git;a=blobdiff_plain;f=ABM2%2FPlayground.cpp;h=edf532567810cc65b9604ebbf8327df29019df07;hp=a7edd74752e1ab3e1cc067bf63c36489bc87f890;hb=ef328ea4a5e0e2f76f474d3b452e8b35b7fb2995;hpb=d63e638c48d3c251f0491a9c6a333a6268fcc794 diff --git a/ABM2/Playground.cpp b/ABM2/Playground.cpp index a7edd74..edf5325 100755 --- a/ABM2/Playground.cpp +++ b/ABM2/Playground.cpp @@ -3,11 +3,14 @@ #include "Engine/VideoUpdate.h" #include "SchemeReader.h" +#if WIN32 LPD3DXSPRITE d3dspt; LPD3DXFONT font; +#endif bool Playground::Start() { + #if WIN32 background = NULL; foreground = NULL; font = NULL; @@ -61,6 +64,7 @@ bool Playground::Start() } } + #endif // init playing field SchemeReader *scheme = new SchemeReader("data/schemes/BASIC.SCH"); for (int i=0; iBegin(NULL); // begin sprite drawing @@ -165,7 +172,7 @@ void Playground::Update() RECT rect3 = {310,10,500,36}; sprintf(buf, "(%d, %d) - (%d,%d)", bomberman->getFieldCenterX(), bomberman->getFieldCenterY(), bomberman->getOffsetX(), bomberman->getOffsetY()); font->DrawTextA(NULL, (char *)&buf, -1, &rect3, DT_LEFT, D3DCOLOR_XRGB(255,255,255)); - + #endif // WIN32 old_counter = GetTickCount(); } @@ -177,10 +184,12 @@ void Playground::Stop() if (field[i][j] != NULL) delete field[i][j]; if (bomberman != NULL) delete bomberman; + #ifdef WIN32 if (background != NULL) background->Release(); if (foreground != NULL) foreground->Release(); if (d3dspt != NULL) d3dspt->Release(); if (font != NULL) font->Release(); + #endif // WIN32 } void Playground::move_down() @@ -351,23 +360,29 @@ void Playground::move_right() Bomberman::Bomberman(int xloc, int yloc) { + #ifdef WIN32 HRESULT res = D3DXCreateTextureFromFile(d3ddev, L"data/powkick.png", &texture); if (res != D3D_OK) texture = NULL; + #endif // WIN32 x = xloc; y = yloc; } Bomberman::~Bomberman() { + #ifdef WIN32 if (texture != NULL) texture->Release(); + #endif // WIN32 } void Bomberman::Update() { + #ifdef WIN32 D3DXVECTOR3 center(0.0f, 0.0f, 0.0f); // center at the upper-left corner D3DXVECTOR3 position((FLOAT)x, (FLOAT)y, 0.0f); // position at 50, 50 with no depth RECT rect = {0,0,40,36}; d3dspt->Draw(texture, &rect, ¢er, &position, D3DCOLOR_XRGB(255,255,255)); + #endif // WIN32 } void Bomberman::move(int xloc, int yloc) @@ -476,6 +491,7 @@ void Bomberman::move_to_direction(TMoveDirection dir) // Item class // ============================================= +#ifdef WIN32 Item:: Item(LPDIRECT3DTEXTURE9 t, int texnr, int subwidth, int subheight, int colnr, int rownr) { texture = t; @@ -498,3 +514,4 @@ void Item::Draw() d3dspt->Draw(texture, &rect, ¢er, &position, D3DCOLOR_ARGB(255, 255,255,255)); } +#endif // WIN32