Пример #1
0
int SDL_ToggleFS(SDL_Window *win, Level* level)
{   
	static int orig_w, orig_h;

	Uint32 flags = (SDL_GetWindowFlags(win) ^ SDL_WINDOW_FULLSCREEN_DESKTOP);
    bool fullscreen = (SDL_GetWindowFlags(win) & SDL_WINDOW_FULLSCREEN_DESKTOP); 

	if (!fullscreen){
        SDL_GetWindowSize(win, &orig_w, &orig_h);
	}

	// NOTE: SDL_SetWindowFullscreen takes FLAGS as the second param, NOT true/false!
	if (SDL_SetWindowFullscreen(win, flags) < 0){
		return -1; 
	}

	int w, h;

	if(!fullscreen){
		SDL_GetWindowSize(win, &w, &h);
	} else {
		w = orig_w;
		h = orig_h;
	}
	glViewport(0,0,w,h);

    level->update_proj_mat( (float)w/h );

	cout << "window W: " << w << " H: " << h << endl; 

	return 0;
}
Пример #2
0
    bool window::is_open() const
    {
        // On macOS we'll need to check for the minimized flag - the window will
        // be marked as hidden when it's minimized, even if it is still open.

        // We can't do this on Windows since hiding fullscreen windows will
        // minimize them.

#if defined(__APPLE__)
        if (SDL_GetWindowFlags(handle.get()) & SDL_WINDOW_MINIMIZED)
        {
            return true;
        }
#endif

        if (SDL_GetWindowFlags(handle.get()) & SDL_WINDOW_HIDDEN)
        {
            return false;
        }

        if (SDL_GetWindowFlags(handle.get()) & SDL_WINDOW_SHOWN)
        {
            return true;
        }

        return false;
    }
Пример #3
0
// Toggle fullscreen
void _Graphics::ToggleFullScreen(const glm::ivec2 &WindowSize, const glm::ivec2 &FullscreenSize) {

	if(SDL_GetWindowFlags(Window) & SDL_WINDOW_FULLSCREEN) {
		Graphics.ChangeWindowSize(WindowSize);
	}
	else {
		Graphics.ChangeWindowSize(FullscreenSize);
	}

	if(SDL_SetWindowFullscreen(Window, SDL_GetWindowFlags(Window) ^ SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
		// failed
	}
}
Пример #4
0
void PlasmacoreView::redraw ()
{
  configure();
  if (!window) return;
  if (!gl_context) return;
  auto flags = SDL_GetWindowFlags(window);
  if (flags & SDL_WINDOW_MINIMIZED) return;
  if (!(flags & SDL_WINDOW_SHOWN)) return;

  if (SDL_GL_MakeCurrent(window, gl_context))
  {
    fprintf( stderr, "SDL_GL_MakeCurrent() failed: %s\n", SDL_GetError() );
    return;
  }

  int display_width, display_height;
  SDL_GetWindowSize(window, &display_width, &display_height);
  auto m = PlasmacoreMessage( "Display.on_render" );
  m.set( "window_id", pwindowID ).set( "display_name", name );
  m.set( "display_width",  display_width );
  m.set( "display_height", display_height );
  m.set( "viewport_width",  display_width );
  m.set( "viewport_height", display_height );
  m.send();
  SDL_GL_SwapWindow(window);
}
Пример #5
0
bool Graphics::WindowVisible()
{
	Uint32 flags = SDL_GetWindowFlags(window);

	return (flags & SDL_WINDOW_SHOWN) && !(flags & SDL_WINDOW_MINIMIZED) // SDL_APPACTIVE
		&& (flags & SDL_WINDOW_INPUT_FOCUS);                              // SDL_APPINPUTFOCUS 
}
Пример #6
0
InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> viewer, bool grab) :
        mSDLWindow(window),
        mViewer(viewer),
        mMouseListener(NULL),
        mKeyboardListener(NULL),
        mWindowListener(NULL),
        mConListener(NULL),
        mWarpX(0),
        mWarpY(0),
        mWarpCompensate(false),
        mWrapPointer(false),
        mAllowGrab(grab),
        mWantMouseVisible(false),
        mWantGrab(false),
        mWantRelative(false),
        mGrabPointer(false),
        mMouseRelative(false),
        mFirstMouseMove(true),
        mMouseZ(0),
        mMouseX(0),
        mMouseY(0),
        mWindowHasFocus(true),
        mMouseInWindow(true)
    {
        _setupOISKeys();

        Uint32 flags = SDL_GetWindowFlags(mSDLWindow);
        mWindowHasFocus = (flags & SDL_WINDOW_INPUT_FOCUS);
        mMouseInWindow = (flags & SDL_WINDOW_MOUSE_FOCUS);
    }
