mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 06:51:51 +00:00
add input.get_mouse_scroll()
This commit is contained in:
parent
6b915b33a4
commit
c83a73102e
3 changed files with 18 additions and 0 deletions
|
|
@ -63,6 +63,13 @@ input.get_mouse_delta() --> {int, int}
|
||||||
|
|
||||||
Returns cursor movement delta.
|
Returns cursor movement delta.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
input.get_mouse_scroll() --> int
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the vertical mouse wheel offset accumulated during the current frame.
|
||||||
|
A positive value indicates scrolling up; a negative value indicates scrolling down.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
input.get_bindings() --> strings array
|
input.get_bindings() --> strings array
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@ input.get_mouse_pos() -> {number, number}
|
||||||
|
|
||||||
-- Возращает дельту позиции курсора.
|
-- Возращает дельту позиции курсора.
|
||||||
input.get_mouse_delta() -> {number, number}
|
input.get_mouse_delta() -> {number, number}
|
||||||
|
|
||||||
|
-- Возвращает вертикальное смещение колеса мыши, накопленное за текущий кадр.
|
||||||
|
-- Положительное значение соответствует прокрутке вверх, отрицательное - вниз.
|
||||||
|
input.get_mouse_scroll() -> number
|
||||||
```
|
```
|
||||||
|
|
||||||
## Создание обработчиков
|
## Создание обработчиков
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,12 @@ static int l_get_mouse_delta(lua::State* L) {
|
||||||
return lua::pushvec2(L, engine->getInput().getCursor().delta);
|
return lua::pushvec2(L, engine->getInput().getCursor().delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int l_get_mouse_scroll(lua::State* L) {
|
||||||
|
if (engine->isHeadless())
|
||||||
|
return 0;
|
||||||
|
return lua::pushinteger(L, engine->getInput().getScroll());
|
||||||
|
}
|
||||||
|
|
||||||
static int l_get_bindings(lua::State* L) {
|
static int l_get_bindings(lua::State* L) {
|
||||||
if (engine->isHeadless())
|
if (engine->isHeadless())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -181,6 +187,7 @@ const luaL_Reg inputlib[] = {
|
||||||
{"add_callback", lua::wrap<l_add_callback>},
|
{"add_callback", lua::wrap<l_add_callback>},
|
||||||
{"get_mouse_pos", lua::wrap<l_get_mouse_pos>},
|
{"get_mouse_pos", lua::wrap<l_get_mouse_pos>},
|
||||||
{"get_mouse_delta", lua::wrap<l_get_mouse_delta>},
|
{"get_mouse_delta", lua::wrap<l_get_mouse_delta>},
|
||||||
|
{"get_mouse_scroll", lua::wrap<l_get_mouse_scroll>},
|
||||||
{"get_bindings", lua::wrap<l_get_bindings>},
|
{"get_bindings", lua::wrap<l_get_bindings>},
|
||||||
{"get_binding_text", lua::wrap<l_get_binding_text>},
|
{"get_binding_text", lua::wrap<l_get_binding_text>},
|
||||||
{"is_active", lua::wrap<l_is_active>},
|
{"is_active", lua::wrap<l_is_active>},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue