* Add #ifdef WIN32 to make main.cpp compile on linux.
[matthijs/ABM2.git] / ABM2 / main.cpp
index 061cce287b80b62b7731f51d5ac2c27f1b077c21..7348a15fa1545965c41d68edc2beb71bdea65c6d 100755 (executable)
@@ -1,6 +1,15 @@
 // include the basic windows header files and the Direct3D header file\r
+#ifdef WIN32\r
 #include <windows.h>\r
 #include <windowsx.h>\r
+#endif\r
+\r
+//#ifndef WIN32\r
+       /* HACKS */\r
+#define max(a,b) (a>b?a:b)\r
+#define min(a,b) (a<b?a:b)\r
+#define GetTickCount() 0\r
+//#endif // !WIN32\r
 \r
 #include "Engine/engine.h"\r
 #include "Engine/game.h"\r
 #define SCREEN_WIDTH  640\r
 #define SCREEN_HEIGHT 480\r
 \r
+#ifdef WIN32\r
 HINSTANCE hInstance;\r
 HWND hWnd;\r
 \r
 // the WindowProc function prototype\r
 LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
 \r
-\r
 class CPongTask : public ITask\r
 {\r
 public:\r
@@ -118,6 +127,7 @@ public:
        AUTO_SIZE;\r
 };\r
 \r
+#endif // WIN32\r
 void CApplication::Run(int argc, char *argv[])\r
 {\r
        //open logfiles\r
@@ -168,6 +178,7 @@ void CApplication::Run(int argc, char *argv[])
        delete CSettingsManager::GetSingletonPtr();\r
 }\r
 \r
+#ifdef WIN32\r
 \r
 // the entry point for any Windows program\r
 int WINAPI WinMain(HINSTANCE hInst,\r
@@ -215,7 +226,6 @@ int WINAPI WinMain(HINSTANCE hInst,
   return 0;\r
 }\r
 \r
-\r
 // this is the main message handler for the program\r
 LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
 {\r
@@ -230,3 +240,17 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
 \r
     return DefWindowProc (hWnd, message, wParam, lParam);\r
 }\r
+#else // WIN32\r
+int main(int argc, char *argv[])\r
+{\r
+  new CApplication();\r
+  CApplication::GetSingleton().Run(argc,argv);\r
+  delete CApplication::GetSingletonPtr();\r
+\r
+  //clean up any remaining unreleased objects\r
+  IMMObject::CollectRemainingObjects(true);\r
+\r
+  return 0;\r
+}\r
+#endif //WIN32\r
+\r