Engine 0.0.6
Game engine in lua
Loading...
Searching...
No Matches
keys.lua
Go to the documentation of this file.
1local fixture190 = ''
2local key_bindings={
3 CURSOR_UP='up',
4 CURSOR_DOWN='down',
5 CURSOR_LEFT='left',
6 CURSOR_RIGHT='right',
7 RED='red',
8 GREEN='green',
9 YELLOW='yellow',
10 BLUE='blue',
11 F6='red',
12 z='red',
13 x='green',
14 c='yellow',
15 v='blue',
16 ENTER='enter'
17}
18
19--! @li https://github.com/TeleMidia/ginga/issues/190
20local function event_ginga(std, game, application, evt)
21 if evt.class ~= 'key' then return end
22 if not key_bindings[evt.key] then return end
23
24 if #fixture190 == 0 and evt.key ~= 'ENTER' then
25 fixture190 = evt.type
26 end
27
28 if fixture190 == evt.type then
29 std.key.press[key_bindings[evt.key]] = 1
30 else
31 std.key.press[key_bindings[evt.key]] = 0
32 end
33end
34
35local function install(std, game, application)
36 application.callbacks.loop = application.callbacks.loop or function () end
37
38 return {
39 event={ginga=event_ginga}
40 }
41end
42
43local P = {
45}
46
47return P
local application
Definition main.lua:16
local game
Definition main.lua:17
local std
Definition main.lua:18
local function install(std, lgame, application, ginga)
local fixture190
Definition keys.lua:1