#include "CRM32Pro.h"
void PrintHelp();
SDL_Surface*sBg;
#define EXAMPLE_VERSION "Example 1: basic code"
#define GFX_RESOURCE "data/gfx.dpf" // DPF with graphic resources
#define AUDIO_RESOURCE "data/audio.dpf" // DPF with sound resources
int main(int argc,char *argv[])
{
Uint8 done = 0;
SDL_Event event;
Uint32 cCursor;
int hndClick;
PrintHelp();
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.
Icon = IImage->
Load(GFX_RESOURCE,
"icono");
{
return 1;
}
cCursor = ICursor->
Load(GFX_RESOURCE,
"cursor");
if(!ISoundFX->
Init(44100, AUDIO_S16, 2, 4096))
{
ILogSystem.
Msg(
LOG_NORMAL,
" · [LOG Warning] - Couldnīt init sound system: %s\n",SDL_GetError());
}
hndClick = ISoundFX->
SoundLoad(AUDIO_RESOURCE,
"click");
sBg = IImage->
Load(GFX_RESOURCE,
"background");
SDL_BlitSurface(sBg,NULL,CRM32Pro.
screen,NULL);
done = 0;
while(!done)
{
while(CRM32Pro.
Update(&event))
{
switch(event.type)
{
case SDL_MOUSEBUTTONDOWN:
break;
case SDL_QUIT:
done = 1;
break;
case SDL_KEYDOWN:
if(event.key.keysym.sym == SDLK_ESCAPE) done = 1;
break;
{
}
break;
default:
break;
}
}
}
return 0;
}
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,"\n Runtime information is logged into 'BasicCode.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;
}