19 memset(&m_mode, 0,
sizeof(m_mode));
24 numDisplays = SDL_GetNumVideoDisplays();
31 GHOST_ASSERT(display < 1,
"Only single display systems are currently supported.\n");
33 numSettings = SDL_GetNumDisplayModes(display - 1);
42 setting.
bpp = SDL_BYTESPERPIXEL(mode->format) * 8;
44 setting.
frequency = mode->refresh_rate ? mode->refresh_rate : 60;
59 GHOST_ASSERT(display < 1,
"Only single display systems are currently supported.\n");
62 SDL_GetDisplayMode(display, index, &mode);
73 SDL_GetCurrentDisplayMode(display, &mode);
97 const int num_modes = SDL_GetNumDisplayModes(display);
98 int best_fit, best_dist, dist,
x,
y;
103 if (num_modes == 0) {
108 for (
int i = 0; i < num_modes; i++) {
110 SDL_GetDisplayMode(display, i, &mode);
112 if ((
int)setting.
xPixels > mode.w || (
int)setting.
yPixels > mode.h) {
118 dist = (
x *
x) + (
y *
y);
119 if (dist < best_dist) {
125 if (best_fit == -1) {
128 SDL_GetDisplayMode(display, best_fit, &mode);
139 SDL_SetWindowDisplayMode(sdl_win, &mode);
140 SDL_ShowWindow(sdl_win);
141 SDL_SetWindowFullscreen(sdl_win, SDL_TRUE);
147 printf(
"no windows available, can't fullscreen\n");
#define GHOST_ASSERT(x, info)
static void ghost_mode_to_sdl(const GHOST_DisplaySetting &setting, SDL_DisplayMode *mode)
static void ghost_mode_from_sdl(GHOST_DisplaySetting &setting, SDL_DisplayMode *mode)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
GHOST_TSuccess getDisplaySetting(uint8_t display, int32_t index, GHOST_DisplaySetting &setting) const
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TSuccess getCurrentDisplayModeSDL(SDL_DisplayMode &mode) const
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
GHOST_WindowManager * getWindowManager() const
GHOST_IWindow * getActiveWindow(void) const
SDL_Window * getSDLWindow()