void SCSapplication::Fullscreen (const SCSbool iEnable) {
			if (iEnable) {
				SDL_WM_ToggleFullScreen(SCSdisplay::Singleton()->FrameBuffer());
			} else {
				SDL_WM_ToggleFullScreen(NULL);
			}
		}
Example #2
0
static int native_fullscreen (SADisplay *display, int fullscreen, int autoscale)
{
        SDLNative *native = SDL_NATIVE (display->native);
        SDL_Surface *screen = native->screen;

        if (fullscreen == TRUE) {
                if (!(screen->flags & SDL_FULLSCREEN)) {
                        if (autoscale == TRUE) {
                                int width = display->screen->width;
                                int height = display->screen->height;

                                native->oldwidth = width;
                                native->oldheight = height;

                                get_nearest_resolution (display, &width, &height);

                                native_create (display, native->requested_depth, NULL, width, height, native->resizable);
                        }

                        SDL_ShowCursor (SDL_FALSE);
                        SDL_WM_ToggleFullScreen (screen);
                }
        } else {
                if ((screen->flags & SDL_FULLSCREEN)) {
                        SDL_ShowCursor (SDL_TRUE);
                        SDL_WM_ToggleFullScreen (screen);

                        if (autoscale == TRUE)
                                native_create (display, native->requested_depth, NULL, native->oldwidth,
                                               native->oldheight, native->resizable);
                }
        }

        return 0;
}
Example #3
0
int sdl_fullscreen_set (int mode)
{
	static int oldw;
	static int oldh;
	int screen_fullscreen = 0;
	int tempx;
	int tempy;

	switch (mode) {
		case 0:
			if ((screen->flags & SDL_FULLSCREEN) != 0) {
				SDL_WM_ToggleFullScreen (screen);
				SDL_ShowCursor (SDL_ENABLE);

				sdl_size_request (oldw, oldh);
				screen_fullscreen = 0;

				return 0;
			}
			break;

		case 1:
			if ((screen->flags & SDL_FULLSCREEN) == 0) {
				if (screen_fullscreen == 0)
				{
					oldw = screen->w;
					oldh = screen->h;
				}

				if (screen_fullscreen == 1)
					SDL_WM_ToggleFullScreen (screen);

				sdl_fullscreen_xy (&tempx, &tempy);

				sdl_size_request (tempx, tempy);

				if (SDL_WM_ToggleFullScreen (screen)) {
					SDL_ShowCursor (SDL_DISABLE);
					screen_fullscreen = 1;

					return 0;
				} else {
					sdl_size_request (oldw, oldh);

					screen_fullscreen = 0;

					return -1;
				}
			}
			break;

		default:
			break;
	}
}
Example #4
0
/* function to handle key press events */
void handleKeyPress( SDL_keysym *keysym )
{
    switch ( keysym->sym )
	{
		case SDLK_ESCAPE:
		    /* ESC key was pressed */
		    Quit( 0 );
		    break;
		case SDLK_F1:
		    /* 'f' key was pressed
		     * this toggles fullscreen mode
		     */
		    SDL_WM_ToggleFullScreen( surface );
		    break;
		case SDLK_SPACE:
			if (game)													// Space Bar Being Pressed After Game Has Ended?
			{
				for (int loop=0; loop<30; loop++)						// Loop Through 30 Objects
					InitObject(loop);									// Initialize Each Object
	
				game=false;												// Set game (Game Over) To False
				score=0;												// Set score To 0
				level=1;												// Set level Back To 1
				kills=0;												// Zero Player Kills
				miss=0;													// Set miss (Missed Shots) To 0
			}	
			break;
		default:
		    break;
	}

    return;
}
Example #5
0
void CApp::OnKeyUp(SDLKey sym, SDLMod mod, Uint16 unicode) {
  switch(sym) {
  case SDLK_ESCAPE: {
    OnExit();
    break;
  }
  case SDLK_f: {
    // toggle fullscreen
    SDL_WM_ToggleFullScreen(Surf_Display);
    break;
  }
  case SDLK_c: {
    // toggle cursor
    if (SDL_ShowCursor(SDL_QUERY) == SDL_DISABLE) {
      SDL_ShowCursor(SDL_ENABLE);
    } else {
      SDL_ShowCursor(SDL_DISABLE);
    }
    break;
  }
  default: { // do nothing
  }
  }
  return;
}
Example #6
0
static void handle_key_down(SDL_keysym *keysym)
{
	switch (keysym->sym) {
	case SDLK_F1:
		helpmode = !helpmode;
		break;
	case SDLK_ESCAPE:
		quit(0);
		break;
	case SDLK_F11:
		SDL_WM_ToggleFullScreen(screen);
		break;
	case SDLK_PAUSE:
		display_frame_stats = (display_frame_stats + 1) % 3;
		break;
	case SDLK_r:
		oldwireframe = wireframe;
		wireframe = !wireframe;
		break;
	case SDLK_s:
		autospin = !autospin;
		break;
	case SDLK_a:
		draw_atmosphere = !draw_atmosphere;
		break;
	default:
		break;
	}

}
Example #7
0
//---------------------------------------------------------------------------
void ookcb()
{
   bool temp = uv_main::konfig.get_config().fullscreen;
   SDL_Surface *sf = SDL_GetVideoSurface();

   uv_main::options.set_visible(0);
   //ON TOP entfernen
   uv_main::mainwindow.set_on_top_widget(0);
   uv_main::konfig.set_fullscreen(uv_main::ofullscreen.get_checked());
   if(temp != uv_main::ofullscreen.get_checked()) SDL_WM_ToggleFullScreen(sf);
	config tmp = uv_main::konfig.get_config();
	switch( uv_main::oresolution.get_act_ele() )
		{
			case 0:
				tmp.width = 800;
				tmp.height = 600;
				break;
			case 1:
				tmp.width = 1024;
				tmp.height = 768;
				break;
			case 2:
				tmp.width = 1280;
				tmp.height = 1024;
				break;
			case 4:
				tmp.width = 1600;
				tmp.height = 1200;
				break;
		}
	uv_main::konfig.set_config(tmp);
}
Example #8
0
static int pollEvents()
{
	SDL_Event event;

	while (SDL_PollEvent(&event))
	{
		switch(event.nType)
		{
		case SDL_QUIT:
		case SDL_MOUSEBUTTONDOWN:
		case SDL_MOUSEBUTTONUP:
			return 1;
		case SDL_KEYDOWN:
			switch (event.key.keysym.sym)
			{
			case SDLK_ESCAPE:
			case SDLK_q:
				return 1;
			case SDLK_f:
				SDL_WM_ToggleFullScreen(g_screen);
				break;
			default:
				break;
			}
			break;
		default:
			break;
		}
	}

	return 0;
}
Example #9
0
EXPORT m64p_error CALL VidExt_ToggleFullScreen(void)
{
    /* call video extension override if necessary */
    if (l_VideoExtensionActive)
    {
        m64p_error rval = (*l_ExternalVideoFuncTable.VidExtFuncToggleFS)();
        if (rval == M64ERR_SUCCESS)
        {
            l_Fullscreen = !l_Fullscreen;
            StateChanged(M64CORE_VIDEO_MODE, l_Fullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED);
        }
        return rval;
    }

    if (!SDL_WasInit(SDL_INIT_VIDEO))
        return M64ERR_NOT_INIT;

    if (SDL_WM_ToggleFullScreen(l_pScreen) == 1)
    {
        l_Fullscreen = !l_Fullscreen;
        StateChanged(M64CORE_VIDEO_MODE, l_Fullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED);
        return M64ERR_SUCCESS;
    }

    return M64ERR_SYSTEM_FAIL;
}
Example #10
0
            void toggleFullScreen()
            {
                SDL_WM_ToggleFullScreen(screen);
                /*
                fullScreen = !fullScreen;

                int flags = SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_RESIZABLE;

                int width;
                int height;

                if (fullScreen)
                {
                    flags |= SDL_FULLSCREEN;
                    oldWindowWidth = windowWidth;
                    oldWindowHeight = windowHeight;
                    width = getDesktopWidth();
                    height = getDesktopHeight();
                }
                else
                {
                    width = oldWindowWidth;
                    height = oldWindowHeight;
                }

                SDL_FreeSurface(screen);
                screen = SDL_SetVideoMode(width, height, 32, flags);

                resize();
                */
            }
