/* ** GLimp_SetMode */ rserr_t GLimp_SetMode( int x, int y, int width, int height, int displayFrequency, qboolean fullscreen, qboolean wideScreen ) { const char *win_fs[] = { "W", "FS" }; // check whether we can toggle fullscreen without a vid_restart if( glw_state.hWnd ) { if( glConfig.width == width && glConfig.height == height && fullscreen != glConfig.fullScreen ) { glConfig.fullScreen = VID_SetFullscreenMode( displayFrequency, fullscreen ); if( glConfig.fullScreen == fullscreen ) { VID_SetWindowSize( fullscreen ); return rserr_ok; } return rserr_restart_required; } } ri.Com_Printf( "Initializing OpenGL display\n" ); ri.Com_Printf( "...setting mode:" ); // disable fullscreen if rendering to a parent window if( glw_state.parenthWnd ) { RECT parentWindowRect; fullscreen = qfalse; wideScreen = qfalse; GetWindowRect( glw_state.parenthWnd, &parentWindowRect ); width = parentWindowRect.right - parentWindowRect.left; height = parentWindowRect.bottom - parentWindowRect.top; } ri.Com_Printf( " %d %d %s\n", width, height, win_fs[fullscreen] ); // destroy the existing window if( glw_state.hWnd ) { GLimp_Shutdown(); } glw_state.win_x = x; glw_state.win_y = y; glConfig.width = width; glConfig.height = height; glConfig.wideScreen = wideScreen; glConfig.fullScreen = VID_SetFullscreenMode( displayFrequency, fullscreen ); if( !VID_CreateWindow() ) { return rserr_invalid_mode; } return ( fullscreen == glConfig.fullScreen ? rserr_ok : rserr_invalid_fullscreen ); }
void VID_SetMode(int ModeValue) { if (Vid.BackBuffer) { VID_Shutdown(); } WindowWidth = modelist[ModeValue].width; WindowHeight = modelist[ModeValue].height; Vid.BufferHeight = 240; Vid.BufferWidth = 320; Vid.BytesPerPixel = 4; if (modelist[ModeValue].type == MS_WINDOWED) { VID_SetWindowedMode(ModeValue); } else { VID_SetFullscreenMode(ModeValue); } // Show the window ShowWindow(MainWindow, SW_SHOWDEFAULT); // define our bit map info BitMapInfo.bmiHeader.biSize = sizeof(BitMapInfo.bmiHeader); BitMapInfo.bmiHeader.biWidth = Vid.BufferWidth; BitMapInfo.bmiHeader.biHeight = -Vid.BufferHeight; // put the origin in the top left corner BitMapInfo.bmiHeader.biPlanes = 1; BitMapInfo.bmiHeader.biBitCount = 8 * Vid.BytesPerPixel; BitMapInfo.bmiHeader.biCompression = BI_RGB; Vid.BackBuffer = malloc(Vid.BufferWidth * Vid.BufferHeight * Vid.BytesPerPixel); CharData = COM_FindFile("gfx/menuplyr.lmp", &CharLength); }