Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Added SDL_GetCurrentVideoDisplay()
- Loading branch information
Showing
with
29 additions
and
10 deletions.
-
+14
−3
include/SDL_video.h
-
+15
−7
src/video/SDL_video.c
|
@@ -403,14 +403,25 @@ extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); |
|
|
* |
|
|
* \brief Set the index of the currently selected display. |
|
|
* |
|
|
* \return The index of the currently selected display. |
|
|
* |
|
|
* \note You can query the currently selected display by passing an index of -1. |
|
|
* \return 0 on success, or -1 if the index is out of range. |
|
|
* |
|
|
* \sa SDL_GetNumVideoDisplays() |
|
|
* \sa SDL_GetCurrentVideoDisplay() |
|
|
*/ |
|
|
extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index); |
|
|
|
|
|
/** |
|
|
* \fn int SDL_GetCurrentVideoDisplay(void) |
|
|
* |
|
|
* \brief Get the index of the currently selected display. |
|
|
* |
|
|
* \return The index of the currently selected display. |
|
|
* |
|
|
* \sa SDL_GetNumVideoDisplays() |
|
|
* \sa SDL_SelectVideoDisplay() |
|
|
*/ |
|
|
extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void); |
|
|
|
|
|
/** |
|
|
* \fn int SDL_GetNumDisplayModes(void) |
|
|
* |
|
|
|
@@ -355,13 +355,21 @@ SDL_SelectVideoDisplay(int index) |
|
|
SDL_UninitializedVideo(); |
|
|
return (-1); |
|
|
} |
|
|
if (index >= 0) { |
|
|
if (index >= _this->num_displays) { |
|
|
SDL_SetError("index must be in the range 0 - %d", |
|
|
_this->num_displays - 1); |
|
|
return -1; |
|
|
} |
|
|
_this->current_display = index; |
|
|
if (index < 0 || index >= _this->num_displays) { |
|
|
SDL_SetError("index must be in the range 0 - %d", |
|
|
_this->num_displays - 1); |
|
|
return -1; |
|
|
} |
|
|
_this->current_display = index; |
|
|
return 0; |
|
|
} |
|
|
|
|
|
int |
|
|
SDL_GetCurrentVideoDisplay(void) |
|
|
{ |
|
|
if (!_this) { |
|
|
SDL_UninitializedVideo(); |
|
|
return (-1); |
|
|
} |
|
|
return _this->current_display; |
|
|
} |
|
|