public void MenuPress() { var LeftClick = BMouseListener.GetButtonStateNow(BMouseButton.Left); if (LeftClick.IsPressed) { for (int i = 0; i < buttons.Length; i++) { if (LeftClick.Location.X <= buttons[i].X && LeftClick.Location.X >= buttons[i].X1) { if (LeftClick.Location.Y <= buttons[i].Y && LeftClick.Location.Y >= buttons[i].Y1) { buttons[i].Pressed(Window); } } } } }
public override void Tick(double delta) { base.Tick(delta); // Handle our player and camera movement var LeftClick = BMouseListener.GetButtonStateNow(BMouseButton.Left); if (LeftClick.IsPressed) { Vector2 pos = new Vector2(LeftClick.Location.X, LeftClick.Location.Y); pos -= new Vector2(AppSettings.SETTING_WIDTH, AppSettings.SETTING_HEIGHT) / 2f; pos = Camera.ToWorld(pos); Camera.SetPosition(pos, BTweenType.QuadraticInOut, 30); //Player.MoveToPosition(pos); NavMesh.FindPathTo(Player.position, pos); Player.FollowPath(NavMesh); } var RightClick = BMouseListener.GetButtonStateNow(BMouseButton.Right); if (RightClick.IsPressed) { Vector2 pos = new Vector2(RightClick.Location.X, RightClick.Location.Y); pos -= new Vector2(AppSettings.SETTING_WIDTH, AppSettings.SETTING_HEIGHT) / 2f; pos = Camera.ToWorld(pos); while (Level.GetEntity(pos, 32f) != null) { Level.DisposeEntity(Level.GetEntity(pos)); } float treeSize = (float)new Random().Next(86, 128); Tree newEntity = new Tree(pos, Textures[1], new Vector2(treeSize, treeSize), new RectangleF(0, 0, 256f, 256f)); Level.CreateEntity(newEntity); NavMesh.Update(Level); } int ScrollWheel = BMouseListener.GetScrollWheelNow(); if (ScrollWheel != 0) { if (ScrollWheel < 0) { Camera.Zoom = Camera.Zoom - 0.075f; } else if (ScrollWheel > 0) { Camera.Zoom = Camera.Zoom + 0.075f; } if (Camera.Zoom > 1.25f) { Camera.Zoom = 1.25f; } else if (Camera.Zoom < 0.75f) { Camera.Zoom = 0.75f; } } if (BKeyboardListener.IsKeyJustPressed(BKey.F8)) { AppSettings.SETTING_COLLISION_DEBUG = !AppSettings.SETTING_COLLISION_DEBUG; } if (BKeyboardListener.IsKeyJustPressed(BKey.F7)) { NavMesh.Update(Level); AppSettings.SETTING_NAVIGATION_DEBUG = !AppSettings.SETTING_NAVIGATION_DEBUG; } if (BKeyboardListener.IsKeyJustPressed(BKey.F6)) { AppSettings.SETTING_PATHFINDING_DEBUG = !AppSettings.SETTING_PATHFINDING_DEBUG; } }