Пример #1
0
 private static void DrawLGSGHeader(FF8String info, FF8String name, FF8String help) => LGSGHEADER = new Tuple <FF8String, FF8String, FF8String>(info, name, help);
Пример #2
0
            public static IGMData_ConfirmChanges Create(FF8String data, Icons.ID title, FF8String opt1, FF8String opt2, Rectangle pos)
            {
                IGMData_ConfirmChanges r = Create <IGMData_ConfirmChanges>(data, title, opt1, opt2, pos);

                r.startcursor = 1;
                return(r);
            }
Пример #3
0
 public Rectangle RenderBasicText(FF8String buffer, int x, int y, float zoomWidth = 2.545455f, float zoomHeight = 3.0375f, Type whichFont = 0, float Fade = 1.0f, int lineSpacing = 0, bool skipdraw = false, ColorID color = ColorID.White, bool blink = false)
 => RenderBasicText(buffer, new Vector2(x, y), new Vector2(zoomWidth, zoomHeight), whichFont, Fade, lineSpacing, skipdraw, color, blink);
Пример #4
0
        public Rectangle RenderBasicText(FF8String buffer, Vector2 pos, Vector2 zoom, Type whichFont = 0, float Fade = 1.0f, int lineSpacing = 0, bool skipdraw = false, ColorID color_ = ColorID.White, bool blink = false)
        {
            ColorID colorbak    = color_;
            Color   color       = ColorID2Color[color_];
            Color   faded_color = ColorID2Blink[color_];

            if (buffer == null)
            {
                return(new Rectangle());
            }
            Rectangle ret            = new Rectangle(pos.RoundedPoint(), new Point(0));
            Rectangle destRect       = Rectangle.Empty;
            Point     real           = pos.RoundedPoint();
            int       charCountWidth = 21;
            int       charSize       = 12; //pixelhandler does the 2x scaling on the fly.
            Point     size           = (new Vector2(0, charSize) * zoom).RoundedPoint();
            Point     baksize        = size;
            int       width          = 0;
            bool      skipletter     = false;

            for (int i = 0; i < buffer.Length; i++)
            {
                size = baksize;
                byte c = buffer[i];
                if (c == 0)
                {
                    continue;
                }
                else if (c == (byte)FF8TextTagCode.Dialog)
                {
                    if (++i < buffer.Length - 1)
                    {
                        c = buffer[i];
                        switch ((FF8TextTagDialog)c)
                        {
                        // Most of these should be replaced before it gets here becuase they have
                        // values set by other objects.
                        case FF8TextTagDialog.CustomICON:
                            DrawIcon(buffer, zoom, Fade, skipdraw, real, ref size, ref skipletter, ref i, ref c);
                            break;
                        }
                        //if (!skipletter)
                        SetRetRec(pos, ref ret, ref real, size);
                        continue;
                    }
                }
                else if (c == (byte)FF8TextTagCode.Key)
                {
                    if (++i < buffer.Length - 1)
                    {
                        FF8TextTagKey k      = (FF8TextTagKey)buffer[i];
                        FF8String     str    = Input2.ButtonString(k);
                        Rectangle     retpos = RenderBasicText(str, real, zoom, whichFont, Fade, lineSpacing, skipdraw, ColorID.Green);
                        size.X = retpos.Width;
                        //size.Y = retpos.Height;
                        //real.X += retpos.Width;
                        //TODO add key/controller input icons/text here.
                        //if (!skipletter)
                        SetRetRec(pos, ref ret, ref real, size);
                        continue;
                    }
                }
                else if (c == (byte)FF8TextTagCode.Color)
                {
                    if (++i < buffer.Length - 1)
                    {
                        c     = buffer[i];
                        blink = c >= (byte)FF8TextTagColor.Dark_GrayBlink ? true : false;
                        GetColorFromTag(c, out Color? nc, out Color? fc);
                        color       = nc ?? ColorID2Color[colorbak];
                        faded_color = fc ?? ColorID2Blink[colorbak];
                        SetRetRec(pos, ref ret, ref real, size);
                        continue;
                    }
                }
                else if (c == (byte)FF8TextTagCode.Line && NewLine(pos, lineSpacing, ref real, size))
                {
                    SetRetRec(pos, ref ret, ref real, size);
                    continue;
                }
                if (!skipletter)
                {
                    int deltaChar = GetDeltaChar(c);
                    if (deltaChar >= 0 && charWidths != null && deltaChar < charWidths.Length)
                    {
                        width  = charWidths[deltaChar];
                        size.X = (int)(charWidths[deltaChar] * zoom.X);
                    }
                    else
                    {
                        width  = charSize;
                        size.X = (int)(charSize * zoom.X);
                    }
                    Point curSize          = size;
                    int   verticalPosition = deltaChar / charCountWidth;
                    //i.e. 1280 is 100%, 640 is 50% and therefore 2560 is 200% which means multiply by 0.5f or 2.0f

                    destRect = new Rectangle(real, size);
                    if (!skipdraw)
                    {
                        Rectangle sourceRect = new Rectangle((deltaChar - (verticalPosition * charCountWidth)) * charSize,
                                                             verticalPosition * charSize,
                                                             width,
                                                             charSize);
                        DrawLetter(whichFont, Fade, blink ? Color.Lerp(color, faded_color, Menu.Blink_Amount) : color, destRect, sourceRect);
                    }
                }
                skipletter = false;
                SetRetRec(pos, ref ret, ref real, size);
            }

            ret.Height = size.Y + (real.Y - (int)pos.Y);
            return(ret);
        }
Пример #5
0
 public Rectangle RenderBasicText(FF8String buffer, Point pos, Vector2 zoom, Type whichFont = 0, float Fade = 1.0f, int lineSpacing = 0, bool skipdraw = false, ColorID color = ColorID.White, bool blink = false)
 => RenderBasicText(buffer, pos.ToVector2(), zoom, whichFont, Fade, lineSpacing, skipdraw, color, blink);