Skip to content

Commit

Permalink
Integrated IsWindowHovered (#61)
Browse files Browse the repository at this point in the history
Added support for IsWindowHovered
  • Loading branch information
MrSanShiro authored Feb 3, 2025
1 parent 80e94d7 commit 1b83482
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions api.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,22 @@
"summary": "IsWindowFocused",
"usage": null
},
{
"description": "",
"has_params": false,
"has_returns": true,
"name": "is_window_hovered",
"params": [],
"returns": [
{
"description": "",
"name": "result",
"type": "bool"
}
],
"summary": "IsWindowHovered",
"usage": null
},
{
"description": "",
"has_params": false,
Expand Down
8 changes: 8 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ RETURNS
* `focused` [`boolean`] -


### is_window_hovered()
IsWindowHovered


RETURNS
* `result` [`bool`] -


### get_content_region_avail()
GetContentRegionAvail

Expand Down
8 changes: 8 additions & 0 deletions imgui/api/imgui.script_api
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@
type: boolean


- name: is_window_hovered
type: function
desc: IsWindowHovered
returns:
- name: result
type: bool


- name: get_content_region_avail
type: function
desc: GetContentRegionAvail
Expand Down
14 changes: 14 additions & 0 deletions imgui/src/extension_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,19 @@ static int imgui_IsWindowFocused(lua_State* L)
return 1;
}

/** IsWindowHovered
* @name is_window_hovered
* @treturn bool result
*/
static int imgui_IsWindowHovered(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 1);
imgui_NewFrame();
bool hovered = ImGui::IsWindowHovered();
lua_pushboolean(L, hovered);
return 1;
}

/** GetContentRegionAvail
* @name get_content_region_avail
* @treturn number x
Expand Down Expand Up @@ -3158,6 +3171,7 @@ static const luaL_reg Module_methods[] =
{"begin_window", imgui_Begin},
{"end_window", imgui_End},
{"is_window_focused", imgui_IsWindowFocused},
{"is_window_hovered", imgui_IsWindowHovered},
{"get_content_region_avail", imgui_GetContentRegionAvail},
{"get_window_content_region_max", imgui_GetWindowContentRegionMax},

Expand Down

0 comments on commit 1b83482

Please sign in to comment.