Dashboard/tests/Dashboard.Demo/Program.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2024-07-17 22:18:20 +02:00
using Dashboard;
using Dashboard.CommandMachine;
using Dashboard.Controls;
using Dashboard.OpenTK;
using Dashboard.Media.Defaults;
using Dashboard.Media;
using Dashboard.PAL;
2023-09-22 20:23:59 +02:00
namespace Dashboard.Demo
2023-07-28 21:37:49 +02:00
{
public static class Program
{
2024-07-18 19:34:39 +02:00
public static readonly DashboardApplication Application = new DashboardApplication(new OpenTKPlatform());
2023-07-28 21:37:49 +02:00
public static void Main(string[] args)
{
2023-09-22 20:23:59 +02:00
Application.Run(new EmptyView());
}
}
public class EmptyView : View
{
2024-06-09 21:54:33 +02:00
private QFont? font;
2024-06-09 21:06:13 +02:00
private readonly Label Label = new Label() { Text = "Hello world!", Position = new QVec2(300, 300) };
2024-05-15 22:17:01 +02:00
protected override void PaintBegin(CommandList cmd)
2023-09-22 20:23:59 +02:00
{
base.PaintBegin(cmd);
2024-05-15 22:17:01 +02:00
if (font == null)
{
IFontDataBase db = FontDataBaseProvider.Instance;
font = new QFontFreeType(db.FontFileInfo(db.Sans).OpenRead());
2024-05-16 21:58:22 +02:00
2024-06-09 21:06:13 +02:00
Label.Font = font;
Label.TextSize = 12;
2024-05-16 21:58:22 +02:00
Label.InvalidateVisual();
2024-05-15 22:17:01 +02:00
}
cmd.Rectangle(new QRectangle(16, 16, 0, 0));
2024-05-16 21:58:22 +02:00
Label.Paint(cmd);
2023-07-28 21:37:49 +02:00
}
}
}