#include "CRM32Pro.h"
SDL_Surface*sBg;
#define EXAMPLE_VERSION "Example 12: integrated console"
#define GFX_RESOURCE "data/gfx.dpf" // DPF with graphic resources
int cmdMy(vector<string> *tokens)
{
int iRet = 0;
if(tokens->size() == 1)
{
CRM32Pro.
ConPrint(
" usage: my <parameter> [value]");
CRM32Pro.
ConPrint(
" <version> - Print the application version");
CRM32Pro.
ConPrint(
" <quit> - Close the application");
iRet = 1;
}
else if(!strcmp(tokens->at(1).c_str(),"version"))
{
iRet = 1;
}
else if(!strcmp(tokens->at(1).c_str(),"quit"))
{
CRM32Pro.
ConPrint(
"Exiting...(no logic for handling it :) )");
iRet = 1;
}
return iRet;
}
void RenderGraphics(int);
void PrintHelp();
int main(int argc,char *argv[])
{
Uint8 done = 0;
SDL_Event event;
Uint32 cCursor;
PrintHelp();
if(CRM32Pro.
Init(SDL_INIT_VIDEO | 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.
Icon = IImage->
Load(GFX_RESOURCE,
"icono");
{
return 1;
}
cCursor = ICursor->
Load(GFX_RESOURCE,
"cursor");
sBg = IImage->
Load(GFX_RESOURCE,
"background2");
SDL_BlitSurface(sBg,NULL,CRM32Pro.
screen,NULL);
done = 0;
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_f) { CRM32Pro.
ConGetAlpha(); }
break;
break;
default:
break;
}
}
}
return 0;
}
void RenderGraphics(int bLogicUpdate)
{
}
void PrintHelp()
{
char *sMsg;
sMsg = new char[1024];
strcpy(sMsg,"-----------------------------------------------------------\n");
strcat(sMsg," ");
strcat(sMsg,EXAMPLE_VERSION);
strcat(sMsg,"\n-----------------------------------------------------------\n\n");
strcat(sMsg," Press [ESCAPE] key to exit.\n");
strcat(sMsg," Press [`] to set visible/non-visible the console\n");
strcat(sMsg,"\n Runtime information is logged into 'DRTS.log' file.\n");
strcat(sMsg,"\n");
#ifdef _WINDOWS
MessageBox(NULL,sMsg,"CRM32Pro SDK - HelpScreen",MB_OK);
#endif
#ifdef _LINUX
printf("CRM32Pro SDK - HelpScreen\n%s",sMsg);
#endif
delete[] sMsg;
}