protected override void ContextRecreated() { line1 = new TextWidget(game) .SetLocation(Anchor.Min, Anchor.Min, 2, 2); line1.ReducePadding = true; string msg = statusBuffer.Length > 0 ? statusBuffer.ToString() : "FPS: no data yet"; line1.Set(msg, font); posAtlas = new TextAtlas(game, 16); posAtlas.Pack("0123456789-, ()", font, "Position: "); posAtlas.tex.Y = (short)(line1.Height + 2); int yOffset = line1.Height + posAtlas.tex.Height + 2; line2 = new TextWidget(game) .SetLocation(Anchor.Min, Anchor.Min, 2, yOffset); line2.ReducePadding = true; if (game.ClassicMode) { // Swap around so 0.30 version is at top line2.YOffset = 2; line1.YOffset = posAtlas.tex.Y; line2.Set("0.30", font); line1.Reposition(); line2.Reposition(); } else { UpdateHackState(); } }
// TODO: scaling public override void Init() { base.Init(); font = new Font(game.FontName, 16); posAtlas = new TextAtlas(game, 16); posAtlas.Pack("0123456789", font, "f"); Events.ChatFontChanged += ChatFontChanged; }
protected override void ContextRecreated() { base.ContextRecreated(); dynamicVb = gfx.CreateDynamicVb(VertexFormat.P3fT2fC4b, verticesCount); idAtlas = new TextAtlas(game, 16); idAtlas.Pack("0123456789", regularFont, "f"); UpdateTileSize(); }
// TODO: scaling public override void Init() { base.Init(); font = new Font(game.FontName, (16 / 2) * (int)game.GuiHotbarScale); posAtlas = new TextAtlas(game, (16 / 2) * (int)game.GuiHotbarScale); posAtlas.Pack("0123456789", font, "f"); game.Events.ChatFontChanged += ChatFontChanged; guiScale = game.GuiHotbarScale; }
void InitTableWidget() { table = new SurvivalTableWidget(game); table.font = font; posAtlas = new TextAtlas(game, 16); posAtlas.Pack("0123456789", font, "f"); table.posAtlas = posAtlas; table.ElementsPerRow = 9; table.Init(); }
protected override void ContextRecreated() { dynamicVb = game.Graphics.CreateDynamicVb(VertexFormat.P3fT2fC4b, verticesCount); idAtlas = new TextAtlas(game, 16); idAtlas.Pack("0123456789", textFont, "f"); tileSize = game.Height / Atlas2D.TilesPerRow; tileSize = (tileSize / 8) * 8; Utils.Clamp(ref tileSize, 8, 40); xOffset = CalcPos(Anchor.Centre, 0, tileSize * Atlas2D.RowsCount, game.Width); yOffset = CalcPos(Anchor.Centre, 0, tileSize * Atlas2D.TilesPerRow, game.Height); widgets[0] = TextWidget.Create(game, "Texture ID reference sheet", titleFont) .SetLocation(Anchor.Centre, Anchor.Min, 0, yOffset - 30); }
void InitTableWidget() { table = new SurvivalTableWidget(game); table.font = font; posAtlas = new TextAtlas(game, 16); posAtlas.Pack("0123456789", font, "f"); table.posAtlas = posAtlas; table.ElementsPerRow = 9; #if !ALPHA if (tableSize == 4) { tableSize = 9; } #endif table.CraftingItems = new Item[tableSize]; table.Init(); }
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"); }
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); }