Exemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public override void HandleSdlKeyDownEvent(KeyboardEventArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            switch (args.Key)
            {
                case Key.Keypad2:
                    bs.Y += 10;
                    break;

                case Key.Keypad8:
                    bs.Y -= 10;
                    break;

                case Key.Keypad4:
                    bs.X -= 10;
                    break;

                case Key.Keypad6:
                    bs.X += 10;
                    break;

                default:
                    break;
            }
        }
Exemplo n.º 2
0
		public void KeyboardDown (KeyboardEventArgs args)
		{
			bool selection_changed = false;

			/* navigation keys */
			if (args.Key == Key.UpArrow) {
				if (cursor > 0) {
					cursor--;
					selection_changed = true;

					if (cursor < first_visible)
						first_visible = cursor;
				}
			}
			else if (args.Key == Key.DownArrow) {
				if (cursor < items.Count - 1) {
					cursor++;
					selection_changed = true;

					if (cursor >= first_visible + num_visible)
						first_visible = cursor - num_visible + 1;
				}
			}

			if (selection_changed) {
				Invalidate ();
				if (SelectionChanged != null)
					SelectionChanged (cursor);
			}
		}
Exemplo n.º 3
0
 public override void OnKeyboardDown(CGameEngine game, KeyboardEventArgs e)
 {
     switch (e.Key) {
         case Key.Escape:
         case Key.Q:
             Events.QuitApplication();
             break;
         case Key.UpArrow:
             m_CurrentMap.Avatar.moveup = true;
             break;
         case Key.DownArrow:
             m_CurrentMap.Avatar.movedown = true;
             break;
         case Key.LeftArrow:
             m_CurrentMap.Avatar.moveleft = true;
             break;
         case Key.RightArrow:
             m_CurrentMap.Avatar.moveright = true;
             break;
         case Key.F5:
             Video.Screen.SaveBmp("screenshot.bmp");
             break;
         case Key.Backspace:
             for (int i = 0; i < 10; i++)
                 m_CurrentMap.Actors.AddLast(new CActorCivilian(m_CurrentMap, 26, 13));
             m_CurrentMap.Actors.AddLast(new CActorMonster(m_CurrentMap, 15, 15));
             break;
         case Key.Space:
             int top = m_CurrentMap.Avatar.Top;
             int left = m_CurrentMap.Avatar.Left;
             m_CurrentMap.Weapons.AddLast(new CActorBullet(m_CurrentMap, left, top, m_CurrentMap.Avatar.Direction));
             break;
     }
 }
Exemplo n.º 4
0
        public override void DoKeyDown(SdlDotNet.Input.KeyboardEventArgs e)
        {
            base.DoKeyDown(e);
            if (SelectedMenuIndex == 4)
            {
                if (Items[4].Options[Items[4].SelectedOptionIndex] == "N/A")
                {
                    return;
                }
                if (Items[4].SelectedOptionIndex < Items[4].Options.Count)
                {
                    inputString = Items[4].Options[Items[4].SelectedOptionIndex];
                }
                else
                {
                    inputString = "";
                }
                switch (e.Key)
                {
                case SdlDotNet.Input.Key.A:
                case SdlDotNet.Input.Key.P:
                case SdlDotNet.Input.Key.Z:
                case SdlDotNet.Input.Key.L:
                case SdlDotNet.Input.Key.G:
                case SdlDotNet.Input.Key.I:
                case SdlDotNet.Input.Key.T:
                case SdlDotNet.Input.Key.Y:
                case SdlDotNet.Input.Key.E:
                case SdlDotNet.Input.Key.O:
                case SdlDotNet.Input.Key.X:
                case SdlDotNet.Input.Key.U:
                case SdlDotNet.Input.Key.K:
                case SdlDotNet.Input.Key.S:
                case SdlDotNet.Input.Key.V:
                case SdlDotNet.Input.Key.N:
                {
                    if (inputString.Length < 8)
                    {
                        inputString += e.Key.ToString();

                        Items[4].Options[Items[4].SelectedOptionIndex] = inputString;
                        UpdateValues(inputString);
                    }
                    break;
                }

                case Key.Backspace:
                {
                    if (inputString.Length > 0)
                    {
                        inputString = inputString.Substring(0, inputString.Length - 1);

                        Items[4].Options[Items[4].SelectedOptionIndex] = inputString;
                        UpdateValues(inputString);
                    }
                    break;
                }
                }
            }
        }
Exemplo n.º 5
0
        //indien we een toets indrukken
        private void Events_KeyboardDown(object sender, SdlDotNet.Input.KeyboardEventArgs e)
        {
            if (!dead && !win)
            {
                if (!up)
                {
                    down = true; //nodig om continu een downforce te hebben, zodat mario valt wanneer hij niet meer op een blok staat en niet aan het springen is
                }

                if (e.Key == leftKey)
                {
                    left  = true;
                    Image = imageWalkLeft;
                }
                if (e.Key == rightKey)
                {
                    right = true;
                    Image = imageWalkRight;
                }
                if (upEnable) // nodig om geen jump in midair te kunnen starten
                {
                    if (e.Key == upKey)
                    {
                        down = false; //indien we gaan springen moet de downforce af, zodat we in de lucht kunnen springen
                        up   = true;
                    }
                }
            }
        }
Exemplo n.º 6
0
 //Handles keyboard events. 
 // The 'Escape' and 'Q'keys will cause the app to exit
 private void KeyboardDown(object sender, KeyboardEventArgs e)
 {
     if (e.Key == Key.Escape || e.Key == Key.Q)
     {
         Events.QuitApplication();
     }
 }
Exemplo n.º 7
0
    void Events_KeyboardUp(object sender, SdlDotNet.Input.KeyboardEventArgs e)
    {
        //if (e.Key == SdlDotNet.Input.Key.One)
        //  Game.GuiManager.GetFace("mainScreen").Controls[0].MouseClick.Invoke(new MouseClickEventArgument { X = 23, MouseButton = SdlDotNet.Input.MouseButton.PrimaryButton });

        if (e.Key == SdlDotNet.Input.Key.Space)
        {
            if (Game.GameScreenManager.CurrentGameScreen == Game.GameScreenManager["earthCity"])
            {
                ChangeGamescreen("intro");
            }
            else
            {
                ChangeGamescreen("earthCity");
            }
        }
        // Go to the test screen on Home
        else if (e.Key == SdlDotNet.Input.Key.Home)
        {
            ChangeGamescreen("testScreen");
        }
        else if (e.Key == SdlDotNet.Input.Key.Pause)
        {
            Game.SimulationRunning = !Game.SimulationRunning;
        }
    }
Exemplo n.º 8
0
 private void KeyboardDown(object sender, KeyboardEventArgs e)
 {
     // Check if the key pressed was a Q or Escape
     if (e.Key == Key.Escape || e.Key == Key.Q)
     {
         Events.QuitApplication();
     }
 }
Exemplo n.º 9
0
 private void Events_KeyboardDown(object sender, KeyboardEventArgs e)
 {
     switch (e.Key)
     {
         case Key.Escape:
         case Key.Q:
             Events.QuitApplication();
             break;
     }
 }
Exemplo n.º 10
0
 //indien we een toets loslaten
 private void Events_KeyboardUp(object sender, SdlDotNet.Input.KeyboardEventArgs e)
 {
     if (e.Key == leftKey)
     {
         left = false;
     }
     if (e.Key == rightKey)
     {
         right = false;
     }
 }
Exemplo n.º 11
0
 public override void OnKeyboardDown(CGameEngine game, KeyboardEventArgs e)
 {
     switch (e.Key) {
         case Key.Escape:
         case Key.Q:
             Events.QuitApplication();
             break;
         case Key.Space:
             game.ChangeState(CPlayState.Instance());
             break;
     }
 }
