[SDL] SDL_Video - Help with fullscreen, suppressed mouse and mouse click coords

Damian Sobieralski dsobiera at asu.edu
Tue Sep 5 16:23:24 PDT 2006

I submitted a bug request a couple of weeks ago regarding SDL_Video,
fullscreen mode, mouse suppression and not registering mouse clicks in
the upper 1/4 of the screen on a Windows XP machine.  So far, I haven't
received any useful replies to assist me in my current dilemma.

 Normally I'm very patient with open source project however I am under a
time constraint to get this to work. If I cannot get this, what seems to
be trivially simple, problem resolved I am going to have to dump SDL and
go with direct win32 api for this app. Help me keep SDL in our office!
If there's a better list to post this to for assistance, then point me
to it and I'm there!

 Could anyone PLEASE PLEASEe PLEASE compile and try this code and see if
you can get the upper left of your screen clicks to register other than
0,0? Or, if you see some stupid (or not so stupid error) in my code -
please point this out to me. If it fixes this problem I'll gladly wear a
dunce hat!   I have about a week to get this trivial problem resolved or
I'll have to scrap SDL and I'd really like to stay with it. It's not
like I'm trying to do something complicated. I am just recording mouse
click coords. Please assist if you can (even if it is - tried it and it
works in the upper left corner). Lower case 'q' ends the program. This
is driving me crazy as this seems like the equivalent on not getting a
"Hello world" program to work.  


- Desperate in Arizona

#include <iostream.h>
#include <stdio.h>
#include <SDL.h>

int main(int argc, char *argv[])
	SDL_Surface *screen = NULL;
	SDL_Event event;
	int quit = 0;
	char buffer[100];

    cout << "Initializing SDL.\n";

    /* Initialize defaults */
    if((SDL_Init(SDL_INIT_VIDEO) < 0)) 
        cout << "Could not initialize SDL:" << SDL_GetError();
        return 1;

    cout << "SDL initialized.\n";

    /* Clean up on exit */

     * Initialize the display to the desktop resolution (0,0 for
     * first two parms to SDL_SetVideoMode), requesting a software
    screen = SDL_SetVideoMode(0, 0, 0,
    if (screen == NULL) 
      cout << "Couldn't set video mode: " << SDL_GetError();
      return 1;

    sprintf(buffer, "Screen set to resolution %d, %d\n", screen->w,
    cout << buffer;

    while (quit == 0)

// hide the mouse pointer

//Event Processing
    	  while( SDL_PollEvent(&event))
    		      case SDL_KEYDOWN:
    			    cout << SDL_GetKeyName(event.key.keysym.sym)
<< " key down is pressed\n";
    		      case SDL_KEYUP:
    			    cout << SDL_GetKeyName(event.key.keysym.sym)
<< " key up is pressed\n";
                    if (strcmp(SDL_GetKeyName(event.key.keysym.sym),
"q") == 0)
                      quit = 1;
    			  case SDL_QUIT:
    			    quit = 1;
    			    if( event.button.button == SDL_BUTTON_LEFT)
    			      cout << "mouse click at " <<
event.button.x << ", " << event.button.y << "\n";
    		       } // switch 
        } // while EVENT Processing loop
      } // while quit = 0
    return 0;		

More information about the SDL mailing list