void GUIEnvironment::ImGui_NewFrame()
{
	if (!g_FontTexture)
		ImGui_ImplSdlGL3_CreateDeviceObjects();

	ImGuiIO& io = ImGui::GetIO();

	int w, h;
	SDL_GetWindowSize(g_Window, &w, &h);
	io.DisplaySize = ImVec2((float)w, (float)h);
	io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f);

	int mx, my;
	Uint32 mouseMask = SDL_GetMouseState(&mx, &my);
	if (SDL_GetWindowFlags(g_Window) & SDL_WINDOW_MOUSE_FOCUS)
		io.MousePos = ImVec2((float)mx, (float)my);
	else
		io.MousePos = ImVec2(-1, -1);

	io.MouseDown[0] = g_MousePressed[0] || (mouseMask & SDL_BUTTON(SDL_BUTTON_LEFT)) != 0;
	io.MouseDown[1] = g_MousePressed[1] || (mouseMask & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0;
	io.MouseDown[2] = g_MousePressed[2] || (mouseMask & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
	g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;

	io.MouseWheel = g_MouseWheel;
	g_MouseWheel = 0.0f;

	SDL_ShowCursor(io.MouseDrawCursor ? 0 : 1);

	ImGui::NewFrame();
}
Пример #8
0
/**
 * @brief Tests the functionality of the SDL_GetWindowFlags function
 */
int
video_getWindowFlags(void *arg)
{
  SDL_Window* window;
  const char* title = "video_getWindowFlags Test Window";
  int x, y, w, h;
  SDL_WindowFlags flags;
  Uint32 actualFlags;
  
  /* Standard window */
  x = SDLTest_RandomIntegerInRange(1, 100);
  y = SDLTest_RandomIntegerInRange(1, 100);
  w = SDLTest_RandomIntegerInRange(320, 1024);
  h = SDLTest_RandomIntegerInRange(320, 768);
  
  /* Reliable flag */
  flags = SDL_WINDOW_SHOWN;
  
  window = SDL_CreateWindow(title, x, y, w, h, flags);
  SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags);
  SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
  if (window != NULL) {
      actualFlags = SDL_GetWindowFlags(window);
      SDLTest_AssertPass("Call to SDL_GetWindowFlags");
      SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %d", flags, actualFlags);
      SDL_DestroyWindow(window);
      SDLTest_AssertPass("Call to SDL_DestroyWindow");  
  }

  return TEST_COMPLETED;
}
Пример #9
0
static bool SetScreenParmsFullscreen( glimpParms_t parms )
{
	SDL_DisplayMode m = {0};
	int displayIdx = ScreenParmsHandleDisplayIndex( parms );
	if( displayIdx < 0 )
		return false;
		
	// get current mode of display the window should be full-screened on
	SDL_GetCurrentDisplayMode( displayIdx, &m );
	
	// change settings in that display mode according to parms
	// FIXME: check if refreshrate, width and height are supported?
	// m.refresh_rate = parms.displayHz;
	m.w = parms.width;
	m.h = parms.height;
	
	// set that displaymode
	if( SDL_SetWindowDisplayMode( window, &m ) < 0 )
	{
		common->Warning( "Couldn't set window mode for fullscreen, reason: %s", SDL_GetError() );
		return false;
	}
	
	// if we're currently not in fullscreen mode, we need to switch to fullscreen
	if( !( SDL_GetWindowFlags( window ) & SDL_WINDOW_FULLSCREEN ) )
	{
		if( SDL_SetWindowFullscreen( window, SDL_TRUE ) < 0 )
		{
			common->Warning( "Couldn't switch to fullscreen mode, reason: %s!", SDL_GetError() );
			return false;
		}
	}
	return true;
}
Пример #10
0
 const Uint32 Window::getFlags() const
 {
     if(isLoaded())
         return flags = SDL_GetWindowFlags(win);
     else
         return flags;
 }
