本文整理汇总了C#中TextBuffer.Print方法的典型用法代码示例。如果您正苦于以下问题:C# TextBuffer.Print方法的具体用法?C# TextBuffer.Print怎么用?C# TextBuffer.Print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextBuffer
的用法示例。
在下文中一共展示了TextBuffer.Print方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuState
public MenuState()
{
GUIText = new TextBuffer(80, 30);
GUIText.SetFontTexture(ResourceMgr.Get<Texture>("font"));
GUIText.Sprite.Scale = Renderer.Screen.Size.ToVec2f().Divide(GUIText.Sprite.Texture.Size.ToVec2f());
GUIText.Sprite.Position = Renderer.Screen.Texture.Size.ToVec2f() / 2;
GUIText.Sprite.Origin = GUIText.Sprite.Texture.Size.ToVec2f() / 2;
AAA = new RenderSprite(Renderer.Screen.Size);
BBB = new RenderSprite(Renderer.Screen.Size);
CRT = new RenderSprite(Renderer.Screen.Size);
MainMenu = new MenuEntry("Main Menu");
if (Renderer.CountStates() > 0)
MainMenu.Add(new WidgetButton("Continue Universe", () => Renderer.PopState()));
MainMenu
.Add(new WidgetButton("Create Universe", () => Renderer.PushState(new GameState())))
.Add(new WidgetButton("Load Universe", () => CurrentMenu = LoadUniverse).Disable())
.Add(new WidgetButton("Universal Constants", () => CurrentMenu = Constants))
.Add(new WidgetButton("Terminate", () => Program.Running = false));
Action BackToMainMenu = () => {
GUIText.Clear();
CurrentMenu = MainMenu;
};
LoadUniverse = new MenuEntry("Load Universe")
.Add(new WidgetButton("Back", BackToMainMenu));
Constants = new MenuEntry("Universal Constants")
.Add(new WidgetTextbox("Resolution X", Program.ResX.ToString(), 6, (S) => {
if (S.Length > 0)
Program.ResX = int.Parse(S);
GUIText.Print(0, 0, "Restart required for changes to take effect");
}, char.IsNumber))
.Add(new WidgetTextbox("Resolution Y", Program.ResY.ToString(), 6, (S) => {
if (S.Length > 0)
Program.ResY = int.Parse(S);
GUIText.Print(0, 0, "Restart required for changes to take effect");
}, char.IsNumber))
.Add(new WidgetCheckbox("Debug", Program.Debug, (B) => Program.Debug = B))
.Add(new WidgetCheckbox("Border", Program.Border, (B) => Program.Border = B))
.Add(new WidgetButton("Back", BackToMainMenu));
CurrentMenu = MainMenu;
CurrentMenu.DrawMenu(GUIText);
}
示例2: DrawMenu
public void DrawMenu(TextBuffer GUIText)
{
ValidateSelected();
Widget[] Entries = MenuEntries.ToArray();
// Separator
int Width = MenuTitle.Length + 5;
int Height = 3;
for (int i = 0; i < Entries.Length; i++) {
Width = Math.Max(Width, Entries[i].Width + 3);
Height += Entries[i].Height;
}
int X = GUIText.BufferWidth / 2 - Width / 2 - 1;
int Y = GUIText.BufferHeight / 2 - Height / 2 - 1;
//DrawBox(GUIText, Width, 0, 0, GUIText.BufferHeight - 1);
// Outline
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
GUIText[X + x, Y + y] = 0;
GUIText.DrawBox(X, Y, Width, Height);
GUIText.Print(X + 2, Y, "[" + MenuTitle + "]");
// Entries
int YOff = 0;
for (int i = 0; i < Entries.Length; i++) {
Entries[i].Draw(GUIText, X + 2, Y + 2 + YOff, i == Selected);
YOff += Entries[i].Height;
}
/*GUIText.Print(X + 2, Y + i + 2, Entries[i],
i == Selected ? Color.Black : ConsoleColor.Gray.ToColor(), i == Selected ? Color.White : Color.Black);*/
}
示例3: Draw
public override void Draw(TextBuffer TBuffer, int X, int Y, bool IsSelected)
{
Color Fg = ConsoleColor.Gray.ToColor();
Color Bg = Color.Black;
if (IsSelected) {
Fg = Color.Black;
if (Enabled)
Bg = Color.White;
else
Bg = ConsoleColor.DarkGray.ToColor();
}
TBuffer.Print(X, Y, Txt, Fg, Bg);
}