public static bool Button(Rect rect, Texture texture, GUIStyle style) { if (isRendering) { Rectangle r = rect; if (Camera.FullScreen.Bounds.Contains(r)) { spriteBatch.Draw((Texture2D)texture, r, color); } if (Input.GetMouseButtonDown(0) && rect.Contains(Input.mousePositionXna)) { return true; } for (int i = 0; i < Input.touches.Length; i++) { if (Input.touches[i].phase == TouchPhase.Began && rect.Contains(Input.touches[i].cleanPosition)) { return true; } } } return false; }
// TODO: //public static bool Toggle(bool value, GUIContent content, GUIStyle style, GUILayoutOption[] options) //public static bool Toggle(bool value, Texture image, GUIStyle style, GUILayoutOption[] options) //public static bool Toggle(bool value, Texture image, GUILayoutOption[] options) //public static bool Toggle(bool value, string text, GUIStyle style, GUILayoutOption[] options) //public static bool Toggle(bool value, GUIContent content, GUILayoutOption[] options) private static bool DoToggle(bool value, GUIContent content, GUIStyle style, GUILayoutOption[] options) { // TODO: Implement this return false; }
public static void Label(string text, GUIStyle style) { // TODO: Implement this }
public static void Label(Rect rect, string text, GUIStyle style) { if (isRendering) { Rectangle r = rect; if (Camera.FullScreen.Bounds.Contains(r)) { Microsoft.Xna.Framework.Vector2 pos = new Microsoft.Xna.Framework.Vector2(r.Location.X, r.Location.Y); if (style.alignment == TextAnchor.MiddleCenter) { Microsoft.Xna.Framework.Vector2 sz = GUI.spriteFont.MeasureString(text); pos += new Microsoft.Xna.Framework.Vector2(Mathf.Floor((rect.width - sz.X) / 2), Mathf.Floor((rect.height - sz.Y) / 2)); } spriteBatch.DrawString(GUI.spriteFont, text ?? "", pos, color); } } }