I'm fairly new to SDL but have been reading the Help file with it and gonig through tutorials at the same time. And starting to experiment.
while(isRunning == true)
{
SDL_PollEvent(&event);
if (event.type == SDL_KEYDOWN)
{
printf("Oh! Key Press.\n");
if(event.key.keysym.sym == SDLK_ESCAPE)
{
printf("Quiting SDL.\n");
isRunning = false;
}
if(event.key.keysym.sym == SDLK_m)
{
printf("Toggling Mouse.\n");
int isMouse = SDL_ShowCursor(SDL_QUERY);
printf("%d",isMouse);
if (isMouse == SDL_ENABLE)
{
printf("Disable Mouse.\n");
SDL_ShowCursor(SDL_DISABLE);
} else {
printf("Enable Mouse.\n");
SDL_ShowCursor(SDL_ENABLE);
}
}
}
When I press the escape key the program exits. As should. And my log file looks like:
Initializing SDL.
SDL initialized.
Oh! Key Press.
Quiting SDL.
Quiting....
When I press m and then escape my log file looks like:
Initializing SDL.
SDL initialized.
Oh! Key Press.
Toggling Mouse.
isMouse = 1.
...
...
...
Oh! Key Press.
Toggling Mouse.
isMouse = 1.
Quiting SDL.
Quiting....
Only it's actually a 4mb file! Plus the cursor doesn't toggle. I can't see what I'm doing wrong, it looks perfectly logical to me the code.
[Edited by - Narusegawa on October 28, 2004 8:56:43 AM]