mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
djui_hud_get_mouse_locked()
Adds a total of 1 function: # `bool djui_hud_get_mouse_locked()` Returns the DJUI mouse lock status Tip: This won't return the true state of mouse lock, so make sure to use `get_first_person_enabled()` and `camera_config_is_mouse_look_enabled()` as well --- This also fills in some descriptions left out by Isaac in his viewport/scissor functions
This commit is contained in:
parent
b4c8f023d2
commit
d0cd64cb05
6 changed files with 67 additions and 17 deletions
|
|
@ -3914,8 +3914,14 @@ function djui_hud_get_raw_mouse_y()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @return boolean
|
||||||
|
--- Returns if the cursor is hidden and constrained to the window
|
||||||
|
function djui_hud_get_mouse_locked()
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param locked boolean
|
--- @param locked boolean
|
||||||
--- Sets if the cursor is hidden and constrainted to the window
|
--- Sets if the cursor is hidden and constrained to the window
|
||||||
function djui_hud_set_mouse_locked(locked)
|
function djui_hud_set_mouse_locked(locked)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
@ -3954,12 +3960,12 @@ end
|
||||||
--- @param y number
|
--- @param y number
|
||||||
--- @param width number
|
--- @param width number
|
||||||
--- @param height number
|
--- @param height number
|
||||||
--- Sets the viewport to the specified position and size, this will resize
|
--- Sets the viewport to the specified position and size, this will resize any subsequent DJUI graphics
|
||||||
function djui_hud_set_viewport(x, y, width, height)
|
function djui_hud_set_viewport(x, y, width, height)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- put the description here
|
--- Resets the viewport to a fullscreen state
|
||||||
function djui_hud_reset_viewport()
|
function djui_hud_reset_viewport()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
@ -3968,12 +3974,12 @@ end
|
||||||
--- @param y number
|
--- @param y number
|
||||||
--- @param width number
|
--- @param width number
|
||||||
--- @param height number
|
--- @param height number
|
||||||
--- put the description here
|
--- Sets the scissor rectangle to the specified position and size, this will cut off any subsequent DJUI graphics not within the rectangle
|
||||||
function djui_hud_set_scissor(x, y, width, height)
|
function djui_hud_set_scissor(x, y, width, height)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- put the description here
|
--- Resets the scissor rectangle to a fullscreen state
|
||||||
function djui_hud_reset_scissor()
|
function djui_hud_reset_scissor()
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3140,10 +3140,31 @@ Returns the y coordinate of the mouse relative to the screen
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [djui_hud_get_mouse_locked](#djui_hud_get_mouse_locked)
|
||||||
|
|
||||||
|
### Description
|
||||||
|
Returns if the cursor is hidden and constrained to the window
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local booleanValue = djui_hud_get_mouse_locked()`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
- None
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `boolean`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`bool djui_hud_get_mouse_locked(void);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [djui_hud_set_mouse_locked](#djui_hud_set_mouse_locked)
|
## [djui_hud_set_mouse_locked](#djui_hud_set_mouse_locked)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
Sets if the cursor is hidden and constrainted to the window
|
Sets if the cursor is hidden and constrained to the window
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`djui_hud_set_mouse_locked(locked)`
|
`djui_hud_set_mouse_locked(locked)`
|
||||||
|
|
@ -3271,7 +3292,7 @@ Returns the amount scrolled vertically (-down/up+)
|
||||||
## [djui_hud_set_viewport](#djui_hud_set_viewport)
|
## [djui_hud_set_viewport](#djui_hud_set_viewport)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
Sets the viewport to the specified position and size, this will resize
|
Sets the viewport to the specified position and size, this will resize any subsequent DJUI graphics
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`djui_hud_set_viewport(x, y, width, height)`
|
`djui_hud_set_viewport(x, y, width, height)`
|
||||||
|
|
@ -3297,7 +3318,7 @@ Sets the viewport to the specified position and size, this will resize
|
||||||
## [djui_hud_reset_viewport](#djui_hud_reset_viewport)
|
## [djui_hud_reset_viewport](#djui_hud_reset_viewport)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
put the description here
|
Resets the viewport to a fullscreen state
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`djui_hud_reset_viewport()`
|
`djui_hud_reset_viewport()`
|
||||||
|
|
@ -3318,7 +3339,7 @@ put the description here
|
||||||
## [djui_hud_set_scissor](#djui_hud_set_scissor)
|
## [djui_hud_set_scissor](#djui_hud_set_scissor)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
put the description here
|
Sets the scissor rectangle to the specified position and size, this will cut off any subsequent DJUI graphics not within the rectangle
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`djui_hud_set_scissor(x, y, width, height)`
|
`djui_hud_set_scissor(x, y, width, height)`
|
||||||
|
|
@ -3344,7 +3365,7 @@ put the description here
|
||||||
## [djui_hud_reset_scissor](#djui_hud_reset_scissor)
|
## [djui_hud_reset_scissor](#djui_hud_reset_scissor)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
put the description here
|
Resets the scissor rectangle to a fullscreen state
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`djui_hud_reset_scissor()`
|
`djui_hud_reset_scissor()`
|
||||||
|
|
|
||||||
|
|
@ -770,6 +770,7 @@
|
||||||
- [djui_hud_get_mouse_y](functions-3.md#djui_hud_get_mouse_y)
|
- [djui_hud_get_mouse_y](functions-3.md#djui_hud_get_mouse_y)
|
||||||
- [djui_hud_get_raw_mouse_x](functions-3.md#djui_hud_get_raw_mouse_x)
|
- [djui_hud_get_raw_mouse_x](functions-3.md#djui_hud_get_raw_mouse_x)
|
||||||
- [djui_hud_get_raw_mouse_y](functions-3.md#djui_hud_get_raw_mouse_y)
|
- [djui_hud_get_raw_mouse_y](functions-3.md#djui_hud_get_raw_mouse_y)
|
||||||
|
- [djui_hud_get_mouse_locked](functions-3.md#djui_hud_get_mouse_locked)
|
||||||
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
|
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
|
||||||
- [djui_hud_get_mouse_buttons_down](functions-3.md#djui_hud_get_mouse_buttons_down)
|
- [djui_hud_get_mouse_buttons_down](functions-3.md#djui_hud_get_mouse_buttons_down)
|
||||||
- [djui_hud_get_mouse_buttons_pressed](functions-3.md#djui_hud_get_mouse_buttons_pressed)
|
- [djui_hud_get_mouse_buttons_pressed](functions-3.md#djui_hud_get_mouse_buttons_pressed)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ static struct DjuiColor sRefColor = { 255, 255, 255, 255 };
|
||||||
static bool sLegacy = false;
|
static bool sLegacy = false;
|
||||||
|
|
||||||
f32 gDjuiHudUtilsZ = 0;
|
f32 gDjuiHudUtilsZ = 0;
|
||||||
u8 gDjuiHudLockMouse = false;
|
bool gDjuiHudLockMouse = false;
|
||||||
|
|
||||||
extern ALIGNED8 const u8 texture_hud_char_camera[];
|
extern ALIGNED8 const u8 texture_hud_char_camera[];
|
||||||
extern ALIGNED8 const u8 texture_hud_char_lakitu[];
|
extern ALIGNED8 const u8 texture_hud_char_lakitu[];
|
||||||
|
|
@ -297,6 +297,10 @@ f32 djui_hud_get_raw_mouse_y(void) {
|
||||||
return mouse_y;
|
return mouse_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool djui_hud_get_mouse_locked(void) {
|
||||||
|
return gDjuiHudLockMouse;
|
||||||
|
}
|
||||||
|
|
||||||
void djui_hud_set_mouse_locked(bool locked) {
|
void djui_hud_set_mouse_locked(bool locked) {
|
||||||
gDjuiHudLockMouse = locked;
|
gDjuiHudLockMouse = locked;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ struct GlobalTextures {
|
||||||
|
|
||||||
extern struct GlobalTextures gGlobalTextures;
|
extern struct GlobalTextures gGlobalTextures;
|
||||||
extern f32 gDjuiHudUtilsZ;
|
extern f32 gDjuiHudUtilsZ;
|
||||||
extern u8 gDjuiHudLockMouse;
|
extern bool gDjuiHudLockMouse;
|
||||||
|
|
||||||
/* |description|Gets the current DJUI HUD resolution|descriptionEnd| */
|
/* |description|Gets the current DJUI HUD resolution|descriptionEnd| */
|
||||||
u8 djui_hud_get_resolution(void);
|
u8 djui_hud_get_resolution(void);
|
||||||
|
|
@ -92,7 +92,9 @@ f32 djui_hud_get_mouse_y(void);
|
||||||
f32 djui_hud_get_raw_mouse_x(void);
|
f32 djui_hud_get_raw_mouse_x(void);
|
||||||
/* |description|Returns the y coordinate of the mouse relative to the screen|descriptionEnd| */
|
/* |description|Returns the y coordinate of the mouse relative to the screen|descriptionEnd| */
|
||||||
f32 djui_hud_get_raw_mouse_y(void);
|
f32 djui_hud_get_raw_mouse_y(void);
|
||||||
/* |description|Sets if the cursor is hidden and constrainted to the window|descriptionEnd| */
|
/* |description|Returns if the cursor is hidden and constrained to the window|descriptionEnd| */
|
||||||
|
bool djui_hud_get_mouse_locked(void);
|
||||||
|
/* |description|Sets if the cursor is hidden and constrained to the window|descriptionEnd| */
|
||||||
void djui_hud_set_mouse_locked(bool locked);
|
void djui_hud_set_mouse_locked(bool locked);
|
||||||
/* |description|Returns the flags of the mouse buttons held down|descriptionEnd| */
|
/* |description|Returns the flags of the mouse buttons held down|descriptionEnd| */
|
||||||
u8 djui_hud_get_mouse_buttons_down(void);
|
u8 djui_hud_get_mouse_buttons_down(void);
|
||||||
|
|
@ -104,13 +106,13 @@ u8 djui_hud_get_mouse_buttons_released(void);
|
||||||
f32 djui_hud_get_mouse_scroll_x(void);
|
f32 djui_hud_get_mouse_scroll_x(void);
|
||||||
/* |description|Returns the amount scrolled vertically (-down/up+)|descriptionEnd| */
|
/* |description|Returns the amount scrolled vertically (-down/up+)|descriptionEnd| */
|
||||||
f32 djui_hud_get_mouse_scroll_y(void);
|
f32 djui_hud_get_mouse_scroll_y(void);
|
||||||
/* |description|Sets the viewport to the specified position and size, this will resize |descriptionEnd| */
|
/* |description|Sets the viewport to the specified position and size, this will resize any subsequent DJUI graphics|descriptionEnd| */
|
||||||
void djui_hud_set_viewport(f32 x, f32 y, f32 width, f32 height);
|
void djui_hud_set_viewport(f32 x, f32 y, f32 width, f32 height);
|
||||||
/* |description|put the description here|descriptionEnd| */
|
/* |description|Resets the viewport to a fullscreen state|descriptionEnd| */
|
||||||
void djui_hud_reset_viewport(void);
|
void djui_hud_reset_viewport(void);
|
||||||
/* |description|put the description here|descriptionEnd| */
|
/* |description|Sets the scissor rectangle to the specified position and size, this will cut off any subsequent DJUI graphics not within the rectangle|descriptionEnd| */
|
||||||
void djui_hud_set_scissor(f32 x, f32 y, f32 width, f32 height);
|
void djui_hud_set_scissor(f32 x, f32 y, f32 width, f32 height);
|
||||||
/* |description|put the description here|descriptionEnd| */
|
/* |description|Resets the scissor rectangle to a fullscreen state|descriptionEnd| */
|
||||||
void djui_hud_reset_scissor(void);
|
void djui_hud_reset_scissor(void);
|
||||||
|
|
||||||
/* |description|Measures the length of `message` in the current font|descriptionEnd| */
|
/* |description|Measures the length of `message` in the current font|descriptionEnd| */
|
||||||
|
|
|
||||||
|
|
@ -12698,6 +12698,21 @@ int smlua_func_djui_hud_get_raw_mouse_y(UNUSED lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_djui_hud_get_mouse_locked(UNUSED lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 0) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_get_mouse_locked", 0, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lua_pushboolean(L, djui_hud_get_mouse_locked());
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int smlua_func_djui_hud_set_mouse_locked(lua_State* L) {
|
int smlua_func_djui_hud_set_mouse_locked(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
|
@ -37321,6 +37336,7 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "djui_hud_get_mouse_y", smlua_func_djui_hud_get_mouse_y);
|
smlua_bind_function(L, "djui_hud_get_mouse_y", smlua_func_djui_hud_get_mouse_y);
|
||||||
smlua_bind_function(L, "djui_hud_get_raw_mouse_x", smlua_func_djui_hud_get_raw_mouse_x);
|
smlua_bind_function(L, "djui_hud_get_raw_mouse_x", smlua_func_djui_hud_get_raw_mouse_x);
|
||||||
smlua_bind_function(L, "djui_hud_get_raw_mouse_y", smlua_func_djui_hud_get_raw_mouse_y);
|
smlua_bind_function(L, "djui_hud_get_raw_mouse_y", smlua_func_djui_hud_get_raw_mouse_y);
|
||||||
|
smlua_bind_function(L, "djui_hud_get_mouse_locked", smlua_func_djui_hud_get_mouse_locked);
|
||||||
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
|
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
|
||||||
smlua_bind_function(L, "djui_hud_get_mouse_buttons_down", smlua_func_djui_hud_get_mouse_buttons_down);
|
smlua_bind_function(L, "djui_hud_get_mouse_buttons_down", smlua_func_djui_hud_get_mouse_buttons_down);
|
||||||
smlua_bind_function(L, "djui_hud_get_mouse_buttons_pressed", smlua_func_djui_hud_get_mouse_buttons_pressed);
|
smlua_bind_function(L, "djui_hud_get_mouse_buttons_pressed", smlua_func_djui_hud_get_mouse_buttons_pressed);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue