Ejemplo n.º 1
0
 public Small(FF8String data, int x, int y, Icons.ID?title = null, Box_Options options = Box_Options.Default, Rectangle?bounding = null) : base(container: new IGMDataItem.Box(data, new Rectangle(x, y, 0, 0), title, options: Box_Options.Center | Box_Options.Middle))
 {
     this._options = options;
     // probably won't work as static size is set in update. And this may run before it's set.
     _bounding = bounding ?? new Rectangle(Point.Zero, Menu.StaticSize.ToPoint());
     Reposition();
 }
Ejemplo n.º 2
0
        protected void GenerateFocus(Vector2?inputsize = null, Box_Options options = Box_Options.Default)
        {
            Vector2 size = inputsize ?? Size;
            Vector2 Zoom = Memory.Scale(size.X, size.Y, Memory.ScaleMode.FitBoth);

            size /= 2;
            Vector2 t = new Vector2(vp.X / 2, vp.Y / 2);

            if ((options & Box_Options.Top) != 0)
            {
                t.Y    = 0;
                size.Y = 0;
            }
            else if ((options & Box_Options.Buttom) != 0)
            {
                t.Y    = vp.Y - (size.Y * 2 * Zoom.Y);
                size.Y = 0;
            }
            Focus = Matrix.CreateTranslation(-size.X, -size.Y, 0) *
                    Matrix.CreateScale(new Vector3(Zoom.X, Zoom.Y, 1)) *
                    Matrix.CreateTranslation(t.X, t.Y, 0);
        }
Ejemplo n.º 3
0
 public static Small Create(FF8String data, int x, int y, Icons.ID?title = null, Box_Options options = Box_Options.Default) => Create <Small>(data, x, y, title, options);
Ejemplo n.º 4
0
 public IGMDataItem_Box(FF8String data = null, Rectangle?pos = null, Icons.ID?title = null, Box_Options options = Box_Options.Default) : base(pos)
 {
     Data    = data;
     Title   = title;
     Options = options;
 }
Ejemplo n.º 5
0
        protected virtual VertexPositionTexture_Texture2D Quad(Entry entry, TextureHandler texture, float scale = .25f, Box_Options options = Box_Options.Middle | Box_Options.Center, float z = 0f)
        {
            var   rectangle = entry.GetRectangle;
            var   scaleFactor = texture.ScaleFactor;
            var   offset = options.HasFlag(Box_Options.UseOffset) ? entry.Offset : Vector2.Zero;
            var   vpt = new VertexPositionTexture[6];
            float left, right, bottom, top;

            if (options.HasFlag(Box_Options.Left))
            {
                left  = 0;
                right = rectangle.Width;
            }
            else if (options.HasFlag(Box_Options.Right))
            {
                left  = -rectangle.Width;
                right = 0;
            }
            else// (options.HasFlag(Box_Options.Center))
            {
                left  = -rectangle.Width / 2f;
                right = rectangle.Width / 2f;
            }
            if (options.HasFlag(Box_Options.Top))
            {
                bottom = 0;
                top    = rectangle.Height;
            }
            else if (options.HasFlag(Box_Options.Buttom))
            {
                bottom = -rectangle.Height;
                top    = 0;
            }
            else //(options.HasFlag(Box_Options.Middle))
            {
                bottom = -rectangle.Height / 2f;
                top    = rectangle.Height / 2f;
            }

            var v = new VertexPositionTexture[]
            {
                new VertexPositionTexture(new Vector3(left + offset.X, top + offset.Y, z) * scale, new Vector2(rectangle.Right * scaleFactor.X / texture.Width, rectangle.Top * scaleFactor.Y / texture.Height)),
                new VertexPositionTexture(new Vector3(right + offset.X, top + offset.Y, z) * scale, new Vector2(rectangle.Left * scaleFactor.X / texture.Width, rectangle.Top * scaleFactor.Y / texture.Height)),
                new VertexPositionTexture(new Vector3(right + offset.X, bottom + offset.Y, z) * scale, new Vector2(rectangle.Left * scaleFactor.X / texture.Width, rectangle.Bottom * scaleFactor.Y / texture.Height)),
                new VertexPositionTexture(new Vector3(left + offset.X, bottom + offset.Y, z) * scale, new Vector2(rectangle.Right * scaleFactor.X / texture.Width, rectangle.Bottom * scaleFactor.Y / texture.Height)),
            };

            vpt[0] = v[0];
            vpt[1] = v[1];
            vpt[2] = v[3];

            vpt[3] = v[1];
            vpt[4] = v[2];
            vpt[5] = v[3];
            return(new VertexPositionTexture_Texture2D(vpt, texture));
        }
