Mercurial > sdl-ios-xcode
comparison src/video/SDL_cursor.c @ 595:591b438ab94a
Don't warp the mouse when a video mode hasn't been set
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 07 Feb 2003 05:47:15 +0000 |
parents | 5c74ac147358 |
children | b8d311d90021 |
comparison
equal
deleted
inserted
replaced
594:a71ce390adeb | 595:591b438ab94a |
---|---|
293 void SDL_WarpMouse (Uint16 x, Uint16 y) | 293 void SDL_WarpMouse (Uint16 x, Uint16 y) |
294 { | 294 { |
295 SDL_VideoDevice *video = current_video; | 295 SDL_VideoDevice *video = current_video; |
296 SDL_VideoDevice *this = current_video; | 296 SDL_VideoDevice *this = current_video; |
297 | 297 |
298 if ( !video || !SDL_PublicSurface ) { | |
299 SDL_SetError("A video mode must be set before warping mouse"); | |
300 return; | |
301 } | |
302 | |
298 /* If we have an offset video mode, offset the mouse coordinates */ | 303 /* If we have an offset video mode, offset the mouse coordinates */ |
299 x += (this->screen->offset % this->screen->pitch) / | 304 x += (this->screen->offset % this->screen->pitch) / |
300 this->screen->format->BytesPerPixel; | 305 this->screen->format->BytesPerPixel; |
301 y += (this->screen->offset / this->screen->pitch); | 306 y += (this->screen->offset / this->screen->pitch); |
302 | 307 |