@@ -2600,7 +2600,63 @@ inline std::tuple<float, float, float> ColorConvertHSVtoRGB(float h, float s, fl
2600
2600
return std::make_tuple (r, g, b);
2601
2601
}
2602
2602
2603
+ // Inputs Utilities: Keyboard
2604
+ inline int GetKeyIndex (int imgui_key)
2605
+ {
2606
+ return ImGui::GetKeyIndex (static_cast <ImGuiKey>(imgui_key));
2607
+ }
2608
+ inline bool IsKeyDown (int user_key_index)
2609
+ {
2610
+ return ImGui::IsKeyDown (user_key_index);
2611
+ }
2612
+ inline bool IsKeyPressed (int user_key_index)
2613
+ {
2614
+ return ImGui::IsKeyPressed (user_key_index);
2615
+ }
2616
+ inline bool IsKeyPressed (int user_key_index, bool repeat)
2617
+ {
2618
+ return ImGui::IsKeyPressed (user_key_index, repeat);
2619
+ }
2620
+ inline bool IsKeyReleased (int user_key_index)
2621
+ {
2622
+ return ImGui::IsKeyReleased (user_key_index);
2623
+ }
2624
+ inline int GetKeyPressedAmount (int key_index, float repeat_delay, float rate)
2625
+ {
2626
+ return ImGui::GetKeyPressedAmount (key_index, repeat_delay, rate);
2627
+ }
2628
+ inline void CaptureKeyboardFromApp ()
2629
+ {
2630
+ ImGui::CaptureKeyboardFromApp ();
2631
+ }
2632
+ inline void CaptureKeyboardFromApp (bool want_capture_keyboard_value)
2633
+ {
2634
+ ImGui::CaptureKeyboardFromApp (want_capture_keyboard_value);
2635
+ }
2636
+
2603
2637
// Inputs Utilities: Mouse
2638
+
2639
+ inline bool IsMouseDown (int button)
2640
+ {
2641
+ return ImGui::IsMouseDown (static_cast <ImGuiMouseButton>(button));
2642
+ }
2643
+ inline bool IsMouseClicked (int button)
2644
+ {
2645
+ return ImGui::IsMouseClicked (static_cast <ImGuiMouseButton>(button));
2646
+ }
2647
+ inline bool IsMouseClicked (int button, bool repeat)
2648
+ {
2649
+ return ImGui::IsMouseClicked (static_cast <ImGuiMouseButton>(button), repeat);
2650
+ }
2651
+ inline bool IsMouseReleased (int button)
2652
+ {
2653
+ return ImGui::IsMouseReleased (static_cast <ImGuiMouseButton>(button));
2654
+ }
2655
+ inline bool IsMouseDoubleClicked (int button)
2656
+ {
2657
+ return ImGui::IsMouseDoubleClicked (static_cast <ImGuiMouseButton>(button));
2658
+ }
2659
+
2604
2660
inline bool IsMouseHoveringRect (float min_x, float min_y, float max_x, float max_y)
2605
2661
{
2606
2662
return ImGui::IsMouseHoveringRect ({min_x, min_y}, {max_x, max_y});
@@ -2609,6 +2665,10 @@ inline bool IsMouseHoveringRect(float min_x, float min_y, float max_x, float max
2609
2665
{
2610
2666
return ImGui::IsMouseHoveringRect ({min_x, min_y}, {max_x, max_y}, clip);
2611
2667
}
2668
+ inline bool IsAnyMouseDown ()
2669
+ {
2670
+ return ImGui::IsAnyMouseDown ();
2671
+ }
2612
2672
inline std::tuple<float , float > GetMousePos ()
2613
2673
{
2614
2674
const auto vec2{ImGui::GetMousePos ()};
@@ -2650,6 +2710,22 @@ inline void ResetMouseDragDelta(int button)
2650
2710
{
2651
2711
ImGui::ResetMouseDragDelta (static_cast <ImGuiMouseButton>(button));
2652
2712
}
2713
+ inline int GetMouseCursor ()
2714
+ {
2715
+ return ImGui::GetMouseCursor ();
2716
+ }
2717
+ inline void SetMouseCursor (int cursor_type)
2718
+ {
2719
+ ImGui::SetMouseCursor (static_cast <ImGuiMouseCursor>(cursor_type));
2720
+ }
2721
+ inline void CaptureMouseFromApp ()
2722
+ {
2723
+ ImGui::CaptureMouseFromApp ();
2724
+ }
2725
+ inline void CaptureMouseFromApp (bool want_capture_mouse_value)
2726
+ {
2727
+ ImGui::CaptureMouseFromApp (want_capture_mouse_value);
2728
+ }
2653
2729
2654
2730
// Clipboard Utilities
2655
2731
inline std::string GetClipboardText ()
@@ -3048,6 +3124,22 @@ inline void InitEnums(sol::table luaGlobals)
3048
3124
luaGlobals.new_enum (" ImGuiMouseButton" , " Left" , ImGuiMouseButton_Left, " Right" , ImGuiMouseButton_Right, " Middle" , ImGuiMouseButton_Middle, " COUNT" , ImGuiMouseButton_COUNT);
3049
3125
#pragma endregion MouseButton
3050
3126
3127
+ #pragma region Key
3128
+ luaGlobals.new_enum (
3129
+ " ImGuiKey" , " Tab" , ImGuiKey_Tab, " LeftArrow" , ImGuiKey_LeftArrow, " RightArrow" , ImGuiKey_RightArrow, " UpArrow" , ImGuiKey_UpArrow, " DownArrow" , ImGuiKey_DownArrow, " PageUp" ,
3130
+ ImGuiKey_PageUp, " PageDown" , ImGuiKey_PageDown, " Home" , ImGuiKey_Home, " End" , ImGuiKey_End, " Insert" , ImGuiKey_Insert, " Delete" , ImGuiKey_Delete, " Backspace" ,
3131
+ ImGuiKey_Backspace, " Space" , ImGuiKey_Space, " Enter" , ImGuiKey_Enter, " Escape" , ImGuiKey_Escape, " KeyPadEnter" , ImGuiKey_KeyPadEnter, " A" , ImGuiKey_A, " C" , ImGuiKey_C, " V" ,
3132
+ ImGuiKey_V, " X" , ImGuiKey_X, " Y" , ImGuiKey_Y, " Z" , ImGuiKey_Z, " COUNT" , ImGuiKey_COUNT, " LeftCtrl" , ImGuiKey_LeftCtrl, " LeftShift" , ImGuiKey_LeftShift, " G" , ImGuiKey_G,
3133
+ " S" , ImGuiKey_S, " D" , ImGuiKey_D, " R" , ImGuiKey_R, " H" , ImGuiKey_H);
3134
+ #pragma endregion Key
3135
+
3136
+ #pragma region MouseCursor
3137
+ luaGlobals.new_enum (
3138
+ " ImGuiMouseCursor" , " None" , ImGuiMouseCursor_None, " Arrow" , ImGuiMouseCursor_Arrow, " TextInput" , ImGuiMouseCursor_TextInput, " ResizeAll" , ImGuiMouseCursor_ResizeAll,
3139
+ " ResizeNS" , ImGuiMouseCursor_ResizeNS, " ResizeEW" , ImGuiMouseCursor_ResizeEW, " ResizeNESW" , ImGuiMouseCursor_ResizeNESW, " ResizeNWSE" , ImGuiMouseCursor_ResizeNWSE, " Hand" ,
3140
+ ImGuiMouseCursor_Hand, " NotAllowed" , ImGuiMouseCursor_NotAllowed, " COUNT" , ImGuiMouseCursor_COUNT);
3141
+ #pragma endregion MouseCursor
3142
+
3051
3143
#pragma region ImDrawCorner Flags
3052
3144
luaGlobals.new_enum (
3053
3145
" ImDrawCornerFlags" , " None" , ImDrawCornerFlags_None, " TopLeft" , ImDrawCornerFlags_TopLeft, " TopRight" , ImDrawCornerFlags_TopRight, " BotLeft" , ImDrawCornerFlags_BotLeft,
@@ -3684,10 +3776,23 @@ inline void InitBindings(sol::state& lua, sol::table luaGlobals)
3684
3776
ImGui.set_function (" ColorConvertHSVtoRGB" , ColorConvertHSVtoRGB);
3685
3777
#pragma endregion Color Utilities
3686
3778
3779
+ #pragma region Inputs Utilities: Keyboard
3780
+ ImGui.set_function (" GetKeyIndex" , GetKeyIndex);
3781
+ ImGui.set_function (" IsKeyDown" , IsKeyDown);
3782
+ ImGui.set_function (" IsKeyPressed" , sol::overload (sol::resolve<bool (int )>(IsKeyPressed), sol::resolve<bool (int , bool )>(IsKeyPressed)));
3783
+ ImGui.set_function (" IsKeyReleased" , IsKeyReleased);
3784
+ ImGui.set_function (" CaptureKeyboardFromApp" , sol::overload (sol::resolve<void ()>(CaptureKeyboardFromApp), sol::resolve<void (bool )>(CaptureKeyboardFromApp)));
3785
+ #pragma endregion Inputs Utilities : Keyboard
3786
+
3687
3787
#pragma region Inputs Utilities : Mouse
3788
+ ImGui.set_function (" IsMouseDown" , IsMouseDown);
3789
+ ImGui.set_function (" IsMouseClicked" , sol::overload (sol::resolve<bool (int )>(IsMouseClicked), sol::resolve<bool (int , bool )>(IsMouseClicked)));
3790
+ ImGui.set_function (" IsMouseReleased" , IsMouseReleased);
3791
+ ImGui.set_function (" IsMouseDoubleClicked" , IsMouseDoubleClicked);
3688
3792
ImGui.set_function (
3689
3793
" IsMouseHoveringRect" ,
3690
3794
sol::overload (sol::resolve<bool (float , float , float , float )>(IsMouseHoveringRect), sol::resolve<bool (float , float , float , float , bool )>(IsMouseHoveringRect)));
3795
+ ImGui.set_function (" IsAnyMouseDown" , IsAnyMouseDown);
3691
3796
ImGui.set_function (" GetMousePos" , GetMousePos);
3692
3797
ImGui.set_function (" GetMousePosOnOpeningCurrentPopup" , GetMousePosOnOpeningCurrentPopup);
3693
3798
ImGui.set_function (" IsMouseDragging" , sol::overload (sol::resolve<bool (int )>(IsMouseDragging), sol::resolve<bool (int , float )>(IsMouseDragging)));
@@ -3696,6 +3801,9 @@ inline void InitBindings(sol::state& lua, sol::table luaGlobals)
3696
3801
sol::resolve<std::tuple<float , float >()>(GetMouseDragDelta), sol::resolve<std::tuple<float , float >(int )>(GetMouseDragDelta),
3697
3802
sol::resolve<std::tuple<float , float >(int , float )>(GetMouseDragDelta)));
3698
3803
ImGui.set_function (" ResetMouseDragDelta" , sol::overload (sol::resolve<void ()>(ResetMouseDragDelta), sol::resolve<void (int )>(ResetMouseDragDelta)));
3804
+ ImGui.set_function (" GetMouseCursor" , GetMouseCursor);
3805
+ ImGui.set_function (" SetMouseCursor" , SetMouseCursor);
3806
+ ImGui.set_function (" CaptureMouseFromApp" , sol::overload (sol::resolve<void ()>(CaptureMouseFromApp), sol::resolve<void (bool )>(CaptureMouseFromApp)));
3699
3807
#pragma endregion Inputs Utilities : Mouse
3700
3808
3701
3809
#pragma region Clipboard Utilities
0 commit comments