X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ABM2%2Fmain.cpp;h=210382e119bf86f02aeceb9219f0a31240361bbb;hb=4ffda2ad2aa90d275826e31f40233014faaa01d8;hp=1b136b120a345f89c062e9ea5326cc7e698a6128;hpb=0835c5605c80efd286ccb7eff92fffc07689f359;p=matthijs%2FABM2.git diff --git a/ABM2/main.cpp b/ABM2/main.cpp index 1b136b1..210382e 100755 --- a/ABM2/main.cpp +++ b/ABM2/main.cpp @@ -1,23 +1,32 @@ // include the basic windows header files and the Direct3D header file +#ifdef WIN32 #include #include +#endif #include "Engine/engine.h" #include "Engine/game.h" +#include "Engine/SpriteManager.h" #include "Playground.h" -#include "Schemereader.h" +#include "SchemeReader.h" // define the screen resolution and keyboard macros #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 +SpriteData defaultSprites[] = { + {SPR_FIELD, "Data/FIELD0.png", 640, 480}, + {SPR_TILE, "Data/Tiles0.png", 40, 36}, + {SPR_NONE, NULL, 0, 0} +}; + +#ifdef WIN32 HINSTANCE hInstance; HWND hWnd; // the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - class CPongTask : public ITask { public: @@ -118,6 +127,7 @@ public: AUTO_SIZE; }; +#endif // WIN32 void CApplication::Run(int argc, char *argv[]) { //open logfiles @@ -152,10 +162,14 @@ void CApplication::Run(int argc, char *argv[]) globalTimer->priority=10; CKernel::GetSingleton().AddTask(CMMPointer(globalTimer)); - Playground game; + CSpriteManager *sm = new CSpriteManager(videoTask->getGraphics(), defaultSprites); + CKernel::GetSingleton().setSpriteManager(sm); + + Playground game(&CKernel::GetSingleton()); game.priority=100; CKernel::GetSingleton().AddTask(CMMPointer(&game)); + //set up the profiler with an output handler CProfileLogHandler profileLogHandler; CProfileSample::outputHandler=&profileLogHandler; @@ -168,6 +182,7 @@ void CApplication::Run(int argc, char *argv[]) delete CSettingsManager::GetSingletonPtr(); } +#ifdef WIN32 // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInst, @@ -215,7 +230,6 @@ int WINAPI WinMain(HINSTANCE hInst, return 0; } - // this is the main message handler for the program LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -230,3 +244,17 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara return DefWindowProc (hWnd, message, wParam, lParam); } +#else // WIN32 +int main(int argc, char *argv[]) +{ + new CApplication(); + CApplication::GetSingleton().Run(argc,argv); + delete CApplication::GetSingletonPtr(); + + //clean up any remaining unreleased objects + IMMObject::CollectRemainingObjects(true); + + return 0; +} +#endif //WIN32 +