Пример #11
0
/*
===============
IN_Frame
===============
*/
void IN_Frame(void)
{
	qboolean        loading;

	IN_JoyMove();
	IN_ProcessEvents();

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = (cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE);

	if(!cls.glconfig.isFullscreen && (Key_GetCatcher() & KEYCATCH_CONSOLE))
	{
		// Console is down in windowed mode
		IN_DeactivateMouse();
	}
	else if(!cls.glconfig.isFullscreen && loading)
	{
		// Loading in windowed mode
		IN_DeactivateMouse();
	}
	else if(!( SDL_GetWindowFlags(SDL_window) & SDL_WINDOW_INPUT_FOCUS))
	{
		// Window not got focus
		IN_DeactivateMouse();
	}
	else
		IN_ActivateMouse();

	// In case we had to delay actual restart of video system
	if( ( vidRestartTime != 0 ) && ( vidRestartTime < Sys_Milliseconds( ) ) )
	{
		vidRestartTime = 0;
		Cbuf_AddText( "vid_restart\n" );
	}
}
Пример #12
0
void IN_Frame (void) {
	qboolean loading;

	IN_JoyMove( );

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = (qboolean)( cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE );

	if( !cls.glconfig.isFullscreen && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
	{
		// Console is down in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !cls.glconfig.isFullscreen && loading )
	{
		// Loading in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !( SDL_GetWindowFlags( SDL_window ) & SDL_WINDOW_INPUT_FOCUS ) )
	{
		// Window not got focus
		IN_DeactivateMouse( );
	}
	else
		IN_ActivateMouse( );

	IN_ProcessEvents( );
}
Пример #13
0
/*
===============
IN_Init
===============
*/
void IN_Init( void *windowData )
{
    int appState;

    if( !SDL_WasInit( SDL_INIT_VIDEO ) )
    {
        Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )" );
        return;
    }

    SDL_window = (SDL_Window *)windowData;

    Com_DPrintf( "\n------- Input Initialization -------\n" );

    in_keyboardDebug = Cvar_Get( "in_keyboardDebug", "0", CVAR_ARCHIVE );

    // mouse variables
    in_mouse = Cvar_Get( "in_mouse", "1", CVAR_ARCHIVE );
    in_nograb = Cvar_Get( "in_nograb", "0", CVAR_ARCHIVE );

    in_joystick = Cvar_Get( "in_joystick", "0", CVAR_ARCHIVE|CVAR_LATCH );
    in_joystickThreshold = Cvar_Get( "joy_threshold", "0.15", CVAR_ARCHIVE );

    SDL_StartTextInput( );

    mouseAvailable = ( in_mouse->value != 0 );
    IN_DeactivateMouse( );

    appState = SDL_GetWindowFlags( SDL_window );
    Cvar_SetValue( "com_unfocused",	!( appState & SDL_WINDOW_INPUT_FOCUS ) );
    Cvar_SetValue( "com_minimized", appState & SDL_WINDOW_MINIMIZED );

    IN_InitJoystick( );
    Com_DPrintf( "------------------------------------\n" );
}
Пример #14
0
//
// SDLVideoDriver::FinishUpdate
//
// Push the newest frame to the display.
//
void SDLVideoDriver::FinishUpdate()
{
   // haleyjd 10/08/05: from Chocolate DOOM:
   UpdateGrab(window);

   // Don't update the screen if the window isn't visible.
   // Not doing this breaks under Windows when we alt-tab away 
   // while fullscreen.   
   if(!(SDL_GetWindowFlags(window) & SDL_WINDOW_SHOWN))
      return;

   if(setpalette)
   {
      if(primary_surface)
         SDL_SetPaletteColors(primary_surface->format->palette, colors, 0, 256);

      setpalette = false;
   }

   // haleyjd 11/12/09: blit *after* palette set improves behavior.
   if(primary_surface)
   {
      // Don't bother checking for errors. It should just cancel itself in that case.
      SDL_BlitSurface(primary_surface, nullptr, rgba_surface, nullptr);
      SDL_UpdateTexture(sdltexture, nullptr, rgba_surface->pixels, rgba_surface->pitch);
      SDL_RenderCopy(renderer, sdltexture, nullptr, destrect);
   }

   // haleyjd 11/12/09: ALWAYS update. Causes problems with some video surface
   // types otherwise.
   SDL_RenderPresent(renderer);
}
Пример #15
0
/*
===============
IN_DeactivateMouse
===============
*/
static void IN_DeactivateMouse( void )
{
    if( !SDL_WasInit( SDL_INIT_VIDEO ) )
        return;

    // Always show the cursor when the mouse is disabled,
    // but not when fullscreen
    if( !Cvar_VariableIntegerValue("r_fullscreen") )
        SDL_ShowCursor( 1 );

    if( !mouseAvailable )
        return;

    if( mouseActive )
    {
        IN_GobbleMotionEvents( );

        SDL_SetWindowGrab( SDL_window, 0 );
        SDL_SetRelativeMouseMode( SDL_FALSE );

        // Don't warp the mouse unless the cursor is within the window
        if( SDL_GetWindowFlags( SDL_window ) & SDL_WINDOW_MOUSE_FOCUS )
            SDL_WarpMouseInWindow( SDL_window, cls.glconfig.vidWidth / 2, cls.glconfig.vidHeight / 2 );

        mouseActive = qfalse;
    }
}
Пример #16
0
static void sdl_grab_start(struct sdl2_console *scon)
{
    QemuConsole *con = scon ? scon->dcl.con : NULL;

    if (!con || !qemu_console_is_graphic(con)) {
        return;
    }
    /*
     * If the application is not active, do not try to enter grab state. This
     * prevents 'SDL_WM_GrabInput(SDL_GRAB_ON)' from blocking all the
     * application (SDL bug).
     */
    if (!(SDL_GetWindowFlags(scon->real_window) & SDL_WINDOW_INPUT_FOCUS)) {
        return;
    }
    if (guest_cursor) {
        SDL_SetCursor(guest_sprite);
        if (!qemu_input_is_absolute() && !absolute_enabled) {
            SDL_WarpMouseInWindow(scon->real_window, guest_x, guest_y);
        }
    } else {
        sdl_hide_cursor();
    }
    SDL_SetWindowGrab(scon->real_window, SDL_TRUE);
    gui_grab = 1;
    sdl_update_caption(scon);
}
Пример #17
0
void IN_Frame() {
    bool loading;

    if (in_xbox360ControllerAvailable->integer) {
        IN_Xbox360ControllerMove();
    } else {
        IN_JoyMove();
    }

    // If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
    loading = (cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE);

    if (cls.keyCatchers & KEYCATCH_CONSOLE) {
        // Console is down in windowed mode
        IN_DeactivateMouse(false);
    } else if (loading) {
        // Loading in windowed mode
        IN_DeactivateMouse(true);
    } else if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_INPUT_FOCUS)) {
        // Window doesn't have focus
        IN_DeactivateMouse(false);
    } else if (com_minimized->integer) {
        // Minimized
        IN_DeactivateMouse(true);
    } else {
        IN_ActivateMouse();
    }

    IN_ProcessEvents(dropInput);
}
Пример #18
0
void IN_Frame()
{
	if ( in_xbox360ControllerAvailable->integer )
	{
		IN_Xbox360ControllerMove();
	}
	else
	{
		IN_JoyMove();
	}

	if ( cls.keyCatchers & KEYCATCH_CONSOLE )
	{
		// Console is down in windowed mode
		IN_SetFocus( false );
	}
	else if ( !( SDL_GetWindowFlags( window ) & SDL_WINDOW_INPUT_FOCUS ) )
	{
		// Window doesn't have focus
		IN_SetFocus( false );
	}
	else if ( com_minimized->integer )
	{
		// Minimized
		IN_SetFocus( false );
	}
	else
	{
		IN_SetFocus( true );
	}

	IN_ProcessEvents( dropInput );
}
Пример #19
0
SDL_bool PGE_Window::IsFullScreen(SDL_Window *win)
{
   Uint32 flags = SDL_GetWindowFlags(win);

   if(flags & SDL_WINDOW_FULLSCREEN_DESKTOP) return SDL_TRUE; // return SDL_TRUE if fullscreen

   return SDL_FALSE; // Return SDL_FALSE if windowed
}
Пример #20
0
void ToggleFullScreenIfFlagSet() {
	if (g_ToggleFullScreenNextFrame) {
		g_ToggleFullScreenNextFrame = false;

		Uint32 window_flags = SDL_GetWindowFlags(g_Screen);
		SDL_SetWindowFullscreen(g_Screen, window_flags ^ SDL_WINDOW_FULLSCREEN_DESKTOP);
	}
}
Пример #21
0
bool Window::fullscreen()
{
    SDL_DisplayMode dm;
    SDL_GetDesktopDisplayMode(0, &dm);
    SDL_SetWindowDisplayMode(window, &dm);
    SDL_SetWindowFullscreen(window, !(SDL_GetWindowFlags(window)&SDL_WINDOW_FULLSCREEN));
    return true;
}
Пример #22
0
void SDLX_GetDrawableSize(SDL_Window *window, int *w, int *h)
{
#if SDL_VERSION_ATLEAST(2, 0, 1)
    if (SDL_GetWindowFlags(window) & SDL_WINDOW_OPENGL)
        return SDL_GL_GetDrawableSize(window, w, h);
#endif
    SDL_GetWindowSize(window, w, h);
}
Пример #23
0
bool RenderWindow2D::IsFullscreen() const
{
   if (window == nullptr)
      return false;

   Uint32 windowFlags = SDL_GetWindowFlags(window.get());

   return (windowFlags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
}
Пример #24
0
bool wzIsFullscreen()
{
	Uint32 flags = SDL_GetWindowFlags(WZwindow);
	if (flags & SDL_WINDOW_FULLSCREEN)
	{
		return true;
	}
	return false;
}
Пример #25
0
void IN_Init(void)
{
	int appState;

	if (!SDL_WasInit(SDL_INIT_VIDEO))
	{
		Com_Error(ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )");
		return;
	}

	mainScreen = (SDL_Window *)GLimp_MainWindow();

	Com_DPrintf("\n------- Input Initialization -------\n");

	in_keyboardDebug = Cvar_Get("in_keyboardDebug", "0", CVAR_TEMP);

	// mouse variables
	in_mouse = Cvar_Get("in_mouse", "1", CVAR_ARCHIVE);

	if (in_mouse->integer == 2)
	{
		Com_Printf("Trying to emulate non raw input\n");
		if (!SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE))
		{
			Com_Printf(S_COLOR_RED "Failed to set the hint");
		}
	}
	else
	{
		SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "0", SDL_HINT_OVERRIDE);
	}

	in_nograb = Cvar_Get("in_nograb", "0", CVAR_ARCHIVE);

	in_joystick          = Cvar_Get("in_joystick", "0", CVAR_ARCHIVE | CVAR_LATCH);
	in_joystickThreshold = Cvar_Get("joy_threshold", "0.15", CVAR_ARCHIVE);

	SDL_StartTextInput();

	mouseAvailable = (in_mouse->value != 0);
	IN_DeactivateMouse();

	appState = SDL_GetWindowFlags(mainScreen);
	Cvar_SetValue("com_unfocused", !((appState & SDL_WINDOW_INPUT_FOCUS) && (appState & SDL_WINDOW_MOUSE_FOCUS)));
	Cvar_SetValue("com_minimized", appState & SDL_WINDOW_MINIMIZED);

	IN_InitKeyLockStates();

	// FIXME: Joystick initialization crashes some Windows and Mac OS X clients (see SDL #2833)
	//IN_InitJoystick();

