Exemple #1
0
 public Button(string a_normal, string a_hover, string a_pressed, string a_toggle, Vector2 a_position, string a_buttonText, string a_font, Color a_color, Vector2 a_offset)
 {
     setNormalTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_normal));
     setHoverTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_hover));
     setPressedTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_pressed));
     setToggleTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_toggle));
     if (a_font == null)
     {
         a_font = "Courier New";
     }
     m_text = new Text(a_position, a_offset, a_buttonText, a_font, a_color, false);
     m_position = new CartesianCoordinate(a_position);
     m_position.setParentPosition(Game.getInstance().m_camera.getPosition());
     setPosition(a_position);
     m_bounds = new Rectangle((int)a_position.X, (int)a_position.Y, (int)m_size.X, (int)m_size.Y);
     m_layer = 0.002f;
     m_upSound = null;
     m_downSound = null;
 }
Exemple #2
0
 public Button(Vector2 a_position, string a_normal, string a_hover, string a_pressed, string a_toggle)
 {
     setNormalTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_normal));
     setHoverTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_hover));
     setPressedTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_pressed));
     setToggleTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_toggle));
     m_position = new CartesianCoordinate(a_position);
     m_position.setParentPosition(Game.getInstance().m_camera.getPosition());
     setPosition(a_position);
     m_bounds = new Rectangle((int)a_position.X, (int)a_position.Y, (int)m_size.X, (int)m_size.Y);
     m_layer = 0.002f;
     m_upSound = null;
     m_downSound = null;
     m_isVisible = true;
 }