Example #1
0
        protected override void ContextRecreated()
        {
            status = new TextWidget(game, font)
                     .SetLocation(Anchor.Min, Anchor.Min, 2, 2);
            status.ReducePadding = true;
            status.Init();
            string msg = statusBuffer.Length > 0 ? statusBuffer.ToString() : "FPS: no data yet";

            status.SetText(msg);

            posAtlas = new TextAtlas(game, 16);
            posAtlas.Pack("0123456789-, ()", font, "Position: ");
            posAtlas.tex.Y = (short)(status.Height + 2);

            int yOffset = status.Height + 2;

            hackStates = new TextWidget(game, font)
                         .SetLocation(Anchor.Min, Anchor.Min, 2, yOffset);
            hackStates.ReducePadding = true;
            hackStates.Init();
            UpdateHackState();

            yOffset += hackStates.Height + posAtlas.tex.Height;
            xPos     = new TextWidget(game, font)
                       .SetLocation(Anchor.Min, Anchor.Min, 2, yOffset);
            xPos.ReducePadding = false;
            xPos.Init();
            xPos.SetText("X: 0");

            yOffset += xPos.Height;
            yPos     = new TextWidget(game, font)
                       .SetLocation(Anchor.Min, Anchor.Min, 2, yOffset);
            yPos.ReducePadding = false;
            yPos.Init();
            yPos.SetText("Y: 0");

            yOffset += xPos.Height;
            zPos     = new TextWidget(game, font)
                       .SetLocation(Anchor.Min, Anchor.Min, 2, yOffset);
            zPos.ReducePadding = false;
            zPos.Init();
            zPos.SetText("Z: 0");
        }
Example #2
0
        protected override void ContextRecreated()
        {
            fpsText = new TextWidget(game, font)
                      .SetLocation(Anchor.LeftOrTop, Anchor.LeftOrTop, 2, 2);
            fpsText.ReducePadding = true;
            fpsText.Init();
            string msg = text.Length > 0 ? text.ToString() : "FPS: no data yet";

            fpsText.SetText(msg);

            posAtlas = new TextAtlas(game, 16);
            posAtlas.Pack("0123456789-, ()", posFont, "Position: ");
            posAtlas.tex.Y = (short)(fpsText.Height + 2);

            int yOffset = fpsText.Height + posAtlas.tex.Height + 2;

            hackStates = new TextWidget(game, posFont)
                         .SetLocation(Anchor.LeftOrTop, Anchor.LeftOrTop, 2, yOffset);
            hackStates.ReducePadding = true;
            hackStates.Init();
            UpdateHackState(true);
        }
        public override void Init()
        {
            font    = new Font(game.FontName, 14);
            posFont = new Font(game.FontName, 14, FontStyle.Italic);
            game.Events.ChatFontChanged += ChatFontChanged;

            fpsText               = new ChatTextWidget(game, font);
            fpsText.XOffset       = 2;
            fpsText.YOffset       = 2;
            fpsText.ReducePadding = true;
            fpsText.Init();

            string msg = text.Length > 0 ? text.ToString() : "FPS: no data yet";

            fpsText.SetText(msg);
            MakePosTextWidget();

            hackStates               = new ChatTextWidget(game, posFont);
            hackStates.XOffset       = 2;
            hackStates.YOffset       = fpsText.Height + posTex.Height + 2;
            hackStates.ReducePadding = true;
            hackStates.Init();
            UpdateHackState(true);
        }