Dashboard/tests/QuikDemo/Program.cs

44 lines
1.1 KiB
C#
Raw Normal View History

2024-05-16 21:58:22 +02:00
using Quik;
2023-09-22 20:23:59 +02:00
using Quik.CommandMachine;
using Quik.Controls;
2023-07-28 21:37:49 +02:00
using Quik.OpenTK;
2024-05-15 22:17:01 +02:00
using Quik.Media.Defaults;
using Quik.Media;
using Quik.PAL;
2023-09-22 20:23:59 +02:00
2023-07-28 21:37:49 +02:00
namespace QuikDemo
{
public static class Program
{
public static readonly QuikApplication Application = new QuikApplication(new OpenTKPlatform());
public static void Main(string[] args)
{
2023-09-22 20:23:59 +02:00
Application.Run(new EmptyView());
}
}
public class EmptyView : View
{
2024-05-15 22:17:01 +02:00
private QFont font;
2024-05-16 21:58:22 +02:00
private readonly Label Label = new Label() { Text = "Hello world!", Size = new QVec2(256, 32), 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
Label.TextFont = font;
Label.TextSize = 16;
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
}
}
}