コード例 #1
0
ファイル: fg_window_mswin.c プロジェクト: sherief/regal
/*
 * Toggle the window's full screen state.
 */
void fgPlatformGlutFullScreenToggle( SFG_Window *win )
{
    if (!win->State.IsFullscreen)
        glutFullScreen();
    else
        glutLeaveFullScreen();
}
コード例 #2
0
ファイル: Engine.cpp プロジェクト: akkenoth/eel
void Engine::toggleFullscreen() {
	if(isFullscreen) {
		glutLeaveFullScreen();
		isFullscreen = false;
	} else {
		glutFullScreen();
		isFullscreen = true;
	}
}
コード例 #3
0
		void exitFullscreen()
		{
			if(!_initialized)
			{
				std::cout<<"EROARE! GLUT - nu sunt initializat"<<std::endl;
				return;
			}
			glutLeaveFullScreen();
		}
コード例 #4
0
ファイル: fluidsGL.cpp プロジェクト: apc-llc/fluidsGL-optimus
void keyboard(unsigned char key, int x, int y)
{
    switch (key)
    {
        case 27:
            g_bExitESC = true;
            exit(EXIT_SUCCESS);
            break;
        
        case 'f':
        	if (!fullscreen)
        	{
        		fullscreen = 1;
				glutFullScreenToggle();
			}
			else
			{
				fullscreen = 0;
				glutLeaveFullScreen();
			}
			break;

        case 'r':
			pthread_mutex_lock(&display_mutex);
            memset(hvfield, 0, sizeof(cData) * DS);
            cudaMemcpy(dvfield, hvfield, sizeof(cData) * DS,
                       cudaMemcpyHostToDevice);

            initParticles(particles, DIM, DIM);

#ifndef OPTIMUS
            cudaGraphicsUnregisterResource(cuda_vbo_resource);
            getLastCudaError("cudaGraphicsUnregisterBuffer failed");
#endif

#if defined(OPTIMUS) || defined(BROADCAST)
            cudaMemcpy(particles_gpu, particles, sizeof(cData) * DS, cudaMemcpyHostToDevice);
#endif

            glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
            glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(cData) * DS,
                            particles, GL_DYNAMIC_DRAW_ARB);
            glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);

#ifndef OPTIMUS
            cudaGraphicsGLRegisterBuffer(&cuda_vbo_resource, vbo, cudaGraphicsMapFlagsNone);
            getLastCudaError("cudaGraphicsGLRegisterBuffer failed");
#endif
			pthread_mutex_unlock(&display_mutex);
            break;

        default:
            break;
    }
}
コード例 #5
0
ファイル: fg_window.c プロジェクト: d3x0r/SACK
/*
 * Change the current window's position
 */
void FGAPIENTRY glutPositionWindow( int x, int y )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPositionWindow" );
    FREEGLUT_EXIT_IF_NO_WINDOW ( "glutPositionWindow" );

    if (glutGet(GLUT_FULL_SCREEN))
    {
      /*  Leave full screen state before moving. */
      glutLeaveFullScreen();
    }

	fgPlatformGlutPositionWindow ( x, y );
}
コード例 #6
0
ファイル: main.cpp プロジェクト: rakib-csedu/savide
void ReleaseSpecialKeyInput (int key, int x, int y)
{

   switch (key)
   {

// pressing F1 key makes the prpgram fullscreen, press F1 again to get back in windowed mode
      case GLUT_KEY_F1:
         fullscreen = !fullscreen;
         if (fullscreen)
         {
            glutFullScreen ();

         }
         else
         {
            glutLeaveFullScreen (glutGet (GLUT_INIT_WINDOW_X),
                                 glutGet (GLUT_INIT_WINDOW_Y),
                                 glutGet (GLUT_INIT_WINDOW_WIDTH),
                                 glutGet (GLUT_INIT_WINDOW_HEIGHT) );
         }
         break;

      case GLUT_KEY_F2:

         break;
      case GLUT_KEY_F3:

         break;
      case GLUT_KEY_RIGHT:

         RKP = false;

         break;
      case GLUT_KEY_LEFT:
         LKP = false;

         break;
      case GLUT_KEY_UP:
         UKP = false;
         break;
      case GLUT_KEY_DOWN:

         DKP = false;
         break;
      default:
         break;
   }
}
コード例 #7
0
ファイル: fg_window.c プロジェクト: d3x0r/SACK
/*
 * Change the current window's size
 */
