* ifdef away half of Playground.cpp to make it compile (still one non-porting relate...
authorMatthijs Kooijman <m.kooijman@student.utwente.nl>
Mon, 11 Jun 2007 07:50:38 +0000 (09:50 +0200)
committerMatthijs Kooijman <m.kooijman@student.utwente.nl>
Mon, 11 Jun 2007 07:50:38 +0000 (09:50 +0200)
ABM2/Makefile
ABM2/Playground.cpp
ABM2/Playground.h
ABM2/porting.h

index b2177be38985fa48bca258c23a316efec60976c9..d420363c5765a59b3842b0bd7cec7e247c8f84e2 100644 (file)
@@ -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)
 
index a7edd74752e1ab3e1cc067bf63c36489bc87f890..edf532567810cc65b9604ebbf8327df29019df07 100755 (executable)
@@ -3,11 +3,14 @@
 #include "Engine/VideoUpdate.h"\r
 #include "SchemeReader.h"\r
 \r
+#if WIN32\r
 LPD3DXSPRITE d3dspt;\r
 LPD3DXFONT font;\r
 \r
+#endif\r
 bool Playground::Start()\r
 {\r
+       #if WIN32\r
        background = NULL;\r
        foreground = NULL;\r
        font = NULL;\r
@@ -61,6 +64,7 @@ bool Playground::Start()
                }\r
        }\r
 \r
+       #endif\r
        // init playing field\r
        SchemeReader *scheme = new SchemeReader("data/schemes/BASIC.SCH");\r
        for (int i=0; i<PLAYGROUND_COLS; ++i) \r
@@ -79,7 +83,9 @@ bool Playground::Start()
                                        //field[i][j] = new Item(foreground, 0, FIELD_UNIT_WIDTH, FIELD_UNIT_HEIGHT, i, j);\r
                                        break;\r
                                case SOLID:\r
+                                       #ifdef WIN32\r
                                        field[i][j] = new Item(foreground, 1, FIELD_UNIT_WIDTH, FIELD_UNIT_HEIGHT, i, j);\r
+                                       #endif // WIN32\r
                                        break;\r
                        }\r
 /*\r
@@ -116,6 +122,7 @@ bool Playground::Start()
 \r
 void Playground::Update()\r
 {\r
+       #ifdef WIN32\r
        if(CInputTask::keyDown(DIK_ESCAPE))CKernel::GetSingleton().KillAllTasks();\r
 \r
        d3dspt->Begin(NULL);    // begin sprite drawing\r
@@ -165,7 +172,7 @@ void Playground::Update()
        RECT rect3 = {310,10,500,36};\r
        sprintf(buf, "(%d, %d) - (%d,%d)", bomberman->getFieldCenterX(), bomberman->getFieldCenterY(), bomberman->getOffsetX(), bomberman->getOffsetY());\r
        font->DrawTextA(NULL, (char *)&buf, -1, &rect3, DT_LEFT, D3DCOLOR_XRGB(255,255,255));\r
-\r
+       #endif // WIN32\r
 \r
        old_counter = GetTickCount();\r
 }\r
@@ -177,10 +184,12 @@ void Playground::Stop()
                        if (field[i][j] != NULL) delete field[i][j];\r
 \r
        if (bomberman != NULL) delete bomberman;\r
+       #ifdef WIN32\r
        if (background != NULL) background->Release();\r
        if (foreground != NULL) foreground->Release();\r
        if (d3dspt != NULL) d3dspt->Release();\r
        if (font != NULL) font->Release();\r
+       #endif // WIN32\r
 }\r
 \r
 void Playground::move_down()\r
@@ -351,23 +360,29 @@ void Playground::move_right()
 \r
 Bomberman::Bomberman(int xloc, int yloc)\r
 {\r
+       #ifdef WIN32\r
        HRESULT res = D3DXCreateTextureFromFile(d3ddev, L"data/powkick.png", &texture);\r
        if (res != D3D_OK) texture = NULL;\r
+       #endif // WIN32\r
        x = xloc;\r
        y = yloc;\r
 }\r
 \r
 Bomberman::~Bomberman()\r
 {\r
+       #ifdef WIN32\r
        if (texture != NULL) texture->Release();\r
+       #endif // WIN32\r
 }\r
 \r
 void Bomberman::Update()\r
 {\r
+       #ifdef WIN32\r
        D3DXVECTOR3 center(0.0f, 0.0f, 0.0f);    // center at the upper-left corner\r
        D3DXVECTOR3 position((FLOAT)x, (FLOAT)y, 0.0f);    // position at 50, 50 with no depth\r
        RECT rect = {0,0,40,36};\r
        d3dspt->Draw(texture, &rect, &center, &position, D3DCOLOR_XRGB(255,255,255));\r
+       #endif // WIN32\r
 }\r
 \r
 void Bomberman::move(int xloc, int yloc)\r
@@ -476,6 +491,7 @@ void Bomberman::move_to_direction(TMoveDirection dir)
 // Item class\r
 // =============================================\r
 \r
+#ifdef WIN32\r
 Item:: Item(LPDIRECT3DTEXTURE9 t, int texnr, int subwidth, int subheight, int colnr, int rownr)\r
 {\r
        texture = t;\r
@@ -498,3 +514,4 @@ void Item::Draw()
        d3dspt->Draw(texture, &rect, &center, &position, D3DCOLOR_ARGB(255, 255,255,255));\r
 }\r
 \r
+#endif // WIN32\r
index bed17cccd2a23abd3f565e2b816a82d5a174ce56..ae495379ce398ca31e0585fb1fad507bb7d7c44f 100755 (executable)
@@ -33,8 +33,8 @@ public:
        int getFieldCenterX();\r
        int getFieldCenterY();\r
 private:\r
-#ifdef WIN32\r
        int x,y;\r
+#ifdef WIN32\r
        LPDIRECT3DTEXTURE9 texture;\r
 #endif // WIN32\r
 };\r
@@ -65,6 +65,7 @@ private:
 #ifdef WIN32\r
        LPDIRECT3DTEXTURE9 background;\r
        LPDIRECT3DTEXTURE9 foreground;\r
+#endif // WIN32\r
 \r
        Bomberman *bomberman;\r
        Item *field[PLAYGROUND_COLS][PLAYGROUND_ROWS];\r
@@ -75,5 +76,4 @@ private:
        void move_left();\r
 \r
        DWORD old_counter;\r
-#endif // WIN32\r
 };\r
index d6a59c8f480a9ea18da9d46135d665ed6c29e7fc..02d7c33238569604ba45baaa28a82c8242cee9a5 100644 (file)
@@ -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