Esempio n. 1
0
 public static bool Button(string text)
 {
     if (currentArea.HasValue)
     {
         Rect r = new Rect(currentArea.Value.x, currentArea.Value.y, currentArea.Value.width, GUI.skin.button.fixedHeight);
         int offset = GUI.skin.button.fixedHeight + GUI.skin.button.margin.bottom;
         currentArea = new Rect(currentArea.Value.x, currentArea.Value.y + offset, currentArea.Value.width, currentArea.Value.height - offset);
         return GUI.Button(r, text);
     }
     return false;
 }
Esempio n. 2
0
 public static void BeginArea(Rect rect)
 {
     if (!currentArea.HasValue)
     {
         currentArea = rect;
     }
     else
     {
         throw new InvalidOperationException("We already have an area begun");
     }
 }
Esempio n. 3
0
File: GUI.cs Progetto: Joelone/FFWD
 public static bool Button(Rect rect, string text)
 {
     if (isRendering)
     {
         bool result = Button(rect, GUI.skin.button.normal.background, GUI.skin.button);
         Color oldColor = color;
         if (result)
         {
             color = Color.green;
         }
         Label(rect, text, GUI.skin.button);
         color = oldColor;
         return result;
     }
     return false;
 }
Esempio n. 4
0
File: GUI.cs Progetto: Joelone/FFWD
 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;
 }
Esempio n. 5
0
File: GUI.cs Progetto: Joelone/FFWD
 public static bool Button(Rect rect, Texture texture)
 {
     return Button(rect, texture, GUI.skin.button);
 }
Esempio n. 6
0
File: GUI.cs Progetto: Joelone/FFWD
 public static string TextField(Rect rect, string m_strLevelName)
 {
     //throw new NotImplementedException();
     return m_strLevelName;
 }
Esempio n. 7
0
File: GUI.cs Progetto: Joelone/FFWD
        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);
                }
            }
        }
Esempio n. 8
0
File: GUI.cs Progetto: Joelone/FFWD
 public static void Label(Rect rect, string text)
 {
     Label(rect, text, GUIStyle.none);
 }
Esempio n. 9
0
File: GUI.cs Progetto: Joelone/FFWD
        public static void DrawTexture(Rect rect, Rect source, Vector2 origin, Vector2 size, Texture texture, float rot)
        {
            if (isRendering)
            {
                Rectangle r = new Rectangle((int)rect.x + (int)(size.x * origin.x), (int)rect.y + (int)(size.y * origin.y), (int)rect.width, (int)rect.height);
                Rectangle s = source;
                Vector2 o = new Vector2(texture.width * origin.x, texture.height * origin.y);

                if (Camera.FullScreen.Bounds.Intersects(r))
                {
                    spriteBatch.Draw((Microsoft.Xna.Framework.Graphics.Texture2D)texture, r, s, color, rot, o, SpriteEffects.None, 0.0f);
                }
            }
        }
Esempio n. 10
0
File: GUI.cs Progetto: Joelone/FFWD
 public static void DrawTexture(Rect rect, Texture texture)
 {
     if (isRendering)
     {
         Rectangle r = rect;
         if (Camera.FullScreen.Bounds.Intersects(r))
         {
             spriteBatch.Draw((Microsoft.Xna.Framework.Graphics.Texture2D)texture, r, color);
         }
     }
 }