Dashboard/tests/QuikDemo/Program.cs

44 lines
1.1 KiB
C#

using Quik;
using Quik.CommandMachine;
using Quik.Controls;
using Quik.OpenTK;
using Quik.Media.Defaults;
using Quik.Media;
using Quik.PAL;
namespace QuikDemo
{
public static class Program
{
public static readonly QuikApplication Application = new QuikApplication(new OpenTKPlatform());
public static void Main(string[] args)
{
Application.Run(new EmptyView());
}
}
public class EmptyView : View
{
private QFont font;
private readonly Label Label = new Label() { Text = "Hello world!", Size = new QVec2(256, 32), Position = new QVec2(300, 300) };
protected override void PaintBegin(CommandList cmd)
{
base.PaintBegin(cmd);
if (font == null)
{
IFontDataBase db = FontDataBaseProvider.Instance;
font = new QFontFreeType(db.FontFileInfo(db.Sans).OpenRead());
Label.TextFont = font;
Label.TextSize = 16;
Label.InvalidateVisual();
}
cmd.Rectangle(new QRectangle(16, 16, 0, 0));
Label.Paint(cmd);
}
}
}