Example #11
0
/* function to handle key press events */
void handleKeyPress(SDL_Surface *surface, sState *state, SDL_keysym const *keysym)
{
    switch ( keysym->sym )
	{
        case SDLK_ESCAPE:
            /* ESC key was pressed */
            Quit( 0 );
            break;
        case SDLK_F1:
            /* F1 key was pressed
             * this toggles fullscreen mode
             */
            SDL_WM_ToggleFullScreen( surface );
            break;
        case SDLK_w:
            state->x = 0.1f;
            break;
        case SDLK_s:
            state->x -= 0.1f;
            break;
        default:
            break;
	}
    
    return;
}
void ProcessSDLEvents()
{
  SDL_Event event;

  if(SDL_PollEvent(&event)) {
    do {
      switch (event.type) {
        case SDL_KEYDOWN:
          if(event.key.keysym.sym == SDLK_RETURN &&
             event.key.keysym.mod & KMOD_ALT) {
            SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
            break;
          }
          if(event.key.keysym.sym == SDLK_g && event.key.keysym.mod & KMOD_CTRL) {
            if(SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF) {
              SDL_WM_GrabInput(SDL_GRAB_ON);
              SDL_ShowCursor(SDL_DISABLE);
            } else {
              SDL_WM_GrabInput(SDL_GRAB_OFF);
              SDL_ShowCursor(SDL_ENABLE);
            }
            break;
          }
        case SDL_KEYUP:
          DoSDLKey(&event);
          break;
        case SDL_QUIT:
          exit(0);
      }
    } while(SDL_PollEvent(&event));
  }
}
Example #13
0
// new proc by S.A., called by alt-return key binding.
void	VID_Toggle (void)
{
	static qboolean vid_toggle_works = true;

	S_ClearBuffer ();

	if (!vid_toggle_works)
		goto vrestart;
	if (SDL_WM_ToggleFullScreen(draw_context) == 1)
	{
		Sbar_Changed ();	// Sbar seems to need refreshing

		modestate = draw_context->flags & SDL_FULLSCREEN ? MS_FULLSCREEN : MS_WINDOWED;

		VID_SyncCvars();

		// update mouse grab
		if (key_dest == key_console || key_dest == key_menu)
		{
			if (modestate == MS_WINDOWED)
				IN_Deactivate(true);
			else if (modestate == MS_FULLSCREEN)
				IN_Activate();
		}
	}
	else
	{
		vid_toggle_works = false;
		Con_DPrintf ("SDL_WM_ToggleFullScreen failed, attempting VID_Restart\n");
	vrestart:
		Cvar_SetQuick (&vid_fullscreen, draw_context-> flags & SDL_FULLSCREEN ? "0" : "1");
		Cbuf_AddText ("vid_restart\n");
	}
}
/**
 * Toggle between fullscreen and window mode
 * @return either NR_OK or NR_UNKNOWN_ERROR
 **/
