diff --git a/data/main.lua b/data/main.lua index 47c142c..ea3de5a 100644 --- a/data/main.lua +++ b/data/main.lua @@ -21,6 +21,7 @@ function mini.init() s = surface.load("copy.gif") --draw.source(s) system.setBeat(4) + end function mini.update() @@ -42,26 +43,26 @@ function mini.update() end function normal_update() - if btnp(keyRight) then x=x+1 end - if btnp(keyLeft) then x=x-1 end - if btnp(KEY_SPACE) then + if keyboard.keyPressed(key.RIGHT) then x=x+1 end + if keyboard.keyPressed(key.LEFT) then x=x-1 end + if keyboard.keyPressed(key.SPACE) then redefinekeys.init() end - if btnp(KEY_ESCAPE) then - quit() + if keyboard.keyPressed(key.ESCAPE) then + system.quit() end - if btnp(KEY_F2) or mbtnp(1) then - local val = zoom() + 2 + if keyboard.keyPressed(key.F2) or mouse.buttonPressed(1) then + local val = window.getZoom() + 2 if val >= 10 then val = 2 end - zoom(val) - elseif btnp(KEY_F3) then - fullscreen(not fullscreen()) + window.setZoom(val) + elseif keyboard.keyPressed(key.F3) then + window.setFullscreen(not window.getFullscreen()) end - if x>160 then x=-strlen(text)*4 end + //if x>160 then x=-strlen(text)*4 end - clip() + viewport.setClippingclip() origin(0,0) cls(20) clip(10,10,140,100) diff --git a/lua.cpp b/lua.cpp index dee5cbf..17b2f69 100644 --- a/lua.cpp +++ b/lua.cpp @@ -161,14 +161,14 @@ extern "C" { } static int cpp_map_draw(lua_State *L) { - uint8_t celx = luaL_checknumber(L, 1); + /*uint8_t celx = luaL_checknumber(L, 1); uint8_t cely = luaL_checknumber(L, 2); int sx = luaL_checknumber(L, 3); int sy = luaL_checknumber(L, 4); uint8_t celw = luaL_checknumber(L, 5); uint8_t celh = luaL_checknumber(L, 6); - uint8_t layer = luaL_optinteger(L, 7, 0); - map(celx, cely, sx, sy, celw, celh, layer); + uint8_t layer = luaL_optinteger(L, 7, 0);*/ + map(); //celx, cely, sx, sy, celw, celh, layer); return 0; } @@ -626,14 +626,19 @@ extern "C" { return 1; } - static int cpp_sys_setTurbo(lua_State *L) { - if (lua_gettop(L) >= 1) { - setturbo(lua_toboolean(L, 1)); - return 0; - } else { - setturbo(true); - return 0; - } + static int cpp_sys_updateFullSpeed(lua_State *L) { + setupdatemode(UPDATE_ALWAYS); + return 0; + } + + static int cpp_sys_updateEvents(lua_State *L) { + setupdatemode(UPDATE_WAIT); + return 0; + } + + static int cpp_sys_updateTimeout(lua_State *L) { + setupdatemode(UPDATE_TIMEOUT, luaL_checknumber(L, 1)); + return 0; } static int cpp_sys_dir(lua_State *L) { @@ -785,8 +790,12 @@ extern "C" { } static int cpp_pad_press(lua_State *L) { - int8_t i = luaL_checkinteger(L, 1); - lua_pushboolean(L, padp(i)); + if (lua_gettop(L) >=1 ) { + int8_t i = luaL_checkinteger(L, 1); + lua_pushboolean(L, padp(i)); + } else { + lua_pushinteger(L, wpad()); + } return 1; } @@ -829,7 +838,7 @@ void push_lua_funcs() { lua_pushcfunction(L,cpp_map_draw); lua_setfield(L, -2, "draw"); lua_pushcfunction(L,cpp_map_getTile); lua_setfield(L, -2, "getTile"); lua_pushcfunction(L,cpp_map_setTile); lua_setfield(L, -2, "setTile"); - lua_setglobal(L, "map"); + lua_setglobal(L, "tilemap"); lua_newtable(L); lua_pushcfunction(L,cpp_pal_load); lua_setfield(L, -2, "load"); @@ -893,7 +902,9 @@ void push_lua_funcs() { lua_pushcfunction(L,cpp_sys_time); lua_setfield(L, -2, "getTime"); lua_pushcfunction(L,cpp_sys_setBeat); lua_setfield(L, -2, "setBeat"); lua_pushcfunction(L,cpp_sys_isBeat); lua_setfield(L, -2, "isBeat"); - lua_pushcfunction(L,cpp_sys_setTurbo); lua_setfield(L, -2, "setTurbo"); + lua_pushcfunction(L,cpp_sys_updateFullSpeed); lua_setfield(L, -2, "updateAtFullSpeed"); + lua_pushcfunction(L,cpp_sys_updateEvents); lua_setfield(L, -2, "updateOnlyOnEvents"); + lua_pushcfunction(L,cpp_sys_updateTimeout); lua_setfield(L, -2, "updateOnEventsAndTimeout"); lua_pushcfunction(L,cpp_sys_dir); lua_setfield(L, -2, "getFilesInDataDirectory"); lua_pushcfunction(L,cpp_sys_exit); lua_setfield(L, -2, "quit"); lua_setglobal(L, "system"); @@ -955,16 +966,16 @@ void push_lua_funcs() { lua_pushinteger(L, 27); lua_setfield(L, -2, "X"); lua_pushinteger(L, 28); lua_setfield(L, -2, "Y"); lua_pushinteger(L, 29); lua_setfield(L, -2, "Z"); - lua_pushinteger(L, 30); lua_setfield(L, -2, "1"); - lua_pushinteger(L, 31); lua_setfield(L, -2, "2"); - lua_pushinteger(L, 32); lua_setfield(L, -2, "3"); - lua_pushinteger(L, 33); lua_setfield(L, -2, "4"); - lua_pushinteger(L, 34); lua_setfield(L, -2, "5"); - lua_pushinteger(L, 35); lua_setfield(L, -2, "6"); - lua_pushinteger(L, 36); lua_setfield(L, -2, "7"); - lua_pushinteger(L, 37); lua_setfield(L, -2, "8"); - lua_pushinteger(L, 38); lua_setfield(L, -2, "9"); - lua_pushinteger(L, 39); lua_setfield(L, -2, "0"); + lua_pushinteger(L, 30); lua_setfield(L, -2, "N1"); + lua_pushinteger(L, 31); lua_setfield(L, -2, "N2"); + lua_pushinteger(L, 32); lua_setfield(L, -2, "N3"); + lua_pushinteger(L, 33); lua_setfield(L, -2, "N4"); + lua_pushinteger(L, 34); lua_setfield(L, -2, "N5"); + lua_pushinteger(L, 35); lua_setfield(L, -2, "N6"); + lua_pushinteger(L, 36); lua_setfield(L, -2, "N7"); + lua_pushinteger(L, 37); lua_setfield(L, -2, "N8"); + lua_pushinteger(L, 38); lua_setfield(L, -2, "N9"); + lua_pushinteger(L, 39); lua_setfield(L, -2, "N0"); lua_pushinteger(L, 40); lua_setfield(L, -2, "RETURN"); lua_pushinteger(L, 41); lua_setfield(L, -2, "ESCAPE"); lua_pushinteger(L, 42); lua_setfield(L, -2, "BACKSPACE"); diff --git a/mini.cpp b/mini.cpp index 57e2476..4cbc3fd 100644 --- a/mini.cpp +++ b/mini.cpp @@ -68,7 +68,9 @@ namespace ds { uint8_t draw_palette[256]; } -bool turbo_mode = true; +int update_mode = UPDATE_ALWAYS; +int timeout = 0; + bool should_exit = false; bool should_quit = false; SDL_Window *mini_win; @@ -390,7 +392,8 @@ int main(int argc,char*argv[]){ mouse_just_pressed = 0; while(!should_exit) { mouse_wheel = 0; - if (!turbo_mode) SDL_WaitEvent(NULL); + if (update_mode==UPDATE_WAIT) SDL_WaitEvent(NULL); + else if (update_mode==UPDATE_TIMEOUT) SDL_WaitEventTimeout(NULL, timeout); while(SDL_PollEvent(&mini_eve)) { if (mini_eve.type == SDL_QUIT) { should_exit=true; should_quit=true; break; } if (mini_eve.type == SDL_KEYDOWN) { @@ -1028,10 +1031,14 @@ void mset(int celx, int cely, uint8_t snum) { TILES(celx, cely) = snum; } -void map(int celx, int cely, int sx, int sy, uint8_t celw, uint8_t celh, uint8_t layer) { +void map() { //int celx, int cely, int sx, int sy, uint8_t celw, uint8_t celh, uint8_t layer) { if (map_surface==NULL) return; + uint8_t celw = map_surface->w >> 3; + uint8_t celh = map_surface->h >> 3; + int celx = 0; + int cely = 0; //if (celw <= 0 || celh <= 0 || celw >= TILES_WIDTH || celh >= TILES_HEIGHT) return; - sx -= ds::origin[0]; sy -= ds::origin[1]; + int sx = -ds::origin[0]; int sy = -ds::origin[1]; if (sx+celw*8 < ds::clip[0] || sx > ds::clip[2] || sy+celh*8 < ds::clip[1] || sy > ds::clip[3]) return; if (sx<0) { int diff = -sx/8; @@ -1240,8 +1247,9 @@ const char *configfolder() { return file_getconfigfolder(); } -void setturbo(const bool value) { - turbo_mode = value; +void setupdatemode(const int value, const int t) { + update_mode = value; + timeout = t; } void exit() { diff --git a/mini.h b/mini.h index 4e038bd..f6959a2 100644 --- a/mini.h +++ b/mini.h @@ -199,7 +199,7 @@ void tvline(int x, int y0, int y1, float mx, float my, float mdx=0.0f, float mdy uint8_t mget(int celx, int cely); void mset(int celx, int cely, uint8_t snum); -void map(int celx, int cely, int sx, int sy, uint8_t celw, uint8_t celh, uint8_t layer=0); +void map(); //int celx, int cely, int sx, int sy, uint8_t celw, uint8_t celh, uint8_t layer=0); bool btn(uint8_t i); int wbtnp(); @@ -247,6 +247,9 @@ const char *getconfig(const char* key); void setconfig(const char* key, const char* value); const char *configfolder(); -void setturbo(const bool value); +#define UPDATE_ALWAYS 0 +#define UPDATE_WAIT 1 +#define UPDATE_TIMEOUT 2 +void setupdatemode(const int value, const int t=0); void exit(); diff --git a/vscode/library.lua b/vscode/library.lua index 7846112..f789487 100644 --- a/vscode/library.lua +++ b/vscode/library.lua @@ -9,32 +9,737 @@ surface = {} ---@param w number ---@param h number ---@return number surface +---Create new surface specifying width and height function surface.new(w, h) end ---@param filename string ---@return number surface +---Load GIF file and return surface function surface.load(filename) end ---@param surface number ---@param filename string ---@optional palette table +---Save surface as GIF file, with optional palette function surface.save(surface, filename, palette) end ---@param surface number +---Free the specified surface function surface.free(surface) end ---@param surface number ---@return number w, number h +---Retrieve width and height of surface function surface.getSize(surface) end ---@param surface number +---Set surface as target function surface.setTarget(surface) end ----@param surface number -function surface.cls(surface) end +---@param color number +---Erase the current target surface with 'color' +function surface.cls(color) end ----@optional surface number +---@param surface number +---@param x number +---@param y number +---@param color number +---Set the color for pixel (x,y) in the specified surface. +function surface.setPixel(surface, x, y, color) end + +---@param surface number ---@param x number ---@param y number ---@return number color +---Get color of pixel (x,y) in the specified surface. function surface.getPixel(surface, x, y) end + +---@param x number +---@param y number +---@param color number +---Set the color for pixel (x,y) in the current target surface. +function surface.setPixel(x, y, color) end + +---@param x number +---@param y number +---@return number color +---Get color of pixel (x,y) in the current target +function surface.getPixel(x, y) end + +---@class tilemap +tilemap = {} + +---@param filename string +---@return number surface +---Load a tilemap from a file and set it as current tilemap +function tilemap.load(filename) end + +---@param filename string +---Save the current tilemap in a file +function tilemap.save(filename) end + +---@param surface number +---Set surface as the current tilemap +function tilemap.set(surface) end + +---Draw the tilemap +function tilemap.draw() end + +---@param x number +---@param y number +---@return number color +---Get tile at the position (x,y) in the current tilemap +function tilemap.getTile(x, y) end + +---@param x number +---@param y number +---@param tile number +---Set the tile at the position (x,y) in the current tilemap +function tilemap.setTile(x, y, tile) end + +---@class palette +palette = {} + +---@param filename string +---@return table pal +---Load a palette from a GIF file and return it +function palette.load(filename) end + +---@param pal table +---Set a specified palette as the current palette +function palette.set(pal) end + +---@param index number +---@return number r, number g, number b +---Retrieve (r,g,b) color for the index specified in the current palette +function palette.getColor(index) end + +---@param index number +---@param r number +---@param g number +---@param b number +---Set (r,g,b) color for the specified index in the current palette +function palette.setColor(index, r, g, b) end + +---@param index number +---Set the index specified as transparent color +function palette.setTransparent(index) end + +---@class subpalette +subpalette = {} + +---Reset all the subpalette indices to their default palette index +function subpalette.resetAll() end + +---@param index number +---@param color number +---Set the specified subpalette index to the specified palette index +function subpalette.set(index, color) end + +---@param index number +---Reset the specified subpalette index to its default palette index +function subpalette.reset(index) end + +---@param index1 number +---@param index2 number +---@param color number +---Set the specified subpalette range to the specified palette index +function subpalette.setRange(index1, index2, color) end + +---@param index1 number +---@param index2 number +---Reset the specified subpalette range to its default palette index +function subpalette.resetRange(index1, index2) end + +---@class viewport +viewport = {} + +---@param x number +---@param y number +---@param w number +---@param h number +---Set the current clipping region +function viewport.setClipping(x, y, w, h) end + +---@param x number +---@param y number +---Set the current origin position +function viewport.setOrigin(x, y) end + +---@return number x, number y +---Get the current origin position +function viewport.getOrigin() end + +---@param x number +---@param y number +---@return number x, number y +---Convert screen position to viewport position +function viewport.toLocal(x, y) end + +---@class draw +draw = {} + +---@param x1 number +---@param y1 number +---@param x2 number +---@param y2 number +---@param color number +---Draw a line from (x1,y1) to (x2,y2) with the given color +function draw.line(x1, y1, x2, y2, color) end + +---@param x1 number +---@param y number +---@param x2 number +---@param color number +---Draw an horizontal line from (x1,y) to (x2,y) with the given color +function draw.hline(x1, y, x2, color) end + +---@param x number +---@param y1 number +---@param y2 number +---@param color number +---Draw a vertical line from (x,y1) to (x,y2) with the givencolor +function draw.vline(x, y1, y2, color) end + +---@param x1 number +---@param y1 number +---@param x2 number +---@param y2 number +---@param color number +---Draw the ouline of a rectangle from (x1,y1) to (x2,y2) with the given color +function draw.rect(x1, y1, x2, y2, color) end + +---@param x1 number +---@param y1 number +---@param x2 number +---@param y2 number +---@param color number +---Draw a filled rectangle from (x1,y1) to (x2,y2) with the given color +function draw.rectFill(x1, y1, x2, y2, color) end + +---@param x number +---@param y number +---@param r number +---@param color number +---Draw the outline of a cicle at position(x,y) with radius r and the given color +function draw.circ(x, y, r, color) end + +---@param x number +---@param y number +---@param r number +---@param color number +---Draw a filled cicle at position(x,y) with radius r and the given color +function draw.circFill(x, y, r, color) end + +---@param x1 number +---@param y1 number +---@param x2 number +---@param y2 number +---@param color number +---Draw the outline of an oval enclosed in (x1,y1)-(x2,y2) and the given color +function draw.oval(x1, y1, x2, y2, color) end + +---@param x1 number +---@param y1 number +---@param x2 number +---@param y2 number +---@param color number +---Draw a filled oval enclosed in (x1,y1)-(x2,y2) and the given color +function draw.ovalFill(x1, y1, x2, y2, color) end + +---@param pattern number +---Specify a pattern for the drawing functions +function draw.setPattern(pattern) end + +---@param surface number +---@param sx number +---@param sy number +---@param sw number +---@param sh number +---@param dx number +---@param dy number +---@optional dw number +---@optional dh number +---@optional boolean flip_x +---@optional boolean flip_y +---@optional boolean invert +---Blit the region starting at (sx,sy) and size (sw, sh) from the specified surface +---to the position (dx, dy) (and optionally of size (dw, dh)) to the target surface, +---optionally flipping it horizontally or vertically, or inverting x and y axes +function draw.surface(surface, sx, sy, sw, sh, dx, dy, dw, dh, flip_x, flip_y, invert) end + +---@param surface number +---@param sx number +---@param sy number +---@param sw number +---@param sh number +---@param x number +---@param y number +---@param a number +---Blit the region starting at (sx,sy) and size (sw, sh) from the specified surface +---to the position (dx, dy) of the target surface, rotating it by a degrees +function draw.surfaceRotated(surface, sx, sy, sw, sh, x, y, a) end + +---@param text string +---@param x number +---@param y number +---@param color number +---Draw text to (x,y) using the specified color +function draw.text(text, x, y, color) end + +---@class music +music = {} + +---@param filename string +---Load and play the song in the specified OGG file +function music.play(filename) end + +---Pause the currently playing song +function music.pause() end + +---Resume the currently paused song +function music.resume() end + +---Stop the currently playing song +function music.stop() end + +---@param pos number +---Set the playing position of the currently loaded song +function music.setPosition(pos) end + +---@return number pos +---Get the playing position of the currently loaded song +function music.getPosition() end + +---@class sound +sound = {} + +---@param filename string +---@return number snd +---Load a sound in WAV format from the specified file and return it +function sound.load(filename) end + +---@param snd number +---Free the sound specified +function sound.free(snd) end + +---@param snd number +---@return number chl +---Play the sound specified, returns the channel in which it's playing +function sound.play(snd) end + +---@param chl number +---Stop the channel specified +function sound.stop(chl) end + +---@class system +system = {} + +---Get current system timer in seconds (with decimals) +function system.getTime() end + +---@param bts number +---Set number of frames between beats +function system.setBeat(bts) end + +---@return boolean +---Query if a beat has already passed +function system.isBeat() end + +---The game will call mini.update as fast as possible +function system.updateAtFullSpeed() end + +---The game will call mini.update only when a keyboard, mouse or pad event fires +function system.updateOnlyOnEvents() end + +---@param ms number +---The game will call mini.update on events or after the milliseconds specified passed +function system.updateOnEventsAndTimeout(ms) end + +---@return table +---Gets a table with the name of each file in the data directory +function system.getFilesInDataDirectory() end + +---Exit the game +function system.quit() end + +---@class window +window = {} + +---@param value number +---Set the window zoom +function window.setZoom(value) end + +---@return number value +---Get the window zoom +function window.getZoom() end + +---@param value boolean +---Specifies if the window must display at fullscreen or not +function window.setFullscreen(value) end + +---@return boolean value +---Returns if the window is at fullscreen or not +function window.getFullscreen() end + +---@param value boolean +---Specifies if the cursor must be visible or not +function window.showCursor(value) end + +---@return number w, number h +---Returns the current window size +function window.getResolution() end + +---@param w number +---@param h number +---Sets the window size +function window.setResolution(w, h) end + + +---@class config +config = {} + +---@param key string +---@param value string +---Sets the value of a key in the configuration file +function config.setKey(key, value) end + +---@param key string +---@return string value +---Gets the value of a key in the configuration file +function config.getKey(key) end + +---@return string value +---Returns the folder in which the configuration file resides +function config.getConfigFolder() end + + +---@class mouse +mouse = {} + +---@return number x, number y +---Returns the current position of the mouse +function mouse.getPos() end + +---@return number value +---Returns the value of the mouse wheel +function mouse.getWheel() end + +---@param btn number +---@return boolean +---Returns whether the specified mouse button is down +function mouse.buttonDown(btn) end + +---@param btn number +---@return boolean +---Returns whether the specified mouse button has just been pressed +function mouse.buttonPressed(btn) end + +---@class keyboard +keyboard = {} + +---@param key number +---@return boolean +---Returns whether the specified keyboard key is down +function keyboard.keyDown(key) end + +---@return number +---Returns which keyboard key has just been pressed +function keyboard.keyPressed() end + +---@param key number +---@return boolean +---Returns whether the specified keyboard key has just been pressed +function keyboard.keyPressed(key) end + +---@return boolean +---Returns whether any keyboard key has just been pressed +function keyboard.anyKeyPressed() end + + +---@class gamepad +gamepad = {} + +---@param btn number +---@return boolean +---Returns whether the specified gamepad button is down +function gamepad.buttonDown(btn) end + +---@return number +---Returns which gamepad button has just been pressed +function gamepad.buttonPressed() end + +---@param btn number +---@return boolean +---Returns whether the specified gamepad button has just been pressed +function gamepad.buttonPressed(btn) end + +---@return boolean +---Returns whether any gamepad button has just been pressed +function gamepad.anybuttonPressed() end + +---@class key +---@field key.UNKNOWN number +---@field key.A number +---@field key.B number +---@field key.C number +---@field key.D number +---@field key.E number +---@field key.F number +---@field key.G number +---@field key.H number +---@field key.I number +---@field key.J number +---@field key.K number +---@field key.L number +---@field key.M number +---@field key.N number +---@field key.O number +---@field key.P number +---@field key.Q number +---@field key.R number +---@field key.S number +---@field key.T number +---@field key.U number +---@field key.V number +---@field key.W number +---@field key.X number +---@field key.Y number +---@field key.Z number +---@field key.1 number +---@field key.2 number +---@field key.3 number +---@field key.4 number +---@field key.5 number +---@field key.6 number +---@field key.7 number +---@field key.8 number +---@field key.9 number +---@field key.0 number +---@field key.RETURN number +---@field key.ESCAPE number +---@field key.BACKSPACE number +---@field key.TAB number +---@field key.SPACE number +---@field key.MINUS number +---@field key.EQUALS number +---@field key.LEFTBRACKET number +---@field key.RIGHTBRACKET number +---@field key.BACKSLASH number +---@field key.NONUSHASH number +---@field key.SEMICOLON number +---@field key.APOSTROPHE number +---@field key.GRAVE number +---@field key.COMMA number +---@field key.PERIOD number +---@field key.SLASH number +---@field key.CAPSLOCK number +---@field key.F1 number +---@field key.F2 number +---@field key.F3 number +---@field key.F4 number +---@field key.F5 number +---@field key.F6 number +---@field key.F7 number +---@field key.F8 number +---@field key.F9 number +---@field key.F10 number +---@field key.F11 number +---@field key.F12 number +---@field key.PRINTSCREEN number +---@field key.SCROLLLOCK number +---@field key.PAUSE number +---@field key.INSERT number +---@field key.HOME number +---@field key.PAGEUP number +---@field key.DELETE number +---@field key.END number +---@field key.PAGEDOWN number +---@field key.RIGHT number +---@field key.LEFT number +---@field key.DOWN number +---@field key.UP number +---@field key.NUMLOCKCLEAR number +---@field key.KP_DIVIDE number +---@field key.KP_MULTIPLY number +---@field key.KP_MINUS number +---@field key.KP_PLUS number +---@field key.KP_ENTER number +---@field key.KP_1 number +---@field key.KP_2 number +---@field key.KP_3 number +---@field key.KP_4 number +---@field key.KP_5 number +---@field key.KP_6 number +---@field key.KP_7 number +---@field key.KP_8 number +---@field key.KP_9 number +---@field key.KP_0 number +---@field key.KP_PERIOD number +---@field key.NONUSBACKSLASH number +---@field key.APPLICATION number +---@field key.LCTRL number +---@field key.LSHIFT number +---@field key.LALT number +---@field key.LGUI number +---@field key.RCTRL number +---@field key.RSHIFT number +---@field key.RALT number +---@field key.RGUI number +key = {} +key.UNKNOWN = 0 +key.A = 4 +key.B = 5 +key.C = 6 +key.D = 7 +key.E = 8 +key.F = 9 +key.G = 10 +key.H = 11 +key.I = 12 +key.J = 13 +key.K = 14 +key.L = 15 +key.M = 16 +key.N = 17 +key.O = 18 +key.P = 19 +key.Q = 20 +key.R = 21 +key.S = 22 +key.T = 23 +key.U = 24 +key.V = 25 +key.W = 26 +key.X = 27 +key.Y = 28 +key.Z = 29 +key.N1 = 30 +key.N2 = 31 +key.N3 = 32 +key.N4 = 33 +key.N5 = 34 +key.N6 = 35 +key.N7 = 36 +key.N8 = 37 +key.N9 = 38 +key.N0 = 39 +key.RETURN = 40 +key.ESCAPE = 41 +key.BACKSPACE = 42 +key.TAB = 43 +key.SPACE = 44 +key.MINUS = 45 +key.EQUALS = 46 +key.LEFTBRACKET = 47 +key.RIGHTBRACKET = 48 +key.BACKSLASH = 49 +key.NONUSHASH = 50 +key.SEMICOLON = 51 +key.APOSTROPHE = 52 +key.GRAVE = 53 +key.COMMA = 54 +key.PERIOD = 55 +key.SLASH = 56 +key.CAPSLOCK = 57 +key.F1 = 58 +key.F2 = 59 +key.F3 = 60 +key.F4 = 61 +key.F5 = 62 +key.F6 = 63 +key.F7 = 64 +key.F8 = 65 +key.F9 = 66 +key.F10 = 67 +key.F11 = 68 +key.F12 = 69 +key.PRINTSCREEN = 70 +key.SCROLLLOCK = 71 +key.PAUSE = 72 +key.INSERT = 73 +key.HOME = 74 +key.PAGEUP = 75 +key.DELETE = 76 +key.END = 77 +key.PAGEDOWN = 78 +key.RIGHT = 79 +key.LEFT = 80 +key.DOWN = 81 +key.UP = 82 +key.NUMLOCKCLEAR = 83 +key.KP_DIVIDE = 84 +key.KP_MULTIPLY = 85 +key.KP_MINUS = 86 +key.KP_PLUS = 87 +key.KP_ENTER = 88 +key.KP_1 = 89 +key.KP_2 = 90 +key.KP_3 = 91 +key.KP_4 = 92 +key.KP_5 = 93 +key.KP_6 = 94 +key.KP_7 = 95 +key.KP_8 = 96 +key.KP_9 = 97 +key.KP_0 = 98 +key.KP_PERIOD = 99 +key.NONUSBACKSLASH = 100 +key.APPLICATION = 101 +key.LCTRL = 224 +key.LSHIFT = 225 +key.LALT = 226 +key.LGUI = 227 +key.RCTRL = 228 +key.RSHIFT = 229 +key.RALT = 230 +key.RGUI = 231 + + +---@class button +---@field button.INVALID number +---@field button.A number +---@field button.B number +---@field button.X number +---@field button.Y number +---@field button.BACK number +---@field button.GUIDE number +---@field button.START number +---@field button.LEFTSTICK number +---@field button.RIGHTSTICK number +---@field button.LEFTSHOULDER number +---@field button.RIGHTSHOULDER number +---@field button.UP number +---@field button.DOWN number +---@field button.LEFT number +---@field button.RIGHT number +---@field button.MISC1 number +---@field button.PADDLE1 number +---@field button.PADDLE2 number +---@field button.PADDLE3 number +---@field button.PADDLE4 number +---@field button.TOUCHPAD number + +button = {} +button.INVALID = -1 +button.A = 0 +button.B = 1 +button.X = 2 +button.Y = 3 +button.BACK = 4 +button.GUIDE = 5 +button.START = 6 +button.LEFTSTICK = 7 +button.RIGHTSTICK = 8 +button.LEFTSHOULDER = 9 +button.RIGHTSHOULDER = 10 +button.UP = 11 +button.DOWN = 12 +button.LEFT = 13 +button.RIGHT = 14 +button.MISC1 = 15 +button.PADDLE1 = 16 +button.PADDLE2 = 17 +button.PADDLE3 = 18 +button.PADDLE4 = 19 +button.TOUCHPAD = 20 \ No newline at end of file