projects
/
matthijs
/
ABM2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Add Tile0 sprite.
[matthijs/ABM2.git]
/
ABM2
/
main.cpp
diff --git
a/ABM2/main.cpp
b/ABM2/main.cpp
index 1b136b120a345f89c062e9ea5326cc7e698a6128..210382e119bf86f02aeceb9219f0a31240361bbb 100755
(executable)
--- a/
ABM2/main.cpp
+++ b/
ABM2/main.cpp
@@
-1,23
+1,32
@@
// include the basic windows header files and the Direct3D header file
\r
// include the basic windows header files and the Direct3D header file
\r
+#ifdef WIN32
\r
#include <windows.h>
\r
#include <windowsx.h>
\r
#include <windows.h>
\r
#include <windowsx.h>
\r
+#endif
\r
\r
#include "Engine/engine.h"
\r
#include "Engine/game.h"
\r
\r
#include "Engine/engine.h"
\r
#include "Engine/game.h"
\r
+#include "Engine/SpriteManager.h"
\r
#include "Playground.h"
\r
#include "Playground.h"
\r
-#include "Scheme
r
eader.h"
\r
+#include "Scheme
R
eader.h"
\r
\r
// define the screen resolution and keyboard macros
\r
#define SCREEN_WIDTH 640
\r
#define SCREEN_HEIGHT 480
\r
\r
\r
// define the screen resolution and keyboard macros
\r
#define SCREEN_WIDTH 640
\r
#define SCREEN_HEIGHT 480
\r
\r
+SpriteData defaultSprites[] = {
\r
+ {SPR_FIELD, "Data/FIELD0.png", 640, 480},
\r
+ {SPR_TILE, "Data/Tiles0.png", 40, 36},
\r
+ {SPR_NONE, NULL, 0, 0}
\r
+};
\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
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
class CPongTask : public ITask
\r
{
\r
public:
\r
@@
-118,6
+127,7
@@
public:
AUTO_SIZE;
\r
};
\r
\r
AUTO_SIZE;
\r
};
\r
\r
+#endif // WIN32
\r
void CApplication::Run(int argc, char *argv[])
\r
{
\r
//open logfiles
\r
void CApplication::Run(int argc, char *argv[])
\r
{
\r
//open logfiles
\r
@@
-152,10
+162,14
@@
void CApplication::Run(int argc, char *argv[])
globalTimer->priority=10;
\r
CKernel::GetSingleton().AddTask(CMMPointer<ITask>(globalTimer));
\r
\r
globalTimer->priority=10;
\r
CKernel::GetSingleton().AddTask(CMMPointer<ITask>(globalTimer));
\r
\r
- Playground game;
\r
+ CSpriteManager *sm = new CSpriteManager(videoTask->getGraphics(), defaultSprites);
\r
+ CKernel::GetSingleton().setSpriteManager(sm);
\r
+
\r
+ Playground game(&CKernel::GetSingleton());
\r
game.priority=100;
\r
CKernel::GetSingleton().AddTask(CMMPointer<ITask>(&game));
\r
\r
game.priority=100;
\r
CKernel::GetSingleton().AddTask(CMMPointer<ITask>(&game));
\r
\r
+
\r
//set up the profiler with an output handler
\r
CProfileLogHandler profileLogHandler;
\r
CProfileSample::outputHandler=&profileLogHandler;
\r
//set up the profiler with an output handler
\r
CProfileLogHandler profileLogHandler;
\r
CProfileSample::outputHandler=&profileLogHandler;
\r
@@
-168,6
+182,7
@@
void CApplication::Run(int argc, char *argv[])
delete CSettingsManager::GetSingletonPtr();
\r
}
\r
\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
\r
// the entry point for any Windows program
\r
int WINAPI WinMain(HINSTANCE hInst,
\r
@@
-215,7
+230,6
@@
int WINAPI WinMain(HINSTANCE hInst,
return 0;
\r
}
\r
\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
// 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
+244,17
@@
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
\r
return DefWindowProc (hWnd, message, wParam, 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