Exemplo n.º 12
0
 public void setDirection(KeyboardEventArgs key)
 {
     switch (key.Key) {
         case Key.UpArrow:
             m_direction = ActorDirection.Up;
             break;
         case Key.DownArrow:
             m_direction = ActorDirection.Down;
             break;
         case Key.LeftArrow:
             m_direction = ActorDirection.Left;
             break;
         case Key.RightArrow:
             m_direction = ActorDirection.Right;
             break;
     }
 }
Exemplo n.º 13
0
 public override void OnKeyboardUp(CGameEngine game, KeyboardEventArgs e)
 {
     switch (e.Key) {
         case Key.UpArrow:
             m_CurrentMap.Avatar.moveup = false;
             break;
         case Key.DownArrow:
             m_CurrentMap.Avatar.movedown = false;
             break;
         case Key.LeftArrow:
             m_CurrentMap.Avatar.moveleft = false;
             break;
         case Key.RightArrow:
             m_CurrentMap.Avatar.moveright = false;
             break;
     }
 }
 public static void OnKeyDown(SdlInput.KeyboardEventArgs e)
 {
     //if (e.Key == SdlInput.Key.Escape) {
     //    if (Windows.WindowSwitcher.GameWindow.MenuManager.Visible && Windows.WindowSwitcher.GameWindow.MenuManager.HasModalMenu == false) {
     //        Windows.WindowSwitcher.GameWindow.MapViewer.Focus();
     //        Windows.WindowSwitcher.GameWindow.MenuManager.Visible = false;
     //        Windows.WindowSwitcher.GameWindow.MenuManager.CloseOpenMenus();
     //    }
     //} else if (e.Key == SdlInput.Key.F11) {
     //    Logic.Graphics.SurfaceManager.SaveSurface(SdlDotNet.Graphics.Video.Screen, IO.Paths.StartupPath + "Screenshot.png");
     //} else {
     if (Windows.WindowSwitcher.GameWindow.MenuManager.Visible)
     {
         Windows.WindowSwitcher.GameWindow.MenuManager.HandleKeyDown(e);
     }
     //}
 }
Exemplo n.º 15
0
 /// <summary>
 /// キー処理(イベント)
 /// </summary>
 /// <param name="e"></param>
 public void ProcKeyEvent(SdlDotNet.Input.KeyboardEventArgs e)
 {
     if (e != null)
     {
         if (_onAlert)
         {
             if (e.Key == Key.Return)
             {
                 SetAlert(false, "");
             }
         }
         else
         {
             int idx = procKeyEvent(e.Key);
             procMenu(idx);
         }
     }
 }
 public static void OnKeyUp(SdlInput.KeyboardEventArgs e)
 {
     if (e.Key == SdlInput.Key.Escape)
     {
         if (Windows.WindowSwitcher.GameWindow.MenuManager.Visible && Windows.WindowSwitcher.GameWindow.MenuManager.HasModalMenu == false)
         {
             Windows.WindowSwitcher.GameWindow.MapViewer.Focus();
             Windows.WindowSwitcher.GameWindow.MenuManager.Visible = false;
             Windows.WindowSwitcher.GameWindow.MenuManager.CloseOpenMenus();
         }
     }
     else if (e.Key == SdlInput.Key.F11)
     {
         if (System.IO.Directory.Exists(IO.Paths.StartupPath + "Screenshots") == false)
         {
             System.IO.Directory.CreateDirectory(IO.Paths.StartupPath + "Screenshots");
         }
         int openScreenshot = -1;
         for (int i = 1; i < Int32.MaxValue; i++)
         {
             if (System.IO.File.Exists(IO.Paths.StartupPath + "Screenshots/Screenshot" + i + ".png") == false)
             {
                 openScreenshot = i;
                 break;
             }
         }
         if (openScreenshot > -1)
         {
             Logic.Graphics.SurfaceManager.SaveSurface(SdlDotNet.Graphics.Video.Screen, IO.Paths.StartupPath + "Screenshots/Screenshot" + openScreenshot + ".png");
             ExpKit.Modules.kitChat chat = (ExpKit.Modules.kitChat)Windows.WindowSwitcher.ExpKit.KitContainer.ModuleSwitcher.FindKitModule(Enums.ExpKitModules.Chat);
             if (chat != null)
             {
                 chat.AppendChat("Screenshot #" + openScreenshot + " saved!", System.Drawing.Color.Yellow);
             }
         }
     }
     else
     {
         if (Windows.WindowSwitcher.GameWindow.MenuManager.Visible)
         {
             Windows.WindowSwitcher.GameWindow.MenuManager.HandleKeyUp(e);
         }
     }
 }
Exemplo n.º 17
0
		public void KeyboardDown (KeyboardEventArgs args)
		{
			bool changed = false;

			/* navigation keys */
			if (args.Key == Key.LeftArrow) {
				if (cursor > 0) cursor--;
			}
			else if (args.Key == Key.RightArrow) {
				if (cursor < value.Length) cursor++;
			}
			else if (args.Key == Key.Home) {
				cursor = 0;
			}
			else if (args.Key == Key.End) {
				cursor = value.Length;
			}
			/* keys that modify the text */
			else if (args.Key == Key.Backspace) {
				if (value.Length > 0) {
					value = value.Remove (cursor-1, 1);
					cursor--;
					changed = true;
				}
			}
			else {
				char[] cs = Encoding.ASCII.GetChars (new byte[] {(byte)args.Key});
				foreach (char c in cs) {
					if (!Char.IsLetterOrDigit (c) && c != ' ')
						continue;
					char cc;
					if ((args.Mod & (ModifierKeys.RightShift | ModifierKeys.LeftShift)) != 0)
						cc = Char.ToUpper (c);
					else
						cc = c;
					value.Insert (cursor++, cc);
					changed = true;
				}
				changed = true;
			}

			if (changed)
				Text = Value;
		}
Exemplo n.º 18
0
 private void Events_KeyboardDown(object sender, SdlDotNet.Input.KeyboardEventArgs e)
 {
     //Deze dienen voor te checken of dat de knoppen van het toetsenbord zijn ingedrukt
     if (e.Key == SdlDotNet.Input.Key.LeftArrow)
     {
         left = true;
     }
     if (e.Key == SdlDotNet.Input.Key.RightArrow)
     {
         right = true;
     }
     if (e.Key == SdlDotNet.Input.Key.UpArrow)
     {
         Charge = true;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad1)
     {
         tellerChargePlayer = 0;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad2)
     {
         tellerChargePlayer = 0;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad3)
     {
         tellerChargePlayer = 0;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad4)
     {
         tellerChargePlayer = 0;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad5)
     {
         tellerChargePlayer = 0;
     }
     if (Jump != true)
     {
         if (e.Key == SdlDotNet.Input.Key.Space && fall == false)
         {
             Jump  = true;
             force = G;
         }
     }
 }
Exemplo n.º 19
0
 private void keyPress(object sender, KeyboardEventArgs k)
 {
     if (GameOver == true)
     {
         if (Win)
         {
             Win = false;
         }
         player = new MainBall();
         for (int i = enemy.Count - 1; i >= 0; i--)
         {
             enemy.Remove(enemy[i]);
         }
         GameOver = false;
     }
     if (k.Key == Key.P)
     {
         if (Pause)
         {
             Pause = false;
         }
         else
         {
             Pause = true;
         }
     }
     if (k.Key == Key.RightArrow)
     {
         rightArrow = true;
     }
     if (k.Key == Key.LeftArrow)
     {
         leftArrow = true;
     }
     if (k.Key == Key.UpArrow)
     {
         upArrow = true;
     }
     if (k.Key == Key.DownArrow)
     {
         downArrow = true;
     }
 }