#ifdef DISABLE_DINGY
	IN_EnableDingFilter();
#endif
	Com_DPrintf("------------------------------------\n");
}
Пример #26
0
GHOST_TWindowState
GHOST_WindowSDL::getState() const
{
	Uint32 flags = SDL_GetWindowFlags(m_sdl_win);

	if (flags & SDL_WINDOW_FULLSCREEN) return GHOST_kWindowStateFullScreen;
	else if (flags & SDL_WINDOW_MAXIMIZED) return GHOST_kWindowStateMaximized;
	else if (flags & SDL_WINDOW_MINIMIZED) return GHOST_kWindowStateMinimized;
	return GHOST_kWindowStateNormal;
}
Пример #27
0
bool sdlwrap_window_has_focus(void)
{
#if SDL_MODERN
   Uint32 flags = SDL_GetWindowFlags(g_window);
   flags &= SDL_WINDOW_INPUT_FOCUS;
   return flags == SDL_WINDOW_INPUT_FOCUS;
#else
   return (SDL_GetAppState() & (SDL_APPINPUTFOCUS | SDL_APPACTIVE)) == (SDL_APPINPUTFOCUS | SDL_APPACTIVE);
#endif
}
Пример #28
0
/*****************************************************************************

		Function: osd_gfx_put_image_normal

		Description: draw the raw computed picture to screen, without any effect
		trying to center it (I bet there is still some work on this, maybe not
														in this function)
		Parameters: none
		Return: nothing

*****************************************************************************/
void
osd_gfx_put_image_normal(void)
{
	uint32 sdlFlags = SDL_GetWindowFlags(sdlWindow);

	Slock(screen);
	dump_rgb_frame(screen->pixels);
	Sulock(screen);

	osd_gfx_blit();
}
bool SDLDisplay::isResizable() {
    Uint32 windowFlags;

    if (app_window != NULL) {
        windowFlags = SDL_GetWindowFlags(app_window);        
    } else {
        windowFlags = _sdlFlags;
    }

    return ((windowFlags & SDL_WINDOW_RESIZABLE) != 0);
}
Пример #30
0
void
UpdateHardwareGamma(void)
{
	float gamma = (vid_gamma->value);

	Uint16 ramp[256];
	CalculateGammaRamp(gamma, ramp, 256);
#if SDL_VERSION_ATLEAST(2, 0, 0)
	if(SDL_SetWindowGammaRamp(window, ramp, ramp, ramp) != 0) {
#else
	if(SDL_SetGammaRamp(ramp, ramp, ramp) < 0) {
#endif
		VID_Printf(PRINT_ALL, "Setting gamma failed: %s\n", SDL_GetError());
	}
}
#endif // X11GAMMA

static qboolean IsFullscreen()
{
#if SDL_VERSION_ATLEAST(2, 0, 0)
	return !!(SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN);
#else
	return !!(window->flags & SDL_FULLSCREEN);
#endif
}

static qboolean CreateSDLWindow(int flags)
{
#if SDL_VERSION_ATLEAST(2, 0, 0)
	int windowPos = SDL_WINDOWPOS_UNDEFINED;
	// TODO: support fullscreen on different displays with SDL_WINDOWPOS_UNDEFINED_DISPLAY(displaynum)
	window = SDL_CreateWindow("Yamagi Quake II", windowPos, windowPos,
	                          vid.width, vid.height, flags);

	if(window == NULL)
	{
		return false;
	}

	context = SDL_GL_CreateContext(window);
	if(context == NULL)
	{
		SDL_DestroyWindow(window);
		window = NULL;
		return false;
	}

	return true;
#else
	window = SDL_SetVideoMode(vid.width, vid.height, 0, flags);
	SDL_EnableUNICODE(SDL_TRUE);
	return window != NULL;
#endif
}