예제 #1
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'w')
     {
         up = false;
     }
     else if (key == 's')
     {
         down = false;
     }
     else if (key == 'd')
     {
         right = false;
     }
     else if (key == 'a')
     {
         left = false;
     }
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
 }
예제 #2
0
        private static void FullscreenMode()
        {
            int oldX      = 50;
            int oldY      = 50;
            int oldWidth  = 320;
            int oldHeight = 320;

            if (screensaver)
            {
                Glut.glutKeyboardFunc(new Glut.KeyboardCallback(ScreensaverKeyboard));
                Glut.glutPassiveMotionFunc(new Glut.PassiveMotionCallback(ScreensaverPassive));
                Glut.glutMouseFunc(new Glut.MouseCallback(ScreensaverMouse));
            }
            else
            {
                Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            }
            Glut.glutSetCursor(Glut.GLUT_CURSOR_NONE);

            oldX      = Glut.glutGet(Glut.GLUT_WINDOW_X);
            oldY      = Glut.glutGet(Glut.GLUT_WINDOW_Y);
            oldWidth  = Glut.glutGet(Glut.GLUT_WINDOW_WIDTH);
            oldHeight = Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT);

            Glut.glutFullScreen();
        }
예제 #3
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'l')
     {
         lighting = !lighting;
     }
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
     else if (key == 32)
     {
         autoRotate = !autoRotate;
     }
     else if (key == 27)
     {
         Glut.glutLeaveMainLoop();
     }
 }
예제 #4
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'l')
     {
         lighting = !lighting;
     }
     else if (key == ' ')
     {
         autoRotate = !autoRotate;
     }
     else if (key == 'a')
     {
         left = false;
     }
     else if (key == 'w')
     {
         up = false;
     }
     else if (key == 'd')
     {
         right = false;
     }
     else if (key == 's')
     {
         down = false;
     }
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
     else if (key == 'b')
     {
         alpha = !alpha;
         if (alpha)
         {
             Gl.Enable(EnableCap.Blend);
             Gl.Disable(EnableCap.DepthTest);
         }
         else
         {
             Gl.Disable(EnableCap.Blend);
             Gl.Enable(EnableCap.DepthTest);
         }
     }
 }
예제 #5
0
 private void UpdateFullscreen(bool fullscreen)
 {
     if (fullscreen)
     {
         Glut.glutFullScreen();
     }
     else
     {
         Glut.glutPositionWindow(0, 0);
         Glut.glutReshapeWindow(formWidth, formHeight);
     }
 }
예제 #6
0
파일: Program.cs 프로젝트: Ofri-Chen/Tetris
        private static void InitializeGlut()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(ConfigurationHandler.WindowWidth, ConfigurationHandler.WindowHeight);
            Glut.glutCreateWindow("Tetris");
            Glut.glutFullScreen();

            Glut.glutIdleFunc(OnRenderFrame);
            Glut.glutDisplayFunc(OnDisplay);
            Glut.glutCloseFunc(OnClose);

            Glut.glutKeyboardFunc(KeyboardManager.OnKeyboardDown);
            Glut.glutSpecialFunc(KeyboardManager.OnSpecialKeyboardDown);
            Glut.glutSpecialUpFunc(KeyboardManager.OnSpecialKeyboardUp);
        }
예제 #7
0
파일: Program.cs 프로젝트: tuvshinot/csharp
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'w') up = false;
     else if (key == 's') down = false;
     else if (key == 'd') right = false;
     else if (key == 'a') left = false;
     else if (key == ' ') autoRotate = !autoRotate;
     else if (key == 'l') lighting = !lighting;
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen) Glut.glutFullScreen();
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
 }
예제 #8
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
     else if (key == 'r')
     {
         rainbow = !rainbow;
         program.Use();
         program["static_colors"].SetValue(rainbow);
     }
 }
예제 #9
0
 private static void OnKeyDown(byte key, int x, int y)
 {
     if (key == 'w')
     {
         xangle -= step;
     }
     else if (key == 's')
     {
         xangle += step;
     }
     else if (key == 'a')
     {
         yangle -= step;
     }
     else if (key == 'd')
     {
         yangle += step;
     }
     else if (key == ' ')
     {
         stopwatch = stopwatch == null?System.Diagnostics.Stopwatch.StartNew() : null;
     }
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
         }
     }
     else if (key == 27)
     {
         Glut.glutLeaveMainLoop();
     }
 }
