#include "CRM32Pro.h"
#include "../source/MSTE.h"
#include "../source/MSTE_MapData.h"
#define EXAMPLE_VERSION "MSTE - Example05: Tiled Qt"
void RenderGraphics(int);
int main(int argc,char *argv[])
{
Uint8 done = 0;
SDL_Event event;
ILogSystem.Init("Example05_Tiled.log",LOG_FILE,LOG_NORMAL,EXAMPLE_VERSION);
if(CRM32Pro.Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) < 0)
{
ILogSystem.Msg(LOG_NORMAL," [LOG] - Couldn't initialize CRM32Pro: %s\n",SDL_GetError());
return 1;
}
CRM32Pro.Config.Title = EXAMPLE_VERSION;
CRM32Pro.Config.VideoWidth = 640;
CRM32Pro.Config.VideoHeight = 400;
CRM32Pro.Config.bMTFriendly = 1;
if(!CRM32Pro.SetVideoMode())
{
CRM32Pro.Quit();
return 1;
}
ITimeSystem->Init();
ITimeSystem->SetRate(60,20);
CRM32Pro.SetRenderCallback(RenderGraphics);
{
}
int iPause = -1;
int iSmooth = -1;
int iAutoMoveFlag = -1;
while(!done)
{
while(CRM32Pro.Update(&event))
{
switch(event.type)
{
case SDL_QUIT:
done = 1;
break;
case SDL_KEYDOWN:
if(event.key.keysym.sym == SDLK_ESCAPE) done = 1;
if(event.key.keysym.sym == SDLK_c)
{
int iCX,iCY;
iCX = iCY = -1;
ILogSystem.Msg(LOG_NORMAL," [Screen2LayerCell(0) => (%d,%d)\n",iCX,iCY);
ILogSystem.Msg(LOG_NORMAL," [Screen2LayerAbsolute(0) => (%d,%d)\n",iCX,iCY);
}
if(event.key.keysym.sym == SDLK_p)
{
iPause = iPause * (-1);
}
if(event.key.keysym.sym == SDLK_s)
{
iSmooth = iSmooth * (-1);
}
break;
default:
break;
}
}
if(CRM32Pro.GetKeystate(SDLK_UP)) TE->
MoveLayer(0,0,-16);
if(CRM32Pro.GetKeystate(SDLK_DOWN)) TE->
MoveLayer(0,0,16);
if(CRM32Pro.GetKeystate(SDLK_LEFT)) TE->
MoveLayer(0,-16,0);
if(CRM32Pro.GetKeystate(SDLK_RIGHT)) TE->
MoveLayer(0,16,0);
}
delete TE;
ITimeSystem->Info();
CRM32Pro.VideoInfo();
return 0;
}
void RenderGraphics(int bLogicUpdate)
{
}