From: Matthijs Kooijman Date: Mon, 11 Jun 2007 07:50:38 +0000 (+0200) Subject: * ifdef away half of Playground.cpp to make it compile (still one non-porting relate... X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2FABM2.git;a=commitdiff_plain;h=ef328ea4a5e0e2f76f474d3b452e8b35b7fb2995 * ifdef away half of Playground.cpp to make it compile (still one non-porting related error left). --- diff --git a/ABM2/Makefile b/ABM2/Makefile index b2177be..d420363 100644 --- a/ABM2/Makefile +++ b/ABM2/Makefile @@ -1,5 +1,5 @@ CFLAGS:=-I. -OBJS:=main.o Engine/Log.o SchemeReader.o Engine/Settings.o Engine/mmanager.o Engine/Kernel.o Engine/ProfileLogHandler.o Engine/VideoUpdate.o Engine/GlobalTimer.o Engine/SoundTask.o Engine/profiler.o +OBJS:=main.o Engine/Log.o SchemeReader.o Engine/Settings.o Engine/mmanager.o Engine/Kernel.o Engine/ProfileLogHandler.o Engine/VideoUpdate.o Engine/GlobalTimer.o Engine/SoundTask.o Engine/profiler.o Playground.o all: $(OBJS) 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 diff --git a/ABM2/Playground.h b/ABM2/Playground.h index bed17cc..ae49537 100755 --- a/ABM2/Playground.h +++ b/ABM2/Playground.h @@ -33,8 +33,8 @@ public: int getFieldCenterX(); int getFieldCenterY(); private: -#ifdef WIN32 int x,y; +#ifdef WIN32 LPDIRECT3DTEXTURE9 texture; #endif // WIN32 }; @@ -65,6 +65,7 @@ private: #ifdef WIN32 LPDIRECT3DTEXTURE9 background; LPDIRECT3DTEXTURE9 foreground; +#endif // WIN32 Bomberman *bomberman; Item *field[PLAYGROUND_COLS][PLAYGROUND_ROWS]; @@ -75,5 +76,4 @@ private: void move_left(); DWORD old_counter; -#endif // WIN32 }; diff --git a/ABM2/porting.h b/ABM2/porting.h index d6a59c8..02d7c33 100644 --- a/ABM2/porting.h +++ b/ABM2/porting.h @@ -3,4 +3,7 @@ #define sprintf_s snprintf #define strcpy_s(dst, size, src) strncpy(dst, src, size) #define ZeroMemory(buf, size) memset(buf, 0, size) + + #define BYTE unsigned char + #define DWORD unsigned int #endif // !WIN32