Dashboard/tests/Dashboard.Demo/Program.cs

50 lines
1.5 KiB
C#
Raw Normal View History

using Dashboard.ImmediateDraw;
2024-07-17 22:18:20 +02:00
using Dashboard.Controls;
using Dashboard.OpenTK;
using Dashboard.Media;
2024-07-28 10:16:07 +02:00
using Dashboard.BlurgText;
using BlurgText;
using OpenTK.Mathematics;
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-28 11:21:18 +02:00
public static readonly DbApplication Application = new DbApplication(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-07-28 13:19:13 +02:00
private Font? font;
2024-07-28 10:16:07 +02:00
DashboardBlurg dblurg = new DashboardBlurg();
BlurgResult? result;
// private readonly Label Label = new Label() { Text = "Hello world!", Position = new QVec2(300, 300) };
2024-05-15 22:17:01 +02:00
2024-07-28 11:34:22 +02:00
protected override void PaintBegin(DrawList cmd)
2023-09-22 20:23:59 +02:00
{
base.PaintBegin(cmd);
2024-07-28 10:16:07 +02:00
if (result == null)
2024-05-15 22:17:01 +02:00
{
2024-07-28 10:16:07 +02:00
// IFontDataBase db = FontDataBaseProvider.Instance;
// font = new QFontFreeType(db.FontFileInfo(db.Sans).OpenRead());
2024-05-16 21:58:22 +02:00
2024-07-28 10:16:07 +02:00
// Label.Font = font;
// Label.TextSize = 12;
// Label.InvalidateVisual();
var font = dblurg.Blurg.AddFontFile("/usr/share/fonts/google-noto/NotoSans-Regular.ttf");
result = dblurg.Blurg.BuildString(font!, 12, BlurgColor.White, "Hello World");
2024-05-15 22:17:01 +02:00
}
cmd.PutBlurgText(dblurg, result!, new Vector2(300, 300));
2024-07-28 13:11:23 +02:00
cmd.Rectangle(new Rectangle(16, 16, 0, 0));
2024-07-28 10:16:07 +02:00
// Label.Paint(cmd);
2023-07-28 21:37:49 +02:00
}
}
}