Exemplo n.º 20
0
 private void KeyboardDownEvent(object sender, SdlDotNet.Input.KeyboardEventArgs keyboard)
 {
     if (isChangingName)
     {
         if (keyboard.Key == Key.Return)
         {
             userName       = userName.Remove(userName.Length - 1);
             isChangingName = false;
             gameInfo.TopTenNames[gameInfo.Place + (gameInfo.GameMode * 10 - 10)] = userName;
             gameInfo.Place = -1;
             return;
         }
         else if (keyboard.Key == Key.Backspace)
         {
             if (userName.Length < 2)
             {
                 return;
             }
             userName  = userName.Remove(userName.Length - 2);
             userName += "_";
         }
         else if (keyboard.Key == Key.Space && userName.Length <= 20)
         {
             userName = userName.Insert(userName.Length - 1, " ");
         }
         else if ((keyboard.Key.ToString().Length == 1) &&
                  (Char.IsLetter(keyboard.Key.ToString()[0])) &&
                  userName.Length <= 20)
         {
             if ((keyboard.Mod & ModifierKeys.RightShift) != 0 || (keyboard.Mod & ModifierKeys.LeftShift) != 0)
             {
                 userName = userName.Insert(userName.Length - 1,
                                            keyboard.KeyboardCharacter.ToUpper(CultureInfo.CurrentCulture));
             }
             else
             {
                 userName = userName.Insert(userName.Length - 1, keyboard.KeyboardCharacter);
             }
         }
         gameInfo.TopTenNames[gameInfo.Place + (gameInfo.GameMode * 10 - 10)] = userName;
     }
 }
Exemplo n.º 21
0
 public override void DoKeyDown(SdlDotNet.Input.KeyboardEventArgs e)
 {
     if (!lockKeys)
     {
         base.DoKeyDown(e);
     }
     else
     {
         lockKeys = false;
         if (e.Key != SdlDotNet.Input.Key.Return)
         {
             Items[SelectedMenuIndex].Options.Clear();
             Items[SelectedMenuIndex].Options.Add(e.Key.ToString());
         }
         else
         {
             // Cancel
             Items[SelectedMenuIndex].Options.Clear();
             Items[SelectedMenuIndex].Options.Add(orginal);
         }
     }
 }
Exemplo n.º 22
0
 void Events_KeyboardUp(object sender, SdlDotNet.Input.KeyboardEventArgs e)
 {
     //Deze dienen voor te checken of dat de knoppen van het toetsenbord zijn losgelaten en dan zeggen dat die aanvallen true zijn
     Charge = Jump = false;
     if (e.Key == SdlDotNet.Input.Key.LeftArrow)
     {
         left = false;
     }
     if (e.Key == SdlDotNet.Input.Key.RightArrow)
     {
         right = false;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad1 /*&& SuperpowerShotCharge == true*/)
     {
         Shot     = true;
         AnimShot = true;
         Ball     = true;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad4 && SuperpowerCharge == true)
     {
         Superpower     = true;
         AnimSuperpower = true;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad5 && SuperpowerSecondCharge == true)
     {
         SuperpowerSecond     = true;
         AnimSuperpowerSecond = true;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad2 && SuperpowerMeleeCharge == true)
     {
         melee     = true;
         Animmelee = true;
     }
     if (e.Key == SdlDotNet.Input.Key.Keypad3 && SuperpowerKickCharge == true)
     {
         kick     = true;
         Animkick = true;
     }
 }
Exemplo n.º 23
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void KeyboardDown(object sender, KeyboardEventArgs e)
 {
     if (e.Key == Key.Escape || e.Key == Key.Q)
     {
         Events.QuitApplication();
     }
     else if (e.Key == Key.UpArrow)
     {
         eventManager.Publish(new EntityMoveRequestEventArgs(Direction.Up));
     }
     else if (e.Key == Key.DownArrow)
     {
         eventManager.Publish(new EntityMoveRequestEventArgs(Direction.Down));
     }
     else if (e.Key == Key.LeftArrow)
     {
         eventManager.Publish(new EntityMoveRequestEventArgs(Direction.Left));
     }
     else if (e.Key == Key.RightArrow)
     {
         eventManager.Publish(new EntityMoveRequestEventArgs(Direction.Right));
     }
 }
Exemplo n.º 24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public override void Update(KeyboardEventArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            switch (args.Key)
            {
                // the =Down trick works quite well
                case Key.LeftArrow:
                    left = args.Down;
                    break;

                case Key.RightArrow:
                    right = args.Down;
                    break;

                case Key.UpArrow:
                    if (args.Down && !falling)
                    {
                        jump = true;
                    }
                    else if (!args.Down)
                    {
                        jump = false;
                        falling = true;
                    }
                    break;
                case Key.Space:
                    fire = args.Down;
                    break;
            }
        }
Exemplo n.º 25
0
        private void KeyUp(object sender, KeyboardEventArgs e)
        {
            if (_ChatBoxActive)
             {
            return;
             }

             switch (e.Key)
             {
            case Key.W:
            case Key.S:
               _Player.MoveZ = 0;
               break;
            case Key.A:
            case Key.D:
               _Player.MoveX = 0;
               break;
            case Key.Q:
               break;
            case Key.R:
               break;
            case Key.Space:
            case Key.LeftControl:
               _Player.MoveY = 0;
               break;
             }
        }
Exemplo n.º 26
0
        private void KeyDown(object sender, KeyboardEventArgs e)
        {
            if (_ChatBoxActive)
             {
            if (e.Key == Key.Backspace && _CurrentChatMessage.Length > 0)
            {
               _CurrentChatMessage = _CurrentChatMessage.Substring(0, _CurrentChatMessage.Length - 1);
            }
            else if (e.Key == Key.Escape)
            {
               _ChatBoxActive = false;
               _CurrentChatMessage = string.Empty;
            }
            else if (e.Key == Key.Return)
            {
               _ChatBoxActive = false;
               if (!string.IsNullOrEmpty(_CurrentChatMessage))
               {
                  _ChatHistory.Add(Player.PlayerName + ": " + _CurrentChatMessage);
                  WorldHelper.ClientToServerProvider.ChatMessage(Client.Connection, _CurrentChatMessage);
                  _CurrentChatMessage = string.Empty;
               }
            }
            else if ((int)e.Key >= 32 &&
                     (int)e.Key <= 126 &&
                     _CurrentChatMessage.Length < 200)
            {
               _CurrentChatMessage += HandleTextKey(e);
            }
             }
             else
             {
            switch (e.Key)
            {
               case Key.W:
                  _Player.MoveZ = -1;
                  break;
               case Key.S:
                  _Player.MoveZ = 1;
                  break;
               case Key.A:
                  _Player.MoveX = -1;
                  break;
               case Key.D:
                  _Player.MoveX = 1;
                  break;
               case Key.G:
                  _MouseGrab = !_MouseGrab;
                  Mouse.ShowCursor = !_MouseGrab;
            #if DIAG
               DiagnosticsManager.WriteMessage("Mousegrab set to {0}", _MouseGrab);
            #endif
                  break;
               case Key.F:
                  ToggleFog();
                  break;
               case Key.R:
                  NextMaterial(false);
                  break;
               case Key.T:
                  NextMaterial(true);
                  break;
               case Key.One:
               case Key.Two:
               case Key.Three:
               case Key.Four:
               case Key.Five:
               case Key.Six:
               case Key.Seven:
               case Key.Eight:
               case Key.Nine:
               case Key.Zero:
                  _Player.SelectedMaterial = (ushort)((int)e.Key - 46);
                  break;
               case Key.Space:
                  _Player.MoveY = 1;
                  break;
               case Key.LeftControl:
                  _Player.MoveY = -1;
                  break;
               case Key.Return:
                  _ChatBoxActive = true;
                  break;
               case Key.Escape:
                  StopTimer();
                  TextureManager.Instance.UnloadTextures(false);

                  if (IsSinglePlayer)
                  {
                     Stop();
                  }
                  else
                  {
                     WorldHelper.ClientToServerProvider.DisconnectingNotification(_Client.Connection);
                     _Client.Connection.Disconnect("Player is quitting the client");
                  }
                  break;
               case Key.F1:
                  _ShowHud = !_ShowHud;
                  break;
               case Key.F3:
                  DiagnosticsManager.ShowHideDiagnosticsWindow();
                  break;
               case Key.F6:
                  Save(false);
                  break;
               case Key.F9:
                  // load
                  break;
               case Key.F11:
                  StopTimer();

                  // Toggle fullscreen
                  if (!_Screen.FullScreen)
                  {
                     _Screen = Video.SetVideoMode(_Width, _Height, true, true, true);
                     WindowAttributes();
                  }
                  else
                  {
                     _Screen = Video.SetVideoMode(_Width, _Height, true, true);
                     WindowAttributes();
                  }
                  Reshape();

            #if DIAG
                  DiagnosticsManager.WriteMessage("Fullscreen set to {0}", _Screen.FullScreen);
            #endif
                  break;
            }
             }
        }
