예제 #1
0
        public override void OnAttach()
        {
            Imgui.CreateContext();
            Imgui.StyleColorsDark();

            ImGuiIOPtr io = Imgui.GetIO();

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

            // TEMPORARY: should eventually use Hazel key codes
            io.KeyMap[(int)ImGuiKey.Tab]        = (int)Keys.Tab;
            io.KeyMap[(int)ImGuiKey.LeftArrow]  = (int)Keys.Left;
            io.KeyMap[(int)ImGuiKey.RightArrow] = (int)Keys.Right;
            io.KeyMap[(int)ImGuiKey.UpArrow]    = (int)Keys.Up;
            io.KeyMap[(int)ImGuiKey.DownArrow]  = (int)Keys.Down;
            io.KeyMap[(int)ImGuiKey.PageUp]     = (int)Keys.PageUp;
            io.KeyMap[(int)ImGuiKey.PageDown]   = (int)Keys.PageDown;
            io.KeyMap[(int)ImGuiKey.Home]       = (int)Keys.Home;
            io.KeyMap[(int)ImGuiKey.End]        = (int)Keys.End;
            io.KeyMap[(int)ImGuiKey.Insert]     = (int)Keys.Insert;
            io.KeyMap[(int)ImGuiKey.Delete]     = (int)Keys.Delete;
            io.KeyMap[(int)ImGuiKey.Backspace]  = (int)Keys.Backspace;
            io.KeyMap[(int)ImGuiKey.Space]      = (int)Keys.Space;
            io.KeyMap[(int)ImGuiKey.Enter]      = (int)Keys.Enter;
            io.KeyMap[(int)ImGuiKey.Escape]     = (int)Keys.Escape;
            io.KeyMap[(int)ImGuiKey.A]          = (int)Keys.A;
            io.KeyMap[(int)ImGuiKey.C]          = (int)Keys.C;
            io.KeyMap[(int)ImGuiKey.V]          = (int)Keys.V;
            io.KeyMap[(int)ImGuiKey.X]          = (int)Keys.X;
            io.KeyMap[(int)ImGuiKey.Y]          = (int)Keys.Y;
            io.KeyMap[(int)ImGuiKey.Z]          = (int)Keys.Z;

            try
            {
                ImGuiNative.ImGui_ImplOpenGL3_Init("#version 410");
            }
            catch (System.Exception ex)
            {
                foreach (var item in ex.Data)
                {
                    Debug.DLogWarning(item.ToString());
                }
            }
        }