/
antim
/
LuaPlayer-by-YuliaTeam
Обзор
Документация
Войти
/
antim
/
LuaPlayer-by-YuliaTeam
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
lua/ctrl.c
120 строк
6 KB
antim0118
Заменил заголовки файлов
25 фев 2026, 22:25
25 фев 2026, 22:25
842b6c8
Код
Авторство
О чём код?
/*-----------------------------------------------------------------------------------------------------------------------# #------------- This file is part of: ------------------------------------------------------------------------------------# #---█████----------------------------███████████--████------------------------------------------█████-█████-███████████--# #--░░███----------------------------░░███░░░░░███░░███-----------------------------------------░░███-░░███-░█░░░███░░░█--# #---░███--------█████-████--██████---░███----░███-░███---██████---█████-████--██████--████████--░░███-███--░---░███--░---# #---░███-------░░███-░███--░░░░░███--░██████████--░███--░░░░░███-░░███-░███--███░░███░░███░░███--░░█████-------░███------# #---░███--------░███-░███---███████--░███░░░░░░---░███---███████--░███-░███-░███████--░███-░░░----░░███--------░███------# #---░███------█-░███-░███--███░░███--░███---------░███--███░░███--░███-░███-░███░░░---░███---------░███--------░███------# #---███████████-░░████████░░████████-█████--------█████░░████████-░░███████-░░██████--█████--------█████-------█████-----# #--░░░░░░░░░░░---░░░░░░░░--░░░░░░░░-░░░░░--------░░░░░--░░░░░░░░---░░░░░███--░░░░░░--░░░░░--------░░░░░-------░░░░░------# #------------------------------------------------------------------███-░███----------------------------------------------# #-----------------------------------------------------------------░░██████-----------------------------------------------# #------------------------------------------------------------------░░░░░░------------------------------------------------# #------------------------------------------------------------------------------------ Made by Kodilo --------------------# #- Special Thanks to: ---------------------------------------------------------------------------------------------------# #------------------------------------------------------------------------------------------------------------------------# #- BenHur for intraFont -------------------------------------------------------------------------------------------------# #- Geecko for gLib2D ----------------------------------------------------------------------------------------------------# #- Arshia001 for PSPAALIB -----------------------------------------------------------------------------------------------# #- jonny & Raphael for PMP Mod ------------------------------------------------------------------------------------------# #- InsertWittyName & MK2k for PGE source code ---------------------------------------------------------------------------# #- Rinnegatamante & Nanni for example of awesome Lua Player -------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------*/ #include "ctrl.h" static int CTRL_read(lua_State *L) { if (lua_gettop(L) != 0) return luaL_error(L, "buttons.read() takes no arguments"); controls_read(); return 0; } static int CTRL_press(lua_State *L) { if (lua_gettop(L) != 1) return luaL_error(L, "buttons.pressed(button) takes 1 argument"); unsigned int buttons = luaL_checknumber(L, 1); lua_pushboolean(L, controls_pressed(buttons)); return 1; } static int CTRL_held(lua_State *L) { if (lua_gettop(L) != 1) return luaL_error(L, "buttons.held(button) takes 1 argument"); unsigned int buttons = luaL_checknumber(L, 1); lua_pushboolean(L, controls_held(buttons)); return 1; } static int CTRL_released(lua_State *L) { if (lua_gettop(L) != 1) return luaL_error(L, "buttons.released(button) takes 1 argument"); unsigned int buttons = luaL_checknumber(L, 1); lua_pushboolean(L, controls_released(buttons)); return 1; } static int CTRL_AnalogX(lua_State *L) { if (lua_gettop(L) != 0) return luaL_error(L, "buttons.Lx() takes no arguments"); lua_pushnumber(L, controls_AnalogX()); return 1; } static int CTRL_AnalogY(lua_State *L) { if (lua_gettop(L) != 0) return luaL_error(L, "buttons.Ly() takes no arguments"); lua_pushnumber(L, controls_AnalogY()); return 1; } static const luaL_Reg CTRL_methods[] = { {"read", CTRL_read}, {"pressed", CTRL_press}, {"held", CTRL_held}, {"released", CTRL_released}, {"Lx", CTRL_AnalogX}, {"Ly", CTRL_AnalogY}, {0, 0} }; int CTRL_init(lua_State *L) { controls_init(); luaL_register(L, "buttons", CTRL_methods); lua_pushstring(L, "buttons"); lua_gettable(L, LUA_GLOBALSINDEX); Const("select", PSP_CTRL_SELECT); Const("home", PSP_CTRL_HOME); Const("start", PSP_CTRL_START); Const("up", PSP_CTRL_UP); Const("right", PSP_CTRL_RIGHT); Const("down", PSP_CTRL_DOWN); Const("left", PSP_CTRL_LEFT); Const("l", PSP_CTRL_LTRIGGER); Const("r", PSP_CTRL_RTRIGGER); Const("triangle", PSP_CTRL_TRIANGLE); Const("circle", PSP_CTRL_CIRCLE); Const("cross", PSP_CTRL_CROSS); Const("square", PSP_CTRL_SQUARE); return 0; }