Ejemplo n.º 1
0
        public unsafe override void OnAttach()
        {
            ImGuiContext = ImGui.CreateContext();
            //ImGui.SetCurrentContext(context);
            ImGuizmo.SetImGuiContext(ImGuiContext);

            Application app = Application.Instance;

            GLFW.Window windowHandle = app.Window.Handle;

            if (ImGuiController.ImGui_ImplGlfw_InitForOpenGL(windowHandle, true))
            {
                Log.Core.Info("ImGui GLFW part initialized");
            }
            if (ImGuiController.ImGui_ImplOpenGL3_Init("#version 330 core"))
            {
                Log.Core.Info("ImGui OpenGL part initialized");
            }

            ImGuiIOPtr io = ImGui.GetIO();

            io.DisplaySize = new Vector2(
                app.Window.Width / Vector2.One.X,
                app.Window.Height / Vector2.One.Y);
            io.DisplayFramebufferScale = Vector2.One;
            io.DeltaTime = 1.0f / 60.0f;

            // base theme
            //ImGui.StyleColorsClassic();
            //ImGui.StyleColorsLight();
            ImGui.StyleColorsDark();
            SetDarkThemeColors();

            io.ConfigFlags |= ImGuiConfigFlags.DockingEnable;

            //io.ConfigFlags |= ImGuiConfigFlags.NavEnableKeyboard;       // Enable Keyboard Controls
            ////io.ConfigFlags |= ImGuiConfigFlags.NavEnableGamepad;      // Enable Gamepad Controls
            //io.ConfigFlags |= ImGuiConfigFlags.DockingEnable;           // Enable Docking
            //io.ConfigFlags |= ImGuiConfigFlags.ViewportsEnable;         // Enable Multi-Viewport / Platform Windows
            ////io.ConfigFlags |= ImGuiConfigFlags.ViewportsNoTaskBarIcons;
            ////io.ConfigFlags |= ImGuiConfigFlags.ViewportsNoMerge;

            //io.BackendFlags |= ImGuiBackendFlags.HasMouseCursors;
            //io.BackendFlags |= ImGuiBackendFlags.HasSetMousePos;



            //io.Fonts.AddFontDefault(io.Fonts.AddFontFromFileTTF(FileEnvironment.ResourceFolder + "fonts/consola.ttf", 16.0f, null, io.Fonts.GetGlyphRangesChineseSimplifiedCommon()).ConfigData);

            //ImFontAtlasPtr fonts = ImGui.GetIO().Fonts;
            //io.Fonts.AddFontDefault();
            //io.Fonts.AddFontFromFileTTF(FileEnvironment.ResourceFolder + "fonts/arial.ttf", 18.0f);
            //io.Fonts.AddFontDefault(io.Fonts.AddFontFromFileTTF(FileEnvironment.ResourceFolder + "fonts/arial.ttf", 18.0f).ConfigData); //io.FontDefault = io.Fonts.AddFontFromFileTTF(FileEnvironment.ResourceFolder + "fonts/arial.ttf", 18.0f);
            //
            //
            //
            //ImGuiStylePtr style = ImGui.GetStyle();
            //if ((io.ConfigFlags & ImGuiConfigFlags.ViewportsEnable) > 0)
            //{
            //    style.WindowRounding = 0.0f;
            //    style.Colors[(int)ImGuiCol.WindowBg].W = 1.0f;
            //}
            //
        }