Skip to main content
GameDev.net gamedev.net
🔒 Locked

SDL_ShowCursor slows things down

Started by jostpuur Mar 10, 2009 at 12:50 AM 0 replies 1.9k views
Original Post
jostpuur
jostpuur
I'm using Linux + SDL + GL environment, and my program is running in fullscreen. It runs nicely if the standard mouse cursor is visible, but if I call SDL_ShowCursor(SDL_DISABLE) to disable the cursor, then my program gets unacceptably slow. Anyone knowing about this problem? update: After doing some more testing, it seems, that the values that SDL_GetMouseState(int *x, int *y) sets to the x and y are affected by the state of visibility of the cursor. Sounds strange. Is that supposed to happen? The effect is this: If I turn off the cursor, the movement of the mouse coordinates first seem to slow down. If I then turn the cursor back on, the mouse coordinates jump to the location where the cursor was last turned off. update: The problem does not exist if the screen is non-fullscreen. In non-fullscreen mode the mouse coordinates are unaffected by the hiding of the cursor. But fullscreen messes things up. update: The fact that the visibility of the cursor affects the mouse speed remains, but the "unacceptable slowness" I mentioned in the beginning has now vanished. I don't know what happened [looksaround] I did restart my gnome desktop manager in the between, at least... update: No! Now the unacceptable slowness appeared again! this is getting unpredictable [depressed] [Edited by - jostpuur on March 10, 2009 2:16:19 AM]
jostpuur
jostpuur
If there's any linux folks around, I would appreciate if somebody spends a minute with a small test. My test program is here

cp3d_test.tar.gz

If one opens the packet with "tar -xzf cp3d_test.tar.gz", it creates an executable file "cp3d" and directory "data/" with ~80K content. The test program can be run in a four different ways, with following commands:

way 1: "./cp3d"

way 2: "./cp3d -c"

way 3: "./cp3d -f"

way 4: "./cp3d -f -c"

Each one opens a window which has an "exit"-button. Click the button, then click "yes"-button, and the program quits. It doesn't do anything else. The thing I'm interested is that does the mouse cursor behave nicely in this program, or does it lag behind.

The way 1 opens a non-fullscreen window, in which the standard mouse cursor is disabled, and only the programs own cursor is rendered.

The way 2 opens a non-fullscreen window, in which the standard mouse cursor, and the programs own cursor are both visible, and overlap.

The way 3 opens a fullscreen window, in which the standard mouse cursor is disabled.

The way 4 opens a fullscreen window, in which the standard mouse cursor is visible.

When I test this, the ways 1, 2 and 4 work fine, but the way 3, which is the most important for the game, has strange slowness. The mouse cursor lags behind. I am interested to know that do you observe the same effect, and do you recognize that to be something you have encountered in your own projects too.

I am not very interested to start sharing the source code, because there is too much of it. Despite the fact that this is a small test program, it uses some of my own libraries, which are quite big. Nobody will want to go through that code anyway.

[Edited by - jostpuur on March 22, 2009 1:12:19 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.