* Do singleton pointer magic with long instead of int to make it work on linux64, should still work on windows as well.
#endif // _MSC_VER > 1000\r
\r
#include "engine.h"\r
+#ifdef WIN32\r
#define DIRECTINPUT_VERSION 0x0800\r
#include <dinput.h>\r
+#endif // WIN32\r
+\r
+\r
+#ifndef WIN32\r
+/* HACK to make this compile */\r
+#define BYTE unsigned char\r
+#endif // !WIN32\r
\r
class CInputTask : public ITask \r
{\r
//static bool inline mouseStillUp(int button) { return (!curMouse(button))&&(!oldMouse(button)); }\r
\r
AUTO_SIZE;\r
+#ifdef WIN32\r
private:\r
LPDIRECTINPUT8 din; // the pointer to our DirectInput interface\r
LPDIRECTINPUTDEVICE8 dinkeyboard; // the pointer to the keyboard device\r
+#endif\r
};\r
\r
#endif // !defined(AFX_KEYBOARDTASK_H__4953EF06_7C18_4433_B590_47E045E43576__INCLUDED_)\r
\r
int Execute();\r
\r
+#ifdef WIN32\r
bool AddTask(CMMPointer<ITask> &t);\r
+#else\r
+ bool AddTask(CMMPointer<ITask> t);\r
+#endif\r
void SuspendTask(CMMPointer<ITask> &t);\r
void ResumeTask(CMMPointer<ITask> &t);\r
void RemoveTask(CMMPointer<ITask> &t);\r
#include "VideoUpdate.h"\r
\r
// include the Direct3D Library file\r
+#ifdef WIN32\r
#pragma comment (lib, "d3d9.lib")\r
#pragma comment (lib, "d3dx9.lib")\r
\r
{\r
// SDL_QuitSubSystem(SDL_INIT_VIDEO);\r
}\r
+#endif // WIN32\r
#pragma once\r
#endif // _MSC_VER > 1000\r
\r
+#ifdef WIN32\r
#include <d3d9.h>\r
#include <d3dx9.h>\r
\r
#include "engine.h"\r
extern LPDIRECT3DDEVICE9 d3ddev; // the pointer to the device class\r
-\r
+#endif // WIN32\r
class CVideoUpdate : public ITask \r
{\r
public:\r
bool Start();\r
void Update();\r
void Stop();\r
-\r
+#ifdef WIN32\r
private:\r
LPDIRECT3D9 d3d; // the pointer to our Direct3D interface\r
+#endif //WIN32\r
\r
};\r
-\r
#endif // !defined(AFX_VIDEOUPDATE_H__FB4B263B_4FA7_4700_BB70_EE5CB1768E83__INCLUDED_)\r
\r
#pragma warning ( disable : 4786 )\r
\r
-\r
#include <iostream>\r
#include <ostream>\r
#include <istream>\r
#ifndef MISC_H_INCLUDED\r
#define MISC_H_INCLUDED\r
\r
-\r
-\r
+#ifndef WIN32\r
+/* HACK to get this to compile */\r
+#define max(a,b) (a>b?a:b)\r
+#define min(a,b) (a<b?a:b)\r
+#endif // !WIN32\r
inline float clamp(float val, float minVal, float maxVal)\r
{\r
return min(max(val,minVal),maxVal);\r
assert(!ms_singleton);\r
//use a cunning trick to get the singleton pointing to the start of the whole, rather than\r
//the start of the Singleton part of the object\r
- int offset = (int)(T*)1 - (int)(Singleton <T>*)(T*)1;\r
- ms_singleton = (T*)((int)this + offset);\r
+ // This used to say "int" instead of long, but that breaks\r
+ // on 64 bit linux at least\r
+ long offset = (long)(T*)1 - (long)(Singleton <T>*)(T*)1;\r
+ ms_singleton = (T*)((long)this + offset);\r
}\r
~Singleton()\r
{\r
int getFieldCenterX();\r
int getFieldCenterY();\r
private:\r
+#ifdef WIN32\r
int x,y;\r
LPDIRECT3DTEXTURE9 texture;\r
+#endif // WIN32\r
};\r
\r
class Item\r
{\r
public:\r
+#ifdef WIN32\r
Item(LPDIRECT3DTEXTURE9 t, int texnr, int subwidth, int subheight, int colnr, int rownr);\r
+#endif // WIN32\r
~Item();\r
void Draw();\r
int col, row, tex_num, subitem_height, subitem_width;\r
private:\r
+#ifdef WIN32\r
LPDIRECT3DTEXTURE9 texture;\r
+#endif // WIN32\r
};\r
\r
class Playground : public ITask\r
void Stop();\r
AUTO_SIZE;\r
private:\r
+#ifdef WIN32\r
LPDIRECT3DTEXTURE9 background;\r
LPDIRECT3DTEXTURE9 foreground;\r
\r
void move_left();\r
\r
DWORD old_counter;\r
+#endif // WIN32\r
};\r
// 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
AUTO_SIZE;\r
};\r
\r
+#endif // WIN32\r
void CApplication::Run(int argc, char *argv[])\r
{\r
//open logfiles\r
delete CSettingsManager::GetSingletonPtr();\r
}\r
\r
+#ifdef WIN32\r
\r
// the entry point for any Windows program\r
int WINAPI WinMain(HINSTANCE hInst,\r
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
\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