Exemplo n.º 27
0
		private void KeyDown(object sender, KeyboardEventArgs e)
		{
			switch (e.Key) 
			{
				case Key.Escape:
					// Will stop the app loop
					Events.QuitApplication();
					break;
				default:
					break;
			}
		}
Exemplo n.º 28
0
        public static void OnKeyUp(SdlInput.KeyboardEventArgs e)
        {
            if (e.Key == IO.ControlLoader.UpKey)
            {
                MoveUp = false;
            }
            else if (e.Key == IO.ControlLoader.DownKey)
            {
                MoveDown = false;
            }
            else if (e.Key == IO.ControlLoader.LeftKey)
            {
                MoveLeft = false;
            }
            else if (e.Key == IO.ControlLoader.RightKey)
            {
                MoveRight = false;
            }
            else if (e.Key == IO.ControlLoader.AttackKey)
            {
                Attacking = false;
            }
            switch (e.Key)
            {
            case SdlInput.Key.Escape: {
                if (!Windows.WindowSwitcher.GameWindow.MenuManager.Visible)
                {
                    Windows.WindowSwitcher.GameWindow.MenuManager.Visible = true;
                    Windows.WindowSwitcher.GameWindow.MenuManager.Focus();
                    Menus.MenuSwitcher.ShowMainMenu();
                    Music.Music.AudioPlayer.PlaySoundEffect("beep2.wav");
                }
                else
                {
                    if (Windows.WindowSwitcher.GameWindow.MenuManager.HasModalMenu == false)
                    {
                        Windows.WindowSwitcher.GameWindow.MapViewer.Focus();
                        Windows.WindowSwitcher.GameWindow.MenuManager.Visible = false;
                        Windows.WindowSwitcher.GameWindow.MenuManager.CloseOpenMenus();
                    }
                }
            }
            break;

            //case SdlInput.Key.F5: {
            //        if (!Windows.WindowSwitcher.GameWindow.MenuManager.Visible) {
            //            Windows.WindowSwitcher.GameWindow.MenuManager.Visible = true;
            //            Windows.WindowSwitcher.GameWindow.MenuManager.Focus();
            //            Menus.MenuSwitcher.ShowGuildMenu();
            //            Music.Music.AudioPlayer.PlaySoundEffect("beep2.wav");
            //        }
            //    }
            //    break;
            case SdlInput.Key.Home: {
                TurnPlayer();
            }
            break;

            case SdlInput.Key.End: {
                if (Globals.Tick > PlayerManager.MyPlayer.GetTimer + 250)
                {
                    PlayerManager.MyPlayer.GetTimer = Globals.Tick;
                    Messenger.SendRefresh();
                }
            }
            break;

            case SdlInput.Key.Return: {
                if (PlayerManager.MyPlayer.Y - 1 > -1 && PlayerManager.MyPlayer.X >= 0 && PlayerManager.MyPlayer.X <= Maps.MapHelper.ActiveMap.MaxX && PlayerManager.MyPlayer.Y >= 0 && PlayerManager.MyPlayer.Y <= Maps.MapHelper.ActiveMap.MaxY)
                {
                    if (Maps.MapHelper.ActiveMap.Tile[PlayerManager.MyPlayer.X, PlayerManager.MyPlayer.Y - 1].Type == Enums.TileType.Sign && PlayerManager.MyPlayer.Direction == Enums.Direction.Up)
                    {
                        ExpKit.Modules.kitChat chat = (ExpKit.Modules.kitChat)WindowSwitcher.ExpKit.KitContainer.ModuleSwitcher.FindKitModule(Enums.ExpKitModules.Chat);
                        if (chat != null)
                        {
                            chat.AppendChat("The sign reads:\n", new SdlDotNet.Widgets.CharRenderOptions(Color.Black));
                            if (!string.IsNullOrEmpty(Maps.MapHelper.ActiveMap.Tile[PlayerManager.MyPlayer.X, PlayerManager.MyPlayer.Y - 1].String1.Trim()))
                            {
                                chat.AppendChat(Maps.MapHelper.ActiveMap.Tile[PlayerManager.MyPlayer.X, PlayerManager.MyPlayer.Y - 1].String1.Trim() + "\n", new SdlDotNet.Widgets.CharRenderOptions(Color.Gray));
                            }
                            if (!string.IsNullOrEmpty(Maps.MapHelper.ActiveMap.Tile[PlayerManager.MyPlayer.X, PlayerManager.MyPlayer.Y - 1].String2.Trim()))
                            {
                                chat.AppendChat(Maps.MapHelper.ActiveMap.Tile[PlayerManager.MyPlayer.X, PlayerManager.MyPlayer.Y - 1].String2.Trim() + "\n", new SdlDotNet.Widgets.CharRenderOptions(Color.Gray));
                            }
                            if (!string.IsNullOrEmpty(Maps.MapHelper.ActiveMap.Tile[PlayerManager.MyPlayer.X, PlayerManager.MyPlayer.Y - 1].String3.Trim()))
                            {
                                chat.AppendChat(Maps.MapHelper.ActiveMap.Tile[PlayerManager.MyPlayer.X, PlayerManager.MyPlayer.Y - 1].String3.Trim() + "\n", new SdlDotNet.Widgets.CharRenderOptions(Color.Gray));
                            }
                        }
                    }
                }
                Pickup = false;
            }
            break;
            }
        }
Exemplo n.º 29
0
 protected override void proc(KeyboardEventArgs e) { }
Exemplo n.º 30
0
        private void KeyDown(object sender, KeyboardEventArgs e)
        {
            switch (e.Key)
            {
                // L, F and G.
                case Key.L:
                    this.Light = !this.Light;
                    if (this.Light)
                    {
                        Gl.glEnable(Gl.GL_LIGHTING);
                    }
                    else
                    {
                        Gl.glDisable(Gl.GL_LIGHTING);
                    }
                    break;
                case Key.F:
                    this.Filter += 1;
                    if (this.Filter > 2)
                    {
                        this.Filter = 0;
                    }
                    break;
                case Key.G:
                    this.fogfilter += 1;
                    if (this.fogfilter > 2)
                    {
                        this.fogfilter = 0;
                    }
                    Gl.glFogi(Gl.GL_FOG_MODE, (int)this.fogMode[this.fogfilter]);
                    break;

                // Zoom in cube with Page Up/Down
                case Key.PageUp:
                    this.DepthZ -= 0.02f;
                    break;
                case Key.PageDown:
                    this.DepthZ += 0.02f;
                    break;

                // Rotate cube with arrows.
                case Key.UpArrow:
                    this.XSpeed -= 0.1f;
                    break;
                case Key.DownArrow:
                    this.XSpeed += 0.1f;
                    break;
                case Key.LeftArrow:
                    this.YSpeed -= 0.1f;
                    break;
                case Key.RightArrow:
                    this.YSpeed += 0.1f;
                    break;
            }
        }
Exemplo n.º 31
0
 private void Events_KeyboardUp(object sender, KeyboardEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         //De applicatie wordt afgesloten.
         Events.QuitApplication();
     }
     if (e.Key == Key.S)
     {
         _pressedS = true;
     }
     if (e.Key == Key.R)
     {
         _pressedR = true;
     }
     if (e.Key == Key.I)
     {
         _level.Held.Invincible = true;
     }
 }
