diff options
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/embed/boot.lua.h | 5 | ||||
-rw-r--r-- | src/lua/embed/keyboard.lua.h | 2 | ||||
-rw-r--r-- | src/lua/modules/event/event.cpp | 2 | ||||
-rw-r--r-- | src/lua/modules/graphics/graphics.cpp | 4 |
4 files changed, 7 insertions, 6 deletions
diff --git a/src/lua/embed/boot.lua.h b/src/lua/embed/boot.lua.h index f7ffc43..35bfdfc 100644 --- a/src/lua/embed/boot.lua.h +++ b/src/lua/embed/boot.lua.h @@ -45,9 +45,9 @@ function jin.core.run() local current = previous while jin.core.running() do for _, e in pairs(jin.event.poll()) do - if e.type == "keydown" then + if e.type == "KeyDown" then jin.keyboard.set(e.key, true) - elseif e.type == "keyup" then + elseif e.type == "KeyUp" then jin.keyboard.set(e.key, false) end call(jin.core.onEvent, e) @@ -78,6 +78,7 @@ jin.core.setHandler = function(handler) jin.core.onDraw = handler.onDraw end +-- TODO: Ĭͼbase64 jin.nogame = { cs = 64, sw = jin.graphics.getWidth(), diff --git a/src/lua/embed/keyboard.lua.h b/src/lua/embed/keyboard.lua.h index 77bf3a9..ee8428f 100644 --- a/src/lua/embed/keyboard.lua.h +++ b/src/lua/embed/keyboard.lua.h @@ -4,7 +4,7 @@ jin.keyboard = jin.keyboard or {} local keys = {} -function jin.keyboard.isDown(k) +function jin.keyboard.isPressed(k) return keys[k] end diff --git a/src/lua/modules/event/event.cpp b/src/lua/modules/event/event.cpp index be54cf4..71b4a33 100644 --- a/src/lua/modules/event/event.cpp +++ b/src/lua/modules/event/event.cpp @@ -36,7 +36,7 @@ namespace lua case EventType::KEY_DOWN: case EventType::KEY_UP: - luax_setfieldstring(L, "type", EventType::KEY_DOWN ? "KeyDown" : "KeyUp"); + luax_setfieldstring(L, "type", e.type == EventType::KEY_DOWN ? "KeyDown" : "KeyUp"); luax_setfieldstring(L, "key", getKeyName(e.key.keysym.sym)); break; diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp index d374f51..679b820 100644 --- a/src/lua/modules/graphics/graphics.cpp +++ b/src/lua/modules/graphics/graphics.cpp @@ -260,7 +260,7 @@ namespace lua return 0; } - static int l_palette(lua_State * L) + static int l_getColor(lua_State * L) { luax_pushnumber(L, context.curRenderColor.r); luax_pushnumber(L, context.curRenderColor.g); @@ -541,7 +541,7 @@ namespace lua { "clear", l_clear }, { "draw", l_draw }, { "setColor", l_setColor }, - { "palette", l_palette }, + { "getColor", l_getColor }, { "present", l_present }, /* font */ { "box", l_box }, |