예제 #1
0
 private void GameFormSDL_KeyDownActions(SDL.SDL_KeyboardEvent e)
 {
     if ((e.keysym.sym == SDL.SDL_Keycode.SDLK_RETURN) && ((e.keysym.mod & SDL.SDL_Keymod.KMOD_ALT) != 0))
     {
         FullscreenToggle?.Invoke(this, EventArgs.Empty);
     }
 }
예제 #2
0
        private void GameFormSDL_KeyDownActions(SDL.SDL_KeyboardEvent e)
        {
            var altReturn = (e.keysym.sym == SDL.SDL_Keycode.SDLK_RETURN) && ((e.keysym.mod & SDL.SDL_Keymod.KMOD_ALT) != 0);
            var altEnter  = (e.keysym.sym == SDL.SDL_Keycode.SDLK_KP_ENTER) && ((e.keysym.mod & SDL.SDL_Keymod.KMOD_ALT) != 0);

            if (altReturn || altEnter)
            {
                FullscreenToggle?.Invoke(this, EventArgs.Empty);
            }
        }
예제 #3
0
        private void GameFormSDL_KeyDownActions(KeyboardEvent e)
        {
            var altReturn = ((KeyCode)e.Keysym.Sym == KeyCode.KReturn) && (((Keymod)e.Keysym.Mod & Keymod.KmodAlt) != 0);
            var altEnter  = ((KeyCode)e.Keysym.Sym == KeyCode.KKPEnter) && (((Keymod)e.Keysym.Mod & Keymod.KmodAlt) != 0);

            if (altReturn || altEnter)
            {
                FullscreenToggle?.Invoke(this, EventArgs.Empty);
            }
        }
예제 #4
0
파일: GameForm.cs 프로젝트: nesrak1/xenko
 /// <summary>
 /// Raises the FullScreenToggle event
 /// </summary>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 private void OnFullscreenToggle(EventArgs e)
 {
     FullscreenToggle?.Invoke(this, e);
 }
예제 #5
0
        public void UpdateGame()
        {
            try
            {
                if (KeyboardState.IsKeyDown(Keys.Escape))
                {
                    this.Close();
                    Forms.Application.Exit();
                }

                if (KeyboardState.IsKeyPressed(Keys.F3))
                {
                    DrawDebug = !DrawDebug;
                }

                if (KeyboardState.IsKeyPressed(Keys.E))
                {
                    CursorGrappedToggle.ButtonDown();
                }
                else
                {
                    CursorGrappedToggle.ButtonUp();
                }

                if (KeyboardState.IsKeyDown(Keys.F11))
                {
                    FullscreenToggle.ButtonDown();
                }
                else
                {
                    FullscreenToggle.ButtonUp();
                }

                // Day/night
                if (KeyboardState.IsKeyDown(Keys.I))
                {
                    Player.World.Sky.SkyColour += 0.002f;
                    Player.World.Sky.SkyColour.ClampInstance(0.1f, 1.0f);
                }
                if (KeyboardState.IsKeyDown(Keys.K))
                {
                    Player.World.Sky.SkyColour -= 0.002f;
                    Player.World.Sky.SkyColour.ClampInstance(0.1f, 1.0f);
                }

                // this does work but
                // Block block = Player.Chunk.GetBlockAt(GridLatch.MTWGetWorldBlock(Player.World, Player.Position));
                // doesnt really... rip
                //if (MouseState.IsButtonDown(MouseButton.Left))
                //{
                //    Block block = Player.Chunk.GetBlockAt(GridLatch.MTWGetWorldBlock(Player.World, Player.Position));
                //    if (block != null)
                //        block.BreakNaturally();
                //}

                Player.World.Update();
            }
            catch (Exception exception)
            {
                CrashReport start = new CrashReport(exception, "Game Loop", "Exception in game loop");
                throw exception;
                //ShutdownGame();
            }
        }