コード例 #1
0
        static void Main(string[] args)
        {
            /*Generator.Generate();
             * Console.WriteLine("Done!");
             * Console.ReadLine();*/

            NVG.SetLibraryDirectory();
            Glfw.Init();

            Glfw.WindowHint(Glfw.Hint.ContextVersionMajor, 3);
            Glfw.WindowHint(Glfw.Hint.ContextVersionMinor, 2);
            Glfw.WindowHint(Glfw.Hint.OpenglForwardCompat, true);
            Glfw.WindowHint(Glfw.Hint.OpenglProfile, Glfw.OpenGLProfile.Core);

            Glfw.WindowHint(Glfw.Hint.Samples, 16);

            Glfw.Window Wnd = Glfw.CreateWindow(800, 600, "NanoVG.NET");
            Glfw.MakeContextCurrent(Wnd);
            Glfw.GetFramebufferSize(Wnd, out int FbW, out int FbH);

            NanoVGContext Ctx = NVG.CreateGL3Glew(3);

            Glfw.SwapInterval(0);

            int Icons    = Ctx.CreateFont("icons", "data/fonts/entypo.ttf");
            int Sans     = Ctx.CreateFont("sans", "data/fonts/Roboto-Regular.ttf");
            int SansBold = Ctx.CreateFont("sans-bold", "data/fonts/Roboto-Bold.ttf");
            int Emoji    = Ctx.CreateFont("emoji", "data/fonts/NotoEmoji-Regular.ttf");

            Ctx.AddFallbackFontId(Sans, Emoji);
            Ctx.AddFallbackFontId(SansBold, Emoji);

            while (!Glfw.WindowShouldClose(Wnd))
            {
                glClear();
                Ctx.BeginFrame(800, 600, (float)FbW / FbH);

                Demo(Ctx);

                Ctx.EndFrame();
                Glfw.SwapBuffers(Wnd);
                Glfw.PollEvents();
            }
        }