Exemplo n.º 32
0
 private void Events_KeyboardDown(object sender, KeyboardEventArgs e)
 {
     switch (e.Key)
     {
         case Key.Escape:
         case Key.Q:
             Events.QuitApplication();
             break;
         /*  case Key.LeftArrow:
         if (this.lastCar != null)
         {
             this.lastCar.Accelerate();
         }
         break;
     case Key.RightArrow:
         if (this.lastCar != null)
         {
             this.lastCar.Deccelerate();
         }
         break;*/
     }
 }
Exemplo n.º 33
0
 static void OnKeyboardDown(KeyboardEventArgs e)
 {
     if (KeyboardDown != null)
     {
         KeyboardDown(instance, e);
     }
 }
Exemplo n.º 34
0
 static void OnKeyboardUp(KeyboardEventArgs e)
 {
     if (KeyboardUp != null)
     {
         KeyboardUp(instance, e);
     }
 }
Exemplo n.º 35
0
		private void keyDown(object sender, KeyboardEventArgs e)
		{
			switch (e.Key)
			{
			case Key.Escape:
			case Key.Q:
				quit(null, null);
				break;
			case Key.One:
				adapter.Input.Tuner.Frequency = (uint)(217.25 * 16); // RTL
				break;
			case Key.Two:
				adapter.Input.Tuner.Frequency = (uint)(294.25 * 16); // Pro7
				break;
			case Key.Three:
				adapter.Input.Tuner.Frequency = (uint)(303.25 * 16); // Super RTL
				break;
			}
		}
Exemplo n.º 36
0
 protected abstract void proc(SdlDotNet.Input.KeyboardEventArgs e);
