public Demo(Nvg nvg) { _nvg = nvg; for (uint i = 0; i < 12; i++) { string file = "./images/image" + i + ".jpg"; _images[i] = _nvg.CreateImage(file, 0); if (_images[i] == 0) { Console.Error.WriteLine("Could not load " + file); Environment.Exit(-1); } } _fontIcons = _nvg.CreateFont("icons", "./fonts/entypo.ttf"); if (_fontIcons == -1) { Console.Error.WriteLine("Could not add font icons."); Environment.Exit(-1); } _fontNormal = _nvg.CreateFont("sans", "./fonts/Roboto-Regular.ttf"); if (_fontIcons == -1) { Console.Error.WriteLine("Could not add font regular."); Environment.Exit(-1); } _fontBold = _nvg.CreateFont("sans-bold", "./fonts/Roboto-Bold.ttf"); if (_fontIcons == -1) { Console.Error.WriteLine("Could not add font bold."); Environment.Exit(-1); } _fontEmoji = _nvg.CreateFont("emoji", "./fonts/NotoEmoji-Regular.ttf"); if (_fontIcons == -1) { Console.Error.WriteLine("Could not add font emoji."); Environment.Exit(-1); } _ = _nvg.AddFallbackFontId(_fontNormal, _fontEmoji); _ = _nvg.AddFallbackFontId(_fontBold, _fontEmoji); }
private static void Load() { IInputContext input = window.CreateInput(); foreach (IKeyboard keyboard in input.Keyboards) { keyboard.KeyDown += KeyDown; } gl = window.CreateOpenGL(); OpenGLRenderer nvgRenderer = new(CreateFlags.Antialias | CreateFlags.StencilStrokes | CreateFlags.Debug, gl); nvg = Nvg.Create(nvgRenderer); fontSize = 20.0f; _ = nvg.CreateFont("Roboto", "Roboto-Regular.ttf"); }