void FGAPIENTRY glutReshapeWindow( int width, int height )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutReshapeWindow" );
    FREEGLUT_EXIT_IF_NO_WINDOW ( "glutReshapeWindow" );

    if (glutGet(GLUT_FULL_SCREEN))
    {
      /*  Leave full screen state before resizing. */
      glutLeaveFullScreen();
    }

    fgStructure.CurrentWindow->State.NeedToResize = GL_TRUE;
    fgStructure.CurrentWindow->State.Width  = width ;
    fgStructure.CurrentWindow->State.Height = height;
}
コード例 #8
0
ファイル: main.cpp プロジェクト: Meta-link/Finecraft
void keyboardDownFunction(unsigned char key, int p1, int p2)
{
	if (key == VK_ESCAPE)
	{
		glutDestroyWindow(g_main_window_id);
		exit(0);
	}

	if (key == 'f')
	{
		if (!g_fullscreen) {
			glutFullScreen();
			g_fullscreen = true;
		}
		else if (g_fullscreen) {
			glutLeaveGameMode();
			glutLeaveFullScreen();
			glutReshapeWindow(g_renderer->_ScreenWidth, g_renderer->_ScreenWidth);
			glutPositionWindow(0, 0);
			g_fullscreen = false;
		}
	}

	if (key == 'q')
		QDown = true;

	if (key == 's')
		SDown = true;

	if (key == 'd')
		DDown = true;

	if (key == 'z')
		ZDown = true;

	if (key == 'g')
		g_fast_time = !g_fast_time;

	if (key == 'c')
		camera = !camera;

	if (key == VK_SPACE)
		avatar->Jump = true;
}
コード例 #9
0
ファイル: fg_window_mswin.c プロジェクト: sherief/regal
/*
 * Resize the current window so that it fits the whole screen
 */
void fgPlatformGlutFullScreen( SFG_Window *win )
{
#if !defined(_WIN32_WCE) /* FIXME: what about WinCE */

    if (glutGet(GLUT_FULL_SCREEN))
    {
        /*  Leave full screen state before entering fullscreen again (resizing?) */
        glutLeaveFullScreen();
    }

    {
#if(WINVER >= 0x0500) /* Windows 2000 or later */
        DWORD s;
        RECT rect;
        HMONITOR hMonitor;
        MONITORINFO mi;

        /* For fullscreen mode, first remove all window decoration
         * and set style to popup so it will overlap the taskbar
         * then force to maximize on the screen on which it has the most
         * overlap.
         */

        
        /* store current window rect */
        GetWindowRect( win->Window.Handle, &win->State.pWState.OldRect );

        /* store current window style */
        win->State.pWState.OldStyle = s = GetWindowLong(win->Window.Handle, GWL_STYLE);

        /* remove decorations from style and add popup style*/
        s &= ~WS_OVERLAPPEDWINDOW;
        s |= WS_POPUP;
        SetWindowLong(win->Window.Handle, GWL_STYLE, s);

        /* For fullscreen mode, find the monitor that is covered the most
         * by the window and get its rect as the resize target.
	     */
        hMonitor= MonitorFromRect(&win->State.pWState.OldRect, MONITOR_DEFAULTTONEAREST);
        mi.cbSize = sizeof(mi);
        GetMonitorInfo(hMonitor, &mi);
        rect = mi.rcMonitor;
#else   /* if (WINVER >= 0x0500) */
        RECT rect;

        /* For fullscreen mode, force the top-left corner to 0,0
         * and adjust the window rectangle so that the client area
         * covers the whole screen.
         */

        rect.left   = 0;
        rect.top    = 0;
        rect.right  = fgDisplay.ScreenWidth;
        rect.bottom = fgDisplay.ScreenHeight;

        AdjustWindowRect ( &rect, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS |
                                  WS_CLIPCHILDREN, FALSE );
#endif  /* (WINVER >= 0x0500) */

        /*
         * then resize window
         * SWP_NOACTIVATE     Do not activate the window
         * SWP_NOOWNERZORDER  Do not change position in z-order
         * SWP_NOSENDCHANGING Suppress WM_WINDOWPOSCHANGING message
         * SWP_NOZORDER       Retains the current Z order (ignore 2nd param)
         */
        SetWindowPos( fgStructure.CurrentWindow->Window.Handle,
                      HWND_TOP,
                      rect.left,
                      rect.top,
                      rect.right  - rect.left,
                      rect.bottom - rect.top,
                      SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING |
                      SWP_NOZORDER
                    );

        win->State.IsFullscreen = GL_TRUE;
    }
#endif
}
コード例 #10
0
ファイル: fg_window_mswin.c プロジェクト: d3x0r/SACK
/*
 * Resize the current window so that it fits the whole screen
 */
