Esempio n. 1
0
        public void Run()
        {
            Logger.Info("Welcome to the Fury Engine!");
            Logger.Info("Platform: " + RuntimeInformation.OSDescription);

            ImGuiController.Init(window);

            while (running)
            {
                double time    = GLFW.GetTime();
                float  elapsed = (float)(time - lastFrameTime);
                Time.deltaTime = elapsed;
                lastFrameTime  = time;

                if (!window.Minimised)
                {
                    foreach (Layer layer in layerStack.Layers)
                    {
                        layer.OnUpdate();
                    }

                    ImGuiController.Begin(window);
                    foreach (Layer layer in layerStack.Layers)
                    {
                        layer.OnImGuiRender();
                    }
                    ImGuiController.End();
                }

                window.OnUpdate();
            }
        }
Esempio n. 2
0
        public override void OnAttach()
        {
            string fontPath = PathUtils.GetFullPath("assets/Fonts/OpenSans-Regular.ttf");

            _imGuiController.Init(new ImGuiFontConfig {
                Path = fontPath, Size = 18
            });
        }
Esempio n. 3
0
        public void Run()
        {
            if (glfwInit() == 0)
            {
                throw new Exception("glfwInit");
            }

            glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
            glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
            glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

            _window = glfwCreateWindow(640, 480, "Hello World", IntPtr.Zero, IntPtr.Zero);
            if (_window == IntPtr.Zero)
            {
                glfwTerminate();
                throw new Exception("glfwCreateWindow");
            }

            glfwMakeContextCurrent(_window);
            LoadEntryPoints();

            _imGuiController = new ImGuiController(_window);
            _imGuiController.Init();

            while (glfwWindowShouldClose(_window) == 0)
            {
                glfwPollEvents();

                if (glfwGetKey(_window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
                {
                    glfwSetWindowShouldClose(_window, GLFW_TRUE);
                }

                _imGuiController.Update();

                ImGui.Begin("Info");
                ImGui.Text(glGetString(GL_VERSION));
                ImGui.Text($"FPS : {ImGui.GetIO().Framerate.ToString("0")}");
                if (ImGui.Button("Show demo"))
                {
                    _showDemo = true;
                }

                ImGui.End();

                if (_showDemo)
                {
                    ImGui.ShowDemoWindow(ref _showDemo);
                }

                glClear(GL_COLOR_BUFFER_BIT);
                _imGuiController.Render();

                glfwSwapBuffers(_window);
            }
        }