예제 #10
0
        public SonicOpenGLStateVisualizer( )
        {
            int i = 0;

            Glut.glutInit(ref i, null);
            Glut.glutInitDisplayMode(Glut.GLUT_RGBA | Glut.GLUT_DOUBLE);

            Glut.glutCreateWindow("Map");
            Glut.glutPositionWindow(0, 0);
            Glut.glutFullScreen( );

            Gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity( );
            Gl.glOrtho(0.0f, winWid, 0.0f, winHeight, -100.0f, 100.0f);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glLoadIdentity( );
            Glut.glutIdleFunc(new Glut.IdleCallback(redraw));
            Glut.glutDisplayFunc(new Glut.DisplayCallback(redraw));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(keyboard));
            //new Thread( new ThreadStart( Glut.glutMainLoop ) ).Start( );
            Gl.glEnable(Gl.GL_BLEND);
            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
        }
예제 #11
0
 private static void OnKeyboardMoves(byte key, int x, int y)
 {
     if (key == 'a')
     {
         rotx = rotx + 3;
     }
     else if (key == 'z')
     {
         rotx = rotx - 3;
     }
     else if (key == 'e')
     {
         roty = roty + 3;
     }
     else if (key == 'r')
     {
         roty = roty - 3;
     }
     else if (key == 't')
     {
         rotz = rotz + 3;
     }
     else if (key == 'y')
     {
         rotz = rotz - 3;
     }
     else if (key == '+')
     {
         zoom = zoom + 3;
     }
     else if (key == '-')
     {
         zoom = zoom - 3;
     }
     else if (key == 'q')
     {
         translatex = translatex + 1;
     }
     else if (key == 's')
     {
         translatex = translatex - 1;
     }
     else if (key == 'd')
     {
         translatey = translatey + 1;
     }
     else if (key == 'g')
     {
         translatey = translatey - 1;
     }
     if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
 }
예제 #12
0
        private static void OnKeyboardUp(byte key, int x, int y)
        {
            if (key == 'w')
            {
                up = false;
            }
            else if (key == 's')
            {
                down = false;
            }
            else if (key == 'd')
            {
                right = false;
            }
            else if (key == 'a')
            {
                left = false;
            }
            else if (key == ' ')
            {
                autoRotate = !autoRotate;
                if (autoRotate)
                {
                    wplayer.controls.play();
                }
                else
                {
                    wplayer.controls.stop();
                }

                Rain.rainbow = !Rain.rainbow;
                Rain.program.Use();
                Rain.program["static_colors"].SetValue(Rain.rainbow);

                Smoke.rainbow = !Smoke.rainbow;
                Smoke.program.Use();
                Smoke.program["static_colors"].SetValue(Smoke.rainbow);
            }
            else if (key == 'l')
            {
                lighting = !lighting;
            }
            else if (key == 'z')
            {
                fullscreen = !fullscreen;
                if (fullscreen)
                {
                    Glut.glutFullScreen();
                }
                else
                {
                    Glut.glutPositionWindow(0, 0);
                    Glut.glutReshapeWindow(1280, 720);
                }
            }
            else if (key == 'b')
            {
                alpha = !alpha;
                if (alpha)
                {
                    Gl.Enable(EnableCap.Blend);
                    Gl.Disable(EnableCap.DepthTest);
                }
                else
                {
                    Gl.Disable(EnableCap.Blend);
                    Gl.Enable(EnableCap.DepthTest);
                }
            }
            if (key == 'f')
            {
                fullscreen = !fullscreen;
                if (fullscreen)
                {
                    Glut.glutFullScreen();
                }
                else
                {
                    Glut.glutPositionWindow(0, 0);
                    Glut.glutReshapeWindow(1280, 720);
                }
            }
            else if (key == 'r')
            {
                Rain.rainbow = !Rain.rainbow;
                Rain.program.Use();
                Rain.program["static_colors"].SetValue(Rain.rainbow);

                Smoke.rainbow = !Smoke.rainbow;
                Smoke.program.Use();
                Smoke.program["static_colors"].SetValue(Smoke.rainbow);
            }
        }