public Button(Vector2 position, string identifier, string text, bool autoRelease, Texture2D image, SpriteFont font, onPressed onPressed, GameState drawState = GameState.None) { this.position = position; this.image = image; this.autoRelease = autoRelease; this.text = new Text(position, text, image.Width, image.Height, 1f, font, Color.White, true, GameState.None, 0.1f); this.identifier = identifier; origin = new Vector2(image.Width / 2f, image.Height / 2f); pressed = onPressed; previousState = Mouse.GetState(); color = Color.White; latestButtonPosition = position; if (drawState == GameState.None || drawState == GameState.Editing || drawState == GameState.Simulating) { GUI.buttonsGUI.Add(this); } else if (drawState == GameState.LevelFinished) { GUI.buttonsFinish.Add(this); } Cell.GetCell(position).isEmpty = false; }
public Button(Vector2 position, string text, bool autoRelease, Texture2D image, SpriteFont font, onPressed onPressed) { this.position = position; this.image = image; this.autoRelease = autoRelease; this.text = new Text(position, text, image.Width, image.Height, 1f, font, Color.White); origin = new Vector2(image.Width / 2f, image.Height / 2f); pressed = onPressed; previousState = Mouse.GetState(); color = Color.White; latestButtonPosition = position; }
public static Button Debug(string text, int width, int height, Color color, onPressed onPressed) { return(new Button(latestButtonPosition + new Vector2(width * 1.5f, 0), text, false, DebugTextures.GenerateRectangle(width, height, color), GUI.defaultFont, onPressed)); }