Ejemplo n.º 6
0
 protected virtual VertexPositionTexture_Texture2D Quad(Enum ic, byte pal, float scale = .25f, Box_Options options = Box_Options.Middle | Box_Options.Center, float z = 0f)
 {
     Trim(ic, pal);
     return(Quad(this[ic], Textures[pal], scale, options, z));
 }
Ejemplo n.º 7
0
 public Small(FF8String data, int x, int y, Icons.ID?title = null, Box_Options options = Box_Options.Default) : base(data, x, y, title, options)
 {
 }
Ejemplo n.º 8
0
        private static Tuple <Rectangle, Point, Rectangle> DrawBox(Rectangle dst, FF8String buffer = null, Icons.ID?title = null, Vector2?textScale = null, Vector2?boxScale = null, Box_Options options = Box_Options.Default)
        {
            if (textScale == null)
            {
                textScale = Vector2.One;
            }
            if (boxScale == null)
            {
                boxScale = Vector2.One;
            }
            Point cursor = Point.Zero;

            dst.Size     = (dst.Size.ToVector2()).ToPoint();
            dst.Location = (dst.Location.ToVector2()).ToPoint();
            Vector2   bgscale = new Vector2(2f) * textScale.Value;
            Rectangle box     = dst.Scale(boxScale.Value);
            Rectangle backup  = dst;
            Rectangle hotspot = new Rectangle(dst.Location, dst.Size);
            Rectangle font    = new Rectangle();

            if ((options & Box_Options.SkipDraw) == 0)
            {
                if (dst.Width > 256 * bgscale.X)
                {
                    Memory.Icons.Draw(Icons.ID.Menu_BG_368, 0, box, bgscale, Fade);
                }
                else
                {
                    Memory.Icons.Draw(Icons.ID.Menu_BG_256, 0, box, bgscale, Fade);
                }
                if (title != null)
                {
                    //dst.Size = (Memory.Icons[title.Value].GetRectangle.Size.ToVector2()  * 2.823317308f).ToPoint();
                    dst.Offset(15, 0);
                    dst.Y = (int)(dst.Y * boxScale.Value.Y);
                    Memory.Icons.Draw(title.Value, 2, dst, (bgscale + new Vector2(.5f)), fade);
                }
                dst = backup;
            }
            if (buffer != null && buffer.Length > 0)
            {
                font = Memory.font.RenderBasicText(buffer, dst.Location.ToVector2(), TextScale * textScale.Value, Fade: fade, skipdraw: true);
                if ((options & Box_Options.Indent) != 0)
                {
                    dst.Offset(70 * textScale.Value.X, 0);
                }
                else if ((options & Box_Options.Center) != 0)
                {
                    dst.Offset(dst.Width / 2 - font.Width / 2, 0);
                }
                else
                {
                    dst.Offset(25 * textScale.Value.X, 0);
                }

                if ((options & Box_Options.Buttom) != 0)
                {
                    dst.Offset(0, (dst.Height - 48));
                }
                else if ((options & Box_Options.Middle) != 0)
                {
                    dst.Offset(0, dst.Height / 2 - font.Height / 2);
                }
                else
                {
                    dst.Offset(0, 21);
                }

                dst.Y     = (int)(dst.Y * boxScale.Value.Y);
                font      = Memory.font.RenderBasicText(buffer, dst.Location.ToVector2(), TextScale * textScale.Value, Fade: fade, skipdraw: (options & Box_Options.SkipDraw) != 0);
                cursor    = dst.Location;
                cursor.Y += (int)(TextScale.Y * 6); // 12 * (3.0375/2)
            }
            return(new Tuple <Rectangle, Point, Rectangle>(hotspot, cursor, font));
        }
Ejemplo n.º 9
0
 public HelpBox(FF8String data = null, Rectangle?pos = null, Icons.ID?title = null, Box_Options options = Box_Options.Default) : base(data, pos, title, options)
 {
 }
Ejemplo n.º 10
0
 public IGMData_TimedMsgBox(FF8String data, int x, int y, Icons.ID?title = null, Box_Options options = Box_Options.Default) : base(data, x, y, title, options)
 {
 }