nrResult nrCRenderContextSDL::setFullscreen(bool bFull){

	if (!_inFullscreen && bFull){
		if(SDL_WM_ToggleFullScreen(_mainWindow) == 0){
			nrLog.Log(NR_LOG_ENGINE, "nrCRenderContextSDL: Failed to go into fullscreen mode : %s" ,SDL_GetError());
			return NR_UNKNOWN_ERROR;
		}
	}else if (_inFullscreen && !bFull){
		if(SDL_WM_ToggleFullScreen(_mainWindow) == 0){
			nrLog.Log(NR_LOG_ENGINE, "nrCRenderContextSDL: Failed to go into windowed mode : %s" ,SDL_GetError());
			return NR_UNKNOWN_ERROR;
		}
	}

	return NR_OK;
}
Example #15
0
void FFDemo::input()
{
    while(SDL_PollEvent(&mEvent))
    {
        if (mEvent.type == SDL_KEYDOWN)
        {
            if (mEvent.key.keysym.sym == SDLK_ESCAPE)
            {  
                Mix_PlayChannel(-1, mEscapeSound, 0);
				
                action(fcn::ActionEvent(NULL, "escape"));
            }
            else if (mEvent.key.keysym.sym == SDLK_RETURN
                     || mEvent.key.keysym.sym == SDLK_UP
                     || mEvent.key.keysym.sym == SDLK_DOWN)
            {  
                Mix_PlayChannel(-1, mChooseSound, 0);
            }
            else if (mEvent.key.keysym.sym == SDLK_f)
            {
                // Works with X11 only
                SDL_WM_ToggleFullScreen(mScreen);
            }
            mSDLInput->pushInput(mEvent);			
        }
        else if (mEvent.type == SDL_KEYUP)
        {
            mSDLInput->pushInput(mEvent);
        }
        else if (mEvent.type == SDL_QUIT)
        {
            mRunning = false;
        }
    }
}
Example #16
0
void Main::handle_event(SDL_Event * event) {	
	/* Catch quit event and ALT-F4 */
	if(event->type == SDL_QUIT) {
		running = false;
	}
	if(event->type == SDL_KEYDOWN) {
		if(event->key.keysym.mod & KMOD_ALT) {
			if(event->key.keysym.sym == SDLK_F4) {
				running = false;
			}
		}
		if(event->key.keysym.sym == SDLK_F10) {
			// Toggle fullscreen X11
			if (!SDL_WM_ToggleFullScreen(screen)) {
				// More portable version of toggle
				screen = SDL_SetVideoMode(0, 0, 0, screen->flags ^ SDL_FULLSCREEN);
				// If toggle failed, switch back
				if (screen == NULL) 
					screen = SDL_SetVideoMode(0, 0, 0, flags);
			}
		}
		if(event->key.keysym.sym == SDLK_F11) {
			fps_counter_visible = !fps_counter_visible;
		}
		if(event->key.keysym.sym == SDLK_PRINT) {
			screenshot_next_flip = true;
		}
	}
	if(event->type == SDL_KEYDOWN || event->type == SDL_KEYUP || event->type == SDL_JOYAXISMOTION ||
		event->type == SDL_JOYBUTTONDOWN || event->type == SDL_JOYBUTTONUP || event->type == SDL_JOYHATMOTION) {
		last_activity = frame;
	}
}
Example #17
0
EXPORT m64p_error CALL VidExt_ToggleFullScreen(void)
{
    /* call video extension override if necessary */
    if (l_VideoExtensionActive)
    {
        m64p_error rval = (*l_ExternalVideoFuncTable.VidExtFuncToggleFS)();
        if (rval == M64ERR_SUCCESS)
        {
            l_Fullscreen = !l_Fullscreen;
            StateChanged(M64CORE_VIDEO_MODE, l_Fullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED);
        }
        return rval;
    }

    if (!SDL_WasInit(SDL_INIT_VIDEO))
        return M64ERR_NOT_INIT;

    /* TODO:
     * SDL_WM_ToggleFullScreen doesn't work under Windows and others
     * (see http://wiki.libsdl.org/moin.cgi/FAQWindows for explanation).
     * Instead, we should call SDL_SetVideoMode with the SDL_FULLSCREEN flag.
     * (see http://sdl.beuc.net/sdl.wiki/SDL_SetVideoMode), but on Windows
     * this resets the OpenGL context and video plugins don't support it yet.
     * Uncomment the next line to test it: */
    //return VidExt_SetVideoMode(l_pScreen->w, l_pScreen->h, l_pScreen->format->BitsPerPixel, l_Fullscreen ? M64VIDEO_WINDOWED : M64VIDEO_FULLSCREEN);
    if (SDL_WM_ToggleFullScreen(l_pScreen) == 1)
    {
        l_Fullscreen = !l_Fullscreen;
        StateChanged(M64CORE_VIDEO_MODE, l_Fullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED);
        return M64ERR_SUCCESS;
    }

    return M64ERR_SYSTEM_FAIL;
}
Example #18
0
void process_keydown_event( const SDL_KeyboardEvent& event ) {
    switch ( event.keysym.sym ) {
        case SDLK_ESCAPE:
            running = false;
            break;
        case SDLK_f:
            SDL_WM_ToggleFullScreen( screen );
            break;
        case SDLK_UP:
            scaleFactor += deltaStep;
            if ( scaleFactor > maximumScaleFactor ) {
                scaleFactor = maximumScaleFactor;
            }
            break;
        case SDLK_DOWN:
            scaleFactor -= deltaStep;
            if ( scaleFactor < minimumScaleFactor ) {
                scaleFactor = minimumScaleFactor;
            }
            break;
        default:
            break;
    }
    std::cout << "Se presionĂ² una tecla" << std::cout;
}
Example #19
0
void events() {
    SDL_Event e;

    Uint8* keys = SDL_GetKeyState(NULL);

    while (SDL_PollEvent(&e)) {
        if (e.type == SDL_KEYDOWN) {
            switch (e.key.keysym.sym) {
            case SDLK_ESCAPE:
                INIT.quit();
                exit(0);
                break;
            case SDLK_TAB:
                SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
                break;
            case SDLK_f:
                randomize_field();
                break;
            case SDLK_t:
                init_diffuse();
                break;
            case SDLK_r:
                init_react();
                break;
            case SDLK_RETURN:
                save_state();
                break;
            }
        }

        if (e.type == SDL_MOUSEMOTION) {
            int xcoord = int(e.motion.x / INIT.pixel_view().dim().x * GRIDW);
            int ycoord = int((INIT.pixel_view().dim().y - e.motion.y) / INIT.pixel_view().dim().y * GRIDH);
            if (xcoord >= 0 && xcoord < GRIDW && ycoord >= 0 && ycoord < GRIDH) {
                Cell& cell = GRID_FRONT[xcoord][ycoord];
                if (keys[SDLK_a]) {
                    cell.value[0] += DT;
                    if (cell.value[0] > 1) cell.value[0] = 1;
                }
                if (keys[SDLK_s]) {
                    cell.value[1] += DT;
                    if (cell.value[1] > 1) cell.value[1] = 1;
                }
                if (keys[SDLK_d]) {
                    cell.value[2] += DT;
                    if (cell.value[2] > 1) cell.value[2] = 1;
                }

            }
        }

        if (e.type == SDL_MOUSEBUTTONDOWN) {
            int xcoord = int(e.button.x / INIT.pixel_view().dim().x * GRIDW);
            int ycoord = int((INIT.pixel_view().dim().y - e.button.y) / INIT.pixel_view().dim().y * GRIDH);
            if (xcoord >= 0 && xcoord < GRIDW && ycoord >= 0 && ycoord < GRIDH) {
                modify_reaction(xcoord, ycoord);
            }
        }
    }
}
Example #20
0
/* function to handle key press events */
void Framework::handleKeyPress(SDL_keysym *keysym)
{
	switch (keysym->sym)
	{
	case SDLK_q:
		shutdown();
		break;
	case SDLK_f:
		SDL_WM_ToggleFullScreen(surface);
		break;
	case SDLK_ESCAPE:
	case SDLK_p:
		togglePause(false, false);
		break;
	case SDLK_F1:
		camera.setMode((Camera::View)1);
		break;
	case SDLK_F2:
		camera.setMode((Camera::View)2);
		break;
	case SDLK_F3:
		camera.setMode((Camera::View)3);
		break;
	default:
		break;
	}
}
void SDLScreen::ToggleFullScreen()
{
  if (!screen)
  	return;

  SDL_WM_ToggleFullScreen(screen);
}
Example #22
0
static void
SDLGL_Close(void *obj)
{
	AG_Driver *drv = obj;
	AG_DriverSDLGL *sgl = obj;

#ifdef AG_DEBUG
	if (nDrivers != 1) { AG_FatalError("Driver close without open"); }
#endif
	AG_FreeCursors(AGDRIVER(sgl));

	if (AG_CfgBool("view.full-screen")) {
		SDL_WM_ToggleFullScreen(sgl->s);
	}
	if (initedSDLVideo) {
		SDL_QuitSubSystem(SDL_INIT_VIDEO);
		initedSDLVideo = 0;
	}
	AG_ObjectDetach(drv->mouse);
	AG_ObjectDestroy(drv->mouse);
	AG_ObjectDetach(drv->kbd);
	AG_ObjectDestroy(drv->kbd);
	drv->mouse = NULL;
	drv->kbd = NULL;

	if (sgl->outMode != AG_SDLGL_OUT_NONE) {
		Free(sgl->outBuf);
		sgl->outBuf = NULL;
		sgl->outMode = AG_SDLGL_OUT_NONE;
	}

	nDrivers = 0;
}
Example #23
0
static
void sdl_set_fullscreen (sdl_t *sdl, int val)
{
	if ((val != 0) == (sdl->fullscreen != 0)) {
		return;
	}

	if (sdl->scr != NULL) {
		SDL_WM_ToggleFullScreen (sdl->scr);
	}

	sdl->fullscreen = (val != 0);

#ifdef PCE_HOST_WINDOWS
	/*
	 * SDL under windows does not support toggling full screen mode
	 * after a surface has been created. Setting the window size
	 * to the current size will free and then reallocate the
	 * surface.
	 */
	sdl_set_window_size (sdl, sdl->wdw_w, sdl->wdw_h, 1);

	/* Invalidate the entire terminal to force an update. */
	sdl->trm.update_x = 0;
	sdl->trm.update_y = 0;
	sdl->trm.update_w = sdl->trm.w;
	sdl->trm.update_h = sdl->trm.h;

	trm_update (&sdl->trm);
#endif
}
Example #24
0
/*
 * keyboard handling for keys which have nothing to do with the playerkeys
 * before calling this function make sure keyb_loop (); was called.
 *
 * chat mode: the chatmode should only be disabled in the game mode
 *   in the GS_wait mode the chat will always be active.
 */
