Old.Learning.Projects/MasterX_Example_ParticleEngine/mastermain.cpp
Source: Old.Learning.Projects/MasterX_Example_ParticleEngine/mastermain.cpp
/* space wars
written by Jared Bruni
www.LostSideDead.com
*/
#include "thehead.h"
MasterXHWND mxhwnd;
Game game;
long _stdcall event(struct HWND__* hwnd,unsigned int msg,unsigned int wParam,long lParam);
void render(MASTERSCREEN screen);
inline void init();
int r = 100, g = 200, b = 200;
int _stdcall MasterMain(struct HINSTANCE__* hInst, char* line)
{
if(mxhwnd.CreateMasterX("MasterX",640,480,COLOR_DEFAULT,event,hInst,NULL,NULL))
{
init();
return mxhwnd.InitLoop(render);
}
return (0);
}
inline void init()
{
mxhwnd.HideCursor();
mxhwnd.InitTimer(1,1);
game.load();
}
long _stdcall event(struct HWND__* hwnd,unsigned int msg,unsigned int wParam,long lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_ACTIVATEAPP:
mxhwnd.activeapp = wParam;
break;
case WM_KEYDOWN:
{
switch(wParam)
{
case VK_ESCAPE:
mxhwnd.Kill();
break;
}
}
break;
case WM_TIMER:
{
mxhwnd.ChangeTime();// you can use whatever type of clock
// or timer you want to change the time for the sync changes
}
break;
default: return DefWindowProc(hwnd,msg,wParam,lParam);
}
return (0);
}
void render(MASTERSCREEN screen)
{
mxhwnd.SetTimeFlag();// set the time flag
game.update();
}
void getshipcord(int& x, int& y)
{
x = game.getx();
y = game.gety();
}