Exemplo n.º 37
0
        private static void OnKeyDown(object sender, SdlDotNet.Input.KeyboardEventArgs e)
        {
            if (PausedShowMenu)
            {
                Rooms[RoomIndex].DoKeyDown(e);
                if (e.Key == Key.Tab)
                {
                    NesEmu.EmulationPaused = false;
                    PausedShowMenu         = false;
                    Rooms[RoomIndex].OnTabResume();
                }
                return;
            }

            if (e.Key == Key.Escape)
            {
                Quit();
            }
            else if (e.Key == Key.Tab)
            {
                if (!PausedShowMenu)
                {
                    NesEmu.EmulationPaused = true;
                    SelectRoom("main menu");
                    PausedShowMenu = true;
                }
                else
                {
                    NesEmu.EmulationPaused = false;
                    PausedShowMenu         = false;
                }
            }
            else if (e.Key == Key_SwitchFullscreen)
            {
                VIDEO.SwitchFullscreen();
            }
            else if (e.Key == Key_HardReset)
            {
                if (NesEmu.EmulationON)
                {
                    NesEmu.EMUHardReset();
                }
                else
                {
                    if (CurrentGameFile != "")
                    {
                        if (File.Exists(CurrentGameFile))
                        {
                            LoadRom(CurrentGameFile);
                        }
                    }
                }
                VIDEO.WriteNotification("HARD RESET", 120, System.Drawing.Color.Red);
            }
            else if (e.Key == Key_SoftReset)
            {
                NesEmu.EMUSoftReset();
                VIDEO.WriteNotification("SOFT RESET", 120, System.Drawing.Color.LightYellow);
            }
            else if (e.Key == Key_TakeSnap)
            {
                NesEmu.TakeSnapshot();
            }
            else if (e.Key == Key_LoadState)
            {
                NesEmu.LoadState();
            }
            else if (e.Key == Key_SaveState)
            {
                NesEmu.SaveState();
            }
            else if (e.Key == Key_ShutdownEmu)
            {
                NesEmu.EmulationON = false;
            }
            else if (e.Key == Key_StateSlot0)
            {
                NesEmu.UpdateStateSlot(0);
                VIDEO.WriteNotification("STATE SLOT SET TO 0", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot1)
            {
                NesEmu.UpdateStateSlot(1);
                VIDEO.WriteNotification("STATE SLOT SET TO 1", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot2)
            {
                NesEmu.UpdateStateSlot(2);
                VIDEO.WriteNotification("STATE SLOT SET TO 2", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot3)
            {
                NesEmu.UpdateStateSlot(3);
                VIDEO.WriteNotification("STATE SLOT SET TO 3", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot4)
            {
                NesEmu.UpdateStateSlot(4);
                VIDEO.WriteNotification("STATE SLOT SET TO 4", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot5)
            {
                NesEmu.UpdateStateSlot(5);
                VIDEO.WriteNotification("STATE SLOT SET TO 5", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot6)
            {
                NesEmu.UpdateStateSlot(6);
                VIDEO.WriteNotification("STATE SLOT SET TO 6", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot7)
            {
                NesEmu.UpdateStateSlot(7);
                VIDEO.WriteNotification("STATE SLOT SET TO 7", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot8)
            {
                NesEmu.UpdateStateSlot(8);
                VIDEO.WriteNotification("STATE SLOT SET TO 8", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot9)
            {
                NesEmu.UpdateStateSlot(9);
                VIDEO.WriteNotification("STATE SLOT SET TO 9", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_TogglePause)
            {
                NesEmu.EmulationPaused = !NesEmu.EmulationPaused;
            }
            else if (e.Key == Key_ToggleTurbo)
            {
                NesEmu.SpeedLimitterON = !NesEmu.SpeedLimitterON;
            }
            else if (e.Key == Key_RecordSound)
            {
                if (AUDIO.IsRecording)
                {
                    AUDIO.StopRecord();
                }
                else
                {
                    AUDIO.Record();
                }
            }
            else if (e.Key == Key_ToggleFrameSkip)
            {
                Settings.FrameSkipEnabled = !Settings.FrameSkipEnabled;
                NesEmu.SetupFrameSkip(Settings.FrameSkipEnabled, (byte)Settings.FrameSkipCount);

                VIDEO.WriteNotification(Settings.FrameSkipEnabled ? "Frame skip enabled." : "Frame skip disabled.", 120, System.Drawing.Color.White);
            }
            else if (e.Key == Key.KeypadPlus || e.Key == Key.Plus)
            {
                if (AUDIO.Volume + 10 < 100)
                {
                    AUDIO.Volume += 10;
                }
                else
                {
                    AUDIO.Volume = 100;
                }
                VIDEO.WriteNotification("VOLUME " + AUDIO.Volume + " %", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key.Minus || e.Key == Key.KeypadMinus)
            {
                if (AUDIO.Volume - 10 > 0)
                {
                    AUDIO.Volume -= 10;
                }
                else
                {
                    AUDIO.Volume = 0;
                }
                VIDEO.WriteNotification("VOLUME " + AUDIO.Volume + " %", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_ShowGameStatus)
            {
                VIDEO.ShowGameStatus();
            }
        }
Exemplo n.º 38
0
		static void Events_KeyboardUp(object sender, KeyboardEventArgs e) {
			if (e.Key == Key.Space) {
				if (!GameStarted) {
					GameStarted = true;
				} else {
					if (!playerFish.IsAlive) {
						playerFish = new PlayerFish();	// new player needed
						GameStarted = false;   			// reset game
						DeathTimer = 0;		   			// reset death stats
					}
				}
			}
			if (e.Key == Key.One) {
				if (playerFish.powerUps[PowerUpItem.PowerUpTypes.growthpill] > 0 && playerFish.GrowthSize == 1) {
					powerUpTimer = Timer.TicksElapsed;
					playerFish.powerUps[PowerUpItem.PowerUpTypes.growthpill] -= 1;
					playerFish.GrowthSize = 6;
				}
				
			}
			if (e.Key == Key.Two) {
				if (playerFish.powerUps[PowerUpItem.PowerUpTypes.timestop] > 0 && !isTimeStopped) {
					playerFish.powerUps[PowerUpItem.PowerUpTypes.timestop] -= 1;
					isTimeStopped = true;
					timeStopCounter = Timer.TicksElapsed;
					
				}
			}
		}
Exemplo n.º 39
0
        private void KeyDown(object sender, KeyboardEventArgs e)
        {
            switch (e.Key)
            {
                case Key.Escape:
                    //Fire event to stop the application loop
                    Events.QuitApplication();
                    Events_Quit(this,new QuitEventArgs());
                    break;
                case Key.F1:
                    ToggleFullscreen();         
                    break;
                case Key.F2:
                    //Toggle backface culling
                    if (m_backfaceCulling == false)
                    {
                        Gl.glEnable(Gl.GL_CULL_FACE);
                        Gl.glCullFace(Gl.GL_BACK);
                        m_backfaceCulling = true;
                    }
                    else if (m_backfaceCulling == true)
                    {
                        Gl.glDisable(Gl.GL_CULL_FACE);
                        m_backfaceCulling = false;
                    }
                    break;
                case Key.F3:
                    {
                        if (m_walkBounce)
                        {
                            m_walkBounce = false;
                        }
                        else
                        {
                            m_walkBounce = true;
                        }
                        break;
                    }
                case Key.F4:
                    {
                        if (m_drawCollisionModels)
                        {
                            m_drawCollisionModels = false;
                        }
                        else
                        {
                            m_drawCollisionModels = true;
                        }
                        break;
                    }
                case Key.F5:
                    {
                        if (m_lightingEnabled)
                        {
                            m_lightingEnabled = false;
                            Gl.glDisable(Gl.GL_LIGHTING);
                        }
                        else
                        {
                            m_lightingEnabled = true;
                            Gl.glEnable(Gl.GL_LIGHTING);
                        }
                        break;
                    }

                case Key.F6:
                    {
                        if (m_drawAvatar3D)
                            m_drawAvatar3D = false;
                        else m_drawAvatar3D = true;
                        break;
                    }
                case Key.F7:
                    {
                        if (m_drawAvatar3D)
                        {
                            if (avatar3D.DrawJoints)
                                avatar3D.DrawJoints = false;
                            else avatar3D.DrawJoints = true;
                        }
                        break;
                    }
                case Key.F11:
                    {
                        CaptureAndSendToTaskDesignerScreenShot();
                        break;
                    }
                case Key.F12:
                    {
                        if (m_frmTaskDesigner_0 != null)
                        {
                            m_frmTaskDesigner_0.Show();
                        }
                        break;
                    }
                case Key.Backspace:
                    {
                        InitialiseScene();
                        break;
                    }
                case Key.A:
                    {
                        //avatar.ViewAngleX += 0.2f;
                        break;
                    }
                case Key.D:
                    {
                        //avatar.ViewAngleX -= 0.2f;
                        break;
                    }
                case Key.S:
                    {
                        //avatar.ViewAngleY -= 0.2f;
                        break;
                    }
                case Key.W:
                    {
                        //avatar.ViewAngleY += 0.2f;
                        break;
                    }
                case Key.Z:
                    {
                        //avatar.ViewDistance += 0.02f;
                        break;
                    }
                case Key.X:
                    {
                        //avatar.ViewDistance -= 0.02f;
                        break;
                    }
                case Key.Space:
                    {
                        m_drawAvatar = !m_drawAvatar;
                        break;
                    }

                case Key.UpArrow:
                    {
                        //avatar.Velocity.X = (float)Math.Sin(avatar.RotationAngle * (3.14159265 / 180)) * 0.07f;
                        avatar.Velocity.Z = -(float)Math.Cos(avatar.RotationAngle * (3.14159265 / 180)) * 0.1f;

                        //Add bounce to walking if set
                        if (m_walkBounce)
                        {
                            avatar.WalkBounceAngle += 10.0f;
                            avatar.Velocity.Y = (float)Math.Sin(avatar.WalkBounceAngle * (3.14159265 / 180)) * 0.02f;
                        }                        

                        break;
                    }
                case Key.DownArrow:
                    {
                        //avatar.Velocity.X = -(float)Math.Sin(avatar.RotationAngle * (3.14159265 / 180)) * 0.07f;
                        avatar.Velocity.Z = (float)Math.Cos(avatar.RotationAngle * (3.14159265 / 180)) * 0.1f;

                        //Add bounce to walking if set
                        if (m_walkBounce)
                        {
                            avatar.WalkBounceAngle += 10.0f;
                            avatar.Velocity.Y = -(float)Math.Sin(avatar.WalkBounceAngle * (3.14159265 / 180)) * 0.02f;
                        }

                        break;
                    }
                case Key.LeftArrow:
                    {
                        //avatar.RotationAngle += 2.0f;
                        
                        //Move left
                        //avatar.Velocity.X = 0.07f;

                        //rotAngle += 2.0f;
                    }
                    break;
                case Key.RightArrow:
                    {
                        //avatar.RotationAngle -= 2.0f;
                        
                        //Move right
                        //avatar.Velocity.X = -0.07f;

                        //rotAngle -= 2.0f;
                        break;
                    }
                case Key.O:
                        {
                            _videoPlaybackSpeed = _videoPlaybackSpeed + 5;
                            break;
                        }
                case Key.P:
                        {
                            if (_videoPlaybackSpeed - 5 > 0)
                            {
                                _videoPlaybackSpeed = _videoPlaybackSpeed - 5;
                            }
                            else
                            {
                                _videoPlaybackSpeed = 5;
                            }

                            break;
                        }
            }


        }
Exemplo n.º 40
0
 private void KeyboardDown(object sender, KeyboardEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         Events.QuitApplication();
     }
     else if (e.Key == Key.Space)
     {
         CreateExplosion();
     }
 }
Exemplo n.º 41
0
 private void Events_KeyboardUp(object sender, KeyboardEventArgs e)
 {
     switch (e.Key)
     {
         case Key.UpArrow:
             avatar.Velocity.Z = 0.0f;
             m_objectsToDraw.MoveAvatarInTaskDesigner(avatar.Z);
             break;
         case Key.DownArrow:
             avatar.Velocity.Z = 0.0f;
             m_objectsToDraw.MoveAvatarInTaskDesigner(avatar.Z);
             break;
         case Key.LeftArrow:
             avatar.Velocity.X = 0.0f;
             break;
         case Key.RightArrow:
             avatar.Velocity.X = 0.0f;
             break;
     }
 }
Exemplo n.º 42
0
 private void OnKeyboardUp(object sender, KeyboardEventArgs e)
 {
     ((CGameState)states.Peek()).OnKeyboardUp(this, e);
 }
Exemplo n.º 43
0
        /// <summary>
        /// 更新処理
        /// </summary>
        /// <param name="e"></param>
        public void Process(SdlDotNet.Input.KeyboardEventArgs e)
        {
            try
            {
                if (_transitionStart)
                {
                    _transitionTime    -= (int)(Environment.TickCount - _prevTransitionTick);
                    _prevTransitionTick = Environment.TickCount;

                    if (_transitionTime <= 0)
                    {
                        SceneTransitionEndEventHandler del = _transitionEndDel;
                        if (del != null)
                        {
                            _transitionStart = false;
                            del();
                        }
                    }
                }
                else
                {
                    ProcKeyEvent(e);

                    proc(e);

                    int idx = -1; bool pressed = false;
                    foreach (Key k in _keys)
                    {
                        if (Keyboard.IsKeyPressed(k))
                        {
                            pressed = true;
                            if (k == _prevPressedKey)
                            {
                                if (Environment.TickCount - _prevPressTick > Constants.Time_ContinuousKeyStart)
                                {
                                    if (Environment.TickCount - _prevContTick >= Constants.Time_ContinuousKeyDiff)
                                    {
                                        _prevContTick = Environment.TickCount;

                                        idx = procKeyEvent(k);
                                        if (idx >= 0)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                _prevPressedKey = k;
                                _prevPressTick  = Environment.TickCount;
                                _prevContTick   = Environment.TickCount;
                            }
                        }
                    }
                    if (!pressed)
                    {
                        _prevPressedKey = Key.Print;
                        _prevPressTick  = Environment.TickCount;
                        _prevContTick   = Environment.TickCount;
                    }

                    procMenu(idx);
                }
            }
            catch (Exception ex)
            {
                SetAlert(true, ex.Message);
            }
        }
Exemplo n.º 44
0
        public static void OnKeyUp(SdlInput.KeyboardEventArgs e)
        {
            if (e.Key == IO.ControlLoader.UpKey)
            {
                MoveUp = false;
            }
            else if (e.Key == IO.ControlLoader.DownKey)
            {
                MoveDown = false;
            }
            else if (e.Key == IO.ControlLoader.LeftKey)
            {
                MoveLeft = false;
            }
            else if (e.Key == IO.ControlLoader.RightKey)
            {
                MoveRight = false;
            }
            else if (e.Key == IO.ControlLoader.AttackKey)
            {
                Attacking = false;
            }
            else if (e.Key == SdlInput.Key.M)
            {
                ScreenRenderer.RenderOptions.MinimapVisible = !ScreenRenderer.RenderOptions.MinimapVisible;
            }
            switch (e.Key)
            {
            case SdlInput.Key.Escape:
            {
                if (!Windows.WindowSwitcher.GameWindow.MenuManager.Visible)
                {
                    Windows.WindowSwitcher.GameWindow.MenuManager.Visible = true;
                    Windows.WindowSwitcher.GameWindow.MenuManager.Focus();
                    Menus.MenuSwitcher.ShowMainMenu();
                    Music.Music.AudioPlayer.PlaySoundEffect("beep2.wav");
                }
                else
                {
                    if (Windows.WindowSwitcher.GameWindow.MenuManager.HasModalMenu == false)
                    {
                        Windows.WindowSwitcher.GameWindow.MapViewer.Focus();
                        Windows.WindowSwitcher.GameWindow.MenuManager.Visible = false;
                        Windows.WindowSwitcher.GameWindow.MenuManager.CloseOpenMenus();
                    }
                }
            }
            break;

            //case SdlInput.Key.F5: {
            //        if (!Windows.WindowSwitcher.GameWindow.MenuManager.Visible) {
            //            Windows.WindowSwitcher.GameWindow.MenuManager.Visible = true;
            //            Windows.WindowSwitcher.GameWindow.MenuManager.Focus();
            //            Menus.MenuSwitcher.ShowGuildMenu();
            //            Music.Music.AudioPlayer.PlaySoundEffect("beep2.wav");
            //        }
            //    }
            //    break;
            case SdlInput.Key.Home:
            {
                TurnPlayer();
            }
            break;

            case SdlInput.Key.End:
            {
                if (Globals.Tick > PlayerManager.MyPlayer.GetTimer + 250)
                {
                    PlayerManager.MyPlayer.GetTimer = Globals.Tick;
                    Messenger.SendRefresh();
                }
            }
            break;

            case SdlInput.Key.Return:
            {
                Pickup = false;
            }
            break;
            }
        }
Exemplo n.º 45
0
        private string HandleTextKey(KeyboardEventArgs e)
        {
            if (e.Key == Key.Space)
             {
            return " ";
             }

             bool capsMod = e.Mod.HasFlag(ModifierKeys.Caps);
             bool shiftMod = (e.Mod.HasFlag(ModifierKeys.LeftShift) || e.Mod.HasFlag(ModifierKeys.RightShift));
             bool textShift = ((capsMod && !shiftMod) || (!capsMod && shiftMod));

             string c = e.KeyboardCharacter;

             // text shift applies only to alpha characters
             if ((int)e.Key >= 97 && (int)e.Key <= 122)
             {
            return (textShift ? c.ToUpper() : c);
             }

             if (shiftMod)
             {
            // other characters are influenced by shift and ignore caps
            if ((int)e.Key == 44 || (int)e.Key == 46 || (int)e.Key == 47)
            {
               return ((char)(e.Key + 16)).ToString();
            }
            else if ((int)e.Key >= 91 && (int)e.Key <= 93)
            {
               return ((char)(e.Key + 32)).ToString();
            }
            else
            {
               switch (e.Key)
               {
                  case Key.One:
                     return "!";
                  case Key.Two:
                     return "@";
                  case Key.Three:
                     return "#";
                  case Key.Four:
                     return "$";
                  case Key.Five:
                     return "%";
                  case Key.Six:
                     return "^";
                  case Key.Seven:
                     return "&";
                  case Key.Eight:
                     return "*";
                  case Key.Nine:
                     return "(";
                  case Key.Zero:
                     return ")";
                  case Key.Minus:
                     return "_";
                  case Key.Equals:
                     return "+";
                  case Key.Semicolon:
                     return ":";
                  case Key.Quote:
                     return "\"";
                  case Key.BackQuote:
                     return "~";
               }
            }
             }

             return c;
        }
Exemplo n.º 46
0
 /// <summary>
 /// Processes the keyboard.
 /// </summary>
 /// <param name="args">Event args</param>
 public virtual void Update(KeyboardEventArgs args)
 {
 }
Exemplo n.º 47
0
        public static void OnKeyDown(SdlInput.KeyboardEventArgs e)
        {
            if (e.Key == IO.ControlLoader.UpKey)
            {
                MoveUp = true;
                MovePlayer(Enums.Direction.Up, false);
            }
            else if (e.Key == IO.ControlLoader.DownKey)
            {
                MoveDown = true;
                MovePlayer(Enums.Direction.Down, false);
            }
            else if (e.Key == IO.ControlLoader.LeftKey)
            {
                MoveLeft = true;
                MovePlayer(Enums.Direction.Left, false);
            }
            else if (e.Key == IO.ControlLoader.RightKey)
            {
                MoveRight = true;
                MovePlayer(Enums.Direction.Right, false);
            }
            else if (e.Key == SdlInput.Key.Return)
            {
                if (!Pickup)
                {
                    PickupItem();
                    Pickup = true;
                }
                //} else if (e.Key == IO.ControlLoader.AttackKey) {
                //    GameProcessor.CheckAttack();
            }
            else if (e.Key == SdlInput.Key.W)
            {
                if (PlayerManager.MyPlayer.Moves[0].MoveNum > -1)
                {
                    SelectedMove = 0;
                }
            }
            else if (e.Key == SdlInput.Key.A)
            {
                if (PlayerManager.MyPlayer.Moves[1].MoveNum > -1)
                {
                    SelectedMove = 1;
                }
            }
            else if (e.Key == SdlInput.Key.S)
            {
                if (PlayerManager.MyPlayer.Moves[2].MoveNum > -1)
                {
                    SelectedMove = 2;
                }
            }
            else if (e.Key == SdlInput.Key.D)
            {
                if (PlayerManager.MyPlayer.Moves[3].MoveNum > -1)
                {
                    SelectedMove = 3;
                }
            }
            else if (e.Key == SdlInput.Key.F)
            {
                if (SelectedMove > -1 && SelectedMove < 4)
                {
                    PlayerManager.MyPlayer.UseMove(SelectedMove);
                }
                else
                {
                    Attacking = true;
                    GameProcessor.CheckAttack();
                }
            }
            else if (e.Key == SdlInput.Key.Z)
            {
                int itemNum = 0;
                if (PlayerManager.MyPlayer.Team[1] != null)
                {
                    itemNum = Players.PlayerManager.MyPlayer.GetInvItemNum(PlayerManager.MyPlayer.Team[0].HeldItemSlot);
                }
                if (itemNum > 0)
                {
                    if ((int)Items.ItemHelper.Items[itemNum].Type < 8 || (int)Items.ItemHelper.Items[itemNum].Type == 15)
                    {
                    }
                    else
                    {
                        if (SdlInput.Keyboard.IsKeyPressed(SdlInput.Key.LeftControl))
                        {
                            Messenger.SendThrowItem(PlayerManager.MyPlayer.Team[0].HeldItemSlot);
                        }
                        else
                        {
                            GameProcessor.CheckUseItem(0, PlayerManager.MyPlayer.Team[0].HeldItemSlot);
                        }
                    }
                }
            }
            else if (e.Key == SdlInput.Key.X)
            {
                int itemNum = 0;
                if (PlayerManager.MyPlayer.Team[1] != null)
                {
                    itemNum = Players.PlayerManager.MyPlayer.GetInvItemNum(PlayerManager.MyPlayer.Team[1].HeldItemSlot);
                }
                if (itemNum > 0)
                {
                    if ((int)Items.ItemHelper.Items[itemNum].Type < 8 || (int)Items.ItemHelper.Items[itemNum].Type == 15)
                    {
                    }
                    else
                    {
                        if (SdlInput.Keyboard.IsKeyPressed(SdlInput.Key.LeftControl))
                        {
                            Messenger.SendThrowItem(PlayerManager.MyPlayer.Team[1].HeldItemSlot);
                        }
                        else
                        {
                            GameProcessor.CheckUseItem(1, PlayerManager.MyPlayer.Team[1].HeldItemSlot);
                        }
                    }
                }
            }
            else if (e.Key == SdlInput.Key.C)
            {
                int itemNum = 0;
                if (PlayerManager.MyPlayer.Team[1] != null)
                {
                    itemNum = Players.PlayerManager.MyPlayer.GetInvItemNum(PlayerManager.MyPlayer.Team[2].HeldItemSlot);
                }
                if (itemNum > 0)
                {
                    if ((int)Items.ItemHelper.Items[itemNum].Type < 8 || (int)Items.ItemHelper.Items[itemNum].Type == 15)
                    {
                    }
                    else
                    {
                        if (SdlInput.Keyboard.IsKeyPressed(SdlInput.Key.LeftControl))
                        {
                            Messenger.SendThrowItem(PlayerManager.MyPlayer.Team[2].HeldItemSlot);
                        }
                        else
                        {
                            GameProcessor.CheckUseItem(2, PlayerManager.MyPlayer.Team[2].HeldItemSlot);
                        }
                    }
                }
            }
            else if (e.Key == SdlInput.Key.V)
            {
                int itemNum = 0;
                if (PlayerManager.MyPlayer.Team[1] != null)
                {
                    itemNum = Players.PlayerManager.MyPlayer.GetInvItemNum(PlayerManager.MyPlayer.Team[3].HeldItemSlot);
                }
                if (itemNum > 0)
                {
                    if ((int)Items.ItemHelper.Items[itemNum].Type < 8 || (int)Items.ItemHelper.Items[itemNum].Type == 15)
                    {
                    }
                    else
                    {
                        if (SdlInput.Keyboard.IsKeyPressed(SdlInput.Key.LeftControl))
                        {
                            Messenger.SendThrowItem(PlayerManager.MyPlayer.Team[3].HeldItemSlot);
                        }
                        else
                        {
                            GameProcessor.CheckUseItem(3, PlayerManager.MyPlayer.Team[3].HeldItemSlot);
                        }
                    }
                }
            }
            else if (e.Key == SdlInput.Key.F11)
            {
                if (System.IO.Directory.Exists(IO.Paths.StartupPath + "Screenshots") == false)
                {
                    System.IO.Directory.CreateDirectory(IO.Paths.StartupPath + "Screenshots");
                }
                int openScreenshot = -1;
                for (int i = 1; i < Int32.MaxValue; i++)
                {
                    if (System.IO.File.Exists(IO.Paths.StartupPath + "Screenshots/Screenshot" + i + ".png") == false)
                    {
                        openScreenshot = i;
                        break;
                    }
                }
                if (openScreenshot > -1)
                {
                    Logic.Graphics.SurfaceManager.SaveSurface(SdlDotNet.Graphics.Video.Screen, IO.Paths.StartupPath + "Screenshots/Screenshot" + openScreenshot + ".png");
                    ExpKit.Modules.kitChat chat = (ExpKit.Modules.kitChat)Windows.WindowSwitcher.ExpKit.KitContainer.ModuleSwitcher.FindKitModule(Enums.ExpKitModules.Chat);
                    if (chat != null)
                    {
                        chat.AppendChat("Screenshot #" + openScreenshot + " saved!", System.Drawing.Color.Yellow);
                    }
                }
            }
            else if (e.Key == SdlInput.Key.F1)
            {
                if (Ranks.IsAllowed(PlayerManager.MyPlayer, Enums.Rank.Moniter))
                {
                    Windows.Editors.EditorManager.AdminPanel.Show();
                    SdlDotNet.Widgets.WindowManager.BringWindowToFront(Windows.Editors.EditorManager.AdminPanel);
                }

                /*
                 * } else if (e.Key == SdlInput.Key.F2) {
                 *  Players.Inventory inv = Players.PlayerManager.MyPlayer.Inventory;
                 *  for (int i = 1; i <= inv.Length; i++) {
                 *      if (inv[i].Num > 0) {
                 *          if (Items.ItemHelper.Items[inv[i].Num].Type == Enums.ItemType.PotionAddHP) {
                 *              ExpKit.Modules.kitChat chat = (ExpKit.Modules.kitChat)Windows.WindowSwitcher.ExpKit.KitContainer.ModuleSwitcher.FindKitModule(Enums.ExpKitModules.Chat);
                 *              if (chat != null) {
                 *                  chat.AppendChat("You have used a " + Items.ItemHelper.Items[inv[i].Num].Name + "!", Color.Yellow);
                 *              }
                 *              Messenger.SendUseItem(i);
                 *              break;
                 *          }
                 *      }
                 *  }
                 * } else if (e.Key == SdlInput.Key.F3) {
                 *  Players.Inventory inv = Players.PlayerManager.MyPlayer.Inventory;
                 *  for (int i = 1; i <= inv.Length; i++) {
                 *      if (inv[i].Num > 0) {
                 *          if (Items.ItemHelper.Items[inv[i].Num].Type == Enums.ItemType.PotionAddPP) {
                 *              ExpKit.Modules.kitChat chat = (ExpKit.Modules.kitChat)Windows.WindowSwitcher.ExpKit.KitContainer.ModuleSwitcher.FindKitModule(Enums.ExpKitModules.Chat);
                 *              if (chat != null) {
                 *                  chat.AppendChat("You have used a " + Items.ItemHelper.Items[inv[i].Num].Name + "!", Color.Yellow);
                 *              }
                 *              Messenger.SendUseItem(i);
                 *              break;
                 *          }
                 *      }
                 *  }
                 */
            }
            //else if (e.Key == SdlInput.Key.F4) {
            //    if (Ranks.IsAllowed(PlayerManager.MyPlayer, Enums.Rank.Moniter)) {
            //        Windows.Editors.EditorManager.GuildPanel.Show();
            //        SdlDotNet.Widgets.WindowManager.BringWindowToFront(Windows.Editors.EditorManager.GuildPanel);
            //    }
            //}
            else if (e.Key == SdlInput.Key.F9)
            {
                Menus.MenuSwitcher.ShowMenu(new Menus.mnuOnlineList("mnuOnlineList"));
                Network.Messenger.SendOnlineListRequest();
            }
            else if (e.Key == SdlInput.Key.F10)
            {
                Menus.MenuSwitcher.ShowMenu(new Menus.mnuBattleLog("mnuBattleLog"));
            }
            else if (e.Key == SdlInput.Key.Tab)
            {
            }
            else if (e.Key == SdlInput.Key.One)
            {
                Messenger.SendActiveCharSwap(0);
            }
            else if (e.Key == SdlInput.Key.Two)
            {
                Messenger.SendActiveCharSwap(1);
            }
            else if (e.Key == SdlInput.Key.Three)
            {
                Messenger.SendActiveCharSwap(2);
            }
            else if (e.Key == SdlInput.Key.Four)
            {
                Messenger.SendActiveCharSwap(3);
            }
        }