示例#1
0
        public void Run(string[] args)
        {
            using (var wind = new DisplayWindowBuilder(args)
                              .BackbufferSize(800, 600)
                              .QuitOnClose()
                              .Build())
            {
                Input.Unhandled.KeyDown += Keyboard_KeyDown;

                FontState state = new FontState
                {
                    Size  = 14,
                    Style = FontStyles.None,
                };

                FontSurface font = Font.AgateSans.Core.FontSurface(state);

                FontSurface unkerned = ConstructUnkernedFont(font);

                string text = ConstructKerningText(wind, font);

                while (AgateApp.IsAlive)
                {
                    Display.BeginFrame();
                    Display.Clear();

                    FontSurface thisFont = useKerning ? font : unkerned;

                    if (useKerning)
                    {
                        thisFont.DrawText(state, "Using kerning. (space to toggle)");
                    }
                    else
                    {
                        thisFont.DrawText(state, "No kerning used. (space to toggle)");
                    }

                    state.Color = Color.White;
                    thisFont.DrawText(state, new Vector2(0, thisFont.FontHeight(state)), text);

                    Display.EndFrame();
                    AgateApp.KeepAlive();
                }
            }
        }