Example #1
0
 private static void Drawing_OnEndScene(EventArgs args)
 {
     if (Player.Instance.IsDead || MenuHandler.GetCheckboxValue(MenuHandler.Settings, "Draw when Alive"))
     {
         DrawManager.Draw();
     }
 }
Example #2
0
        private static void Game_OnWndProc(WndEventArgs args)
        {
            if (Player.Instance.IsDead || MenuHandler.GetCheckboxValue(MenuHandler.Settings, "Draw when Alive"))
            {
                if (args.Msg == (uint)WindowMessages.LeftButtonDown)
                {
                    isMouseDown = true;
                }
                else if (args.Msg == (uint)WindowMessages.LeftButtonUp)
                {
                    isMouseDown = false;
                }

                Texture HoverTexture = DrawManager.activeTextures.Where(a => a.IsMouseOver()).LastOrDefault();

                if (HoverTexture != null && HoverTexture.Type == Texture.ObjectType.Button)
                {
                    Button activeButton = ((Button)HoverTexture);
                    activeButton.OnKeyPress(args);
                }

                if (dragObject != null && args.Msg == (uint)WindowMessages.MouseMove && isMouseDown)
                {
                    ((Button)dragObject).OnKeyPress(args);
                }
                else if (dragObject != null && !isMouseDown)
                {
                    dragObject = null;
                }
            }
        }
Example #3
0
        public static void Draw()
        {
            if (MenuState != lastMenuState)
            {
                CreateScreen();
                lastMenuState = MenuState;
            }

            foreach (Texture texture in activeTextures)
            {
                texture.Draw();
            }

            foreach (Tuple <string, Vector2> text in textList)
            {
                DrawText(text.Item1, text.Item2);
            }

            if (MenuHandler.GetCheckboxValue(MenuHandler.Settings, "Draw Element Names"))
            {
                Texture HoverTexture = activeTextures.Where(a => a.IsMouseOver()).LastOrDefault();
                if (HoverTexture != null)
                {
                    Drawing.DrawText(Center, System.Drawing.Color.Blue, HoverTexture.DisplayName, 15);
                }
            }
        }
Example #4
0
 private static void Game_OnTick(EventArgs args)
 {
     if (Player.Instance.IsDead || MenuHandler.GetCheckboxValue(MenuHandler.Settings, "Draw when Alive"))
     {
         if (DrawManager.MenuState == DrawManager.HUDState.InGameSnake)
         {
             Snake.HandleTick();
         }
     }
 }
Example #5
0
 public void OnKeyPress(WndEventArgs args)
 {
     if (args.Msg == (uint)WindowMessages.LeftButtonDown)
     {
         if (OnMouseDown != null)
         {
             OnMouseDown();
         }
         isBeingClicked = true;
         if (MenuHandler.GetCheckboxValue(MenuHandler.Settings, "Debug Click Actions"))
         {
             Console.WriteLine(DisplayName + " had left click pushed down on it.");
         }
     }
     else if (args.Msg == (uint)WindowMessages.LeftButtonUp)
     {
         if (OnMouseRelease != null)
         {
             OnMouseRelease();
         }
         isBeingClicked = false;
         if (MenuHandler.GetCheckboxValue(MenuHandler.Settings, "Debug Click Actions"))
         {
             Console.WriteLine(DisplayName + " had left click released on it.");
         }
     }
     else if (args.Msg == (uint)WindowMessages.MouseMove)
     {
         if (OnMouseMove != null)
         {
             OnMouseMove();
         }
         if (MenuHandler.GetCheckboxValue(MenuHandler.Settings, "Debug Hover Actions"))
         {
             Console.WriteLine(DisplayName + " had the mouse move over it.");
         }
     }
 }