void
game_keys_loop ()
{

    if (menu != NULL) {
        /* delete all movement keys */

        int i;
        for (i = 0; i < BCPK_max * 2; i++)
            keyb_gamekeys.state[i] = 0;
    } else {

        /* don't go into the game_keys if there is no menu displayed */

        if (GT_MP_PTPM && bman.state == GS_ready && keyb_gamekeys.state[BCK_pause]
                && !keyb_gamekeys.old[BCK_pause]) {
            /* Server is starting the game
             * check in multiplayer if all players are ready for the game
             */
            int i,
                ready = 1;

            for (i = 0; i < MAX_PLAYERS; i++)
                if (NET_CANSEND (i) && !players[i].ready)
                    ready = 0;

            if (ready)
                bman.state = GS_running;
            else
                d_printf ("game_keys_loop: not all players are ready\n");

            net_send_servermode ();
            bman.updatestatusbar = 1; // force an update
        }

        if (keyb_gamekeys.state[BCK_fullscreen] && !keyb_gamekeys.old[BCK_fullscreen]) {
            /* Switch Fullscreen */
            SDL_WM_ToggleFullScreen (gfx.screen);
            gfx.fullscreen = !gfx.fullscreen;
            bman.updatestatusbar = 1; // force an update
        }


        if (keyb_gamekeys.state[BCK_esc] && !keyb_gamekeys.old[BCK_esc]) {
            if (chat.active && (bman.state == GS_ready || bman.state == GS_running) && IS_LPLAYER2) {
                chat.active = 0;
                d_printf ("Chatmode Disabled\n");
            } else
                game_menu_create ();
        }

        if ((GT_MP_PTPM || GT_MP_PTPS) && keyb_gamekeys.state[BCK_chat]
                && !keyb_gamekeys.old[BCK_chat]) {
            chat_setactive (1, 0);
            chat.changed = 1;
            d_printf ("Chatmode Enabled\n");
        }
    }
};
Example #25
0
void ToggleFullScreen(void)
{
    if(SDL_WM_ToggleFullScreen(MainWindow) == 0)        // try to toggle fullscreen mode for window 'main_window' 
    {
        cerr << "Failed to Toggle Fullscreen mode : " << SDL_GetError() << endl;   // report error in case toggle fails
        Quit(0);
    }
}
Example #26
0
static qboolean SWimp_InitGraphics( qboolean fullscreen )
{
	const SDL_VideoInfo *vinfo;
	int flags;

	/* Just toggle fullscreen if that's all that has been changed */	
	if (surface && (surface->w == vid.width) && (surface->h == vid.height)) {
		int isfullscreen = (surface->flags & SDL_FULLSCREEN) ? 1 : 0;
		if (fullscreen != isfullscreen)
			SDL_WM_ToggleFullScreen(surface);
	
		isfullscreen = (surface->flags & SDL_FULLSCREEN) ? 1 : 0;
		if (fullscreen == isfullscreen)
			return true;
	}
	
	srandom(getpid());

	// free resources in use
	if (surface)
		SDL_FreeSurface(surface);

	// let the sound and input subsystems know about the new window
	ri.Vid_NewWindow (vid.width, vid.height);

/* 
	Okay, I am going to query SDL for the "best" pixel format.
	If the depth is not 8, use SetPalette with logical pal, 
	else use SetColors.
	
	Hopefully this works all the time.
*/
	vinfo = SDL_GetVideoInfo();
	sdl_palettemode = (vinfo->vfmt->BitsPerPixel == 8) ? (SDL_PHYSPAL|SDL_LOGPAL) : SDL_LOGPAL;
	flags = /*SDL_DOUBLEBUF|*/SDL_SWSURFACE|SDL_HWPALETTE;
	if (fullscreen)
		flags |= SDL_FULLSCREEN;
	
	SetSDLIcon(); /* currently uses q2icon.xbm data */
	
	if ((surface = SDL_SetVideoMode(vid.width, vid.height, 8, flags)) == NULL) {
		Sys_Error("(SOFTSDL) SDL SetVideoMode failed: %s\n", SDL_GetError());
		return false;
	}
	
	SDL_WM_SetCaption("Quake II", "Quake II");

	SDL_ShowCursor(0);

	vid.rowbytes = surface->pitch;
	vid.buffer = surface->pixels;

	X11_active = true;

	

	return true;
}
Example #27
0
//------------------------------------------------------------------------------
static inline void AlertEnableVideo(AlertWinState& state)
{
   if (state.fullScreen)
      SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
   if (state.cursorHidden)
      SDL_ShowCursor(SDL_DISABLE);
   if (state.inputGrabbed)
      SDL_WM_GrabInput(SDL_GRAB_ON);
}
Example #28
0
void SimpleSimulator::toggleFullscreen() {

        if( !window || SDL_WM_ToggleFullScreen(window)!=1 ) {
                std::cout << "Unable to toggle fullscreen: " << SDL_GetError() << std::endl;
        } else {
                fullscreen = !fullscreen;
                SDL_ShowCursor(!fullscreen);
        }
}
Example #29
0
//===========================================================================
void SetNormalMode () {
// It is simple, as almost everything in SDL. Thank you, Sam Lantinga. My appreciation! ^_^ --bb

	if(bIamFullScreened) {
		bIamFullScreened = 0;
		SDL_WM_ToggleFullScreen(screen);// we should go back anyway!? ^_^  --bb
		if(!usingcursor) SDL_ShowCursor(SDL_ENABLE); // show mouse cursor if not use it
	}
}
Example #30
0
/* FIXME: This should resize the video to a user-set
   fullscreen res */
static void
toggle_fullscreen (void)
{
  SDL_WM_ToggleFullScreen (screen);
  if (SDL_ShowCursor (SDL_QUERY) == SDL_ENABLE)
    SDL_ShowCursor (SDL_DISABLE);
  else
    SDL_ShowCursor (SDL_ENABLE);
}