Dashboard/tests/Dashboard.Demo/Program.cs

44 lines
1.2 KiB
C#

using Dashboard;
using Dashboard.CommandMachine;
using Dashboard.Controls;
using Dashboard.OpenTK;
using Dashboard.Media.Defaults;
using Dashboard.Media;
using Dashboard.PAL;
namespace Dashboard.Demo
{
public static class Program
{
public static readonly DashboardApplication Application = new DashboardApplication(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!", 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.Font = font;
Label.TextSize = 12;
Label.InvalidateVisual();
}
cmd.Rectangle(new QRectangle(16, 16, 0, 0));
Label.Paint(cmd);
}
}
}