void fgPlatformGlutFullScreen( SFG_Window *win )
{
#if !defined(_WIN32_WCE) /* FIXME: what about WinCE */

    if (glutGet(GLUT_FULL_SCREEN))
    {
        /*  Leave full screen state before entering fullscreen again (resizing?) */
        glutLeaveFullScreen();
    }

    {
#if(WINVER >= 0x0500) /* Windows 2000 or later */
        RECT rect;
        HMONITOR hMonitor;
        MONITORINFO mi;

        /* For fullscreen mode, first remove all window decoration
         * and set style to popup so it will overlap the taskbar
         * then force to maximize on the screen on which it has the most
         * overlap.
         */

        
        /* save current window rect, style, exstyle and maximized state */
        win->State.pWState.OldMaximized = !!IsZoomed(win->Window.Handle);
        if (win->State.pWState.OldMaximized)
            /* We force the window into restored mode before going
             * fullscreen because Windows doesn't seem to hide the
             * taskbar if the window is in the maximized state.
             */
            SendMessage(win->Window.Handle, WM_SYSCOMMAND, SC_RESTORE, 0);

        GetWindowRect( win->Window.Handle, &win->State.pWState.OldRect );
        win->State.pWState.OldStyle   = GetWindowLong(win->Window.Handle, GWL_STYLE);
        win->State.pWState.OldStyleEx = GetWindowLong(win->Window.Handle, GWL_EXSTYLE);

        /* remove decorations from style */
        SetWindowLong(win->Window.Handle, GWL_STYLE,
                      win->State.pWState.OldStyle & ~(WS_CAPTION | WS_THICKFRAME));
        SetWindowLong(win->Window.Handle, GWL_EXSTYLE,
                      win->State.pWState.OldStyleEx & ~(WS_EX_DLGMODALFRAME |
                      WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));

        /* For fullscreen mode, find the monitor that is covered the most
         * by the window and get its rect as the resize target.
	     */
        hMonitor= MonitorFromRect(&win->State.pWState.OldRect, MONITOR_DEFAULTTONEAREST);
        mi.cbSize = sizeof(mi);
        GetMonitorInfo(hMonitor, &mi);
        rect = mi.rcMonitor;
#else   /* if (WINVER >= 0x0500) */
        RECT rect;

        /* For fullscreen mode, force the top-left corner to 0,0
         * and adjust the window rectangle so that the client area
         * covers the whole screen.
         */

        rect.left   = 0;
        rect.top    = 0;
        rect.right  = fgDisplay.ScreenWidth;
        rect.bottom = fgDisplay.ScreenHeight;

        AdjustWindowRect ( &rect, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS |
                                  WS_CLIPCHILDREN, FALSE );
#endif  /* (WINVER >= 0x0500) */

        /*
         * then resize window
         * SWP_NOACTIVATE     Do not activate the window
         * SWP_NOOWNERZORDER  Do not change position in z-order
         * SWP_NOSENDCHANGING Suppress WM_WINDOWPOSCHANGING message
         * SWP_NOZORDER       Retains the current Z order (ignore 2nd param)
         */
        SetWindowPos( fgStructure.CurrentWindow->Window.Handle,
                      HWND_TOP,
                      rect.left,
                      rect.top,
                      rect.right  - rect.left,
                      rect.bottom - rect.top,
                      SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING |
                      SWP_NOZORDER
                    );

        win->State.IsFullscreen = GL_TRUE;
    }
#endif
}