Dashboard/tests/Dashboard.Demo/Program.cs

50 lines
1.5 KiB
C#

using Dashboard.ImmediateDraw;
using Dashboard.Controls;
using Dashboard.OpenTK;
using Dashboard.Media;
using Dashboard.BlurgText;
using BlurgText;
using OpenTK.Mathematics;
namespace Dashboard.Demo
{
public static class Program
{
public static readonly DbApplication Application = new DbApplication(new OpenTKPlatform());
public static void Main(string[] args)
{
Application.Run(new EmptyView());
}
}
public class EmptyView : View
{
private Font? font;
DashboardBlurg dblurg = new DashboardBlurg();
BlurgResult? result;
// private readonly Label Label = new Label() { Text = "Hello world!", Position = new QVec2(300, 300) };
protected override void PaintBegin(DrawList cmd)
{
base.PaintBegin(cmd);
if (result == null)
{
// IFontDataBase db = FontDataBaseProvider.Instance;
// font = new QFontFreeType(db.FontFileInfo(db.Sans).OpenRead());
// 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");
}
cmd.PutBlurgText(dblurg, result!, new Vector2(300, 300));
cmd.Rectangle(new Rectangle(16, 16, 0, 0));
// Label.Paint(cmd);
}
}
}