Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDLK_ESCAPE wrong? #1

Open
nonchip opened this issue Jul 9, 2014 · 0 comments
Open

SDLK_ESCAPE wrong? #1

nonchip opened this issue Jul 9, 2014 · 0 comments

Comments

@nonchip
Copy link

nonchip commented Jul 9, 2014

I'm using sdl2-ffi in my YEng project, and try to handle the escape keypress, which doesn't work as expected. my code:

if event.type == Y.sdl.KEYUP then
  print(event.key.keysym.sym,Y.sdl.K.ESCAPE,type(event.key.keysym.sym),type(Y.sdl.K.ESCAPE))
end

output when pressing the escape key:

27 23 number number

Y.sdl defined as:

local core_sdl=require'sdl2'
local additional_sdl = {}
local meta_sdl = {
  __index = function(self, key)
    return additional_sdl[key]
  end
}
local meta_K={
  __index = function(self, key)
    return tonumber(core_sdl.C['SDLK_'..key])
  end
}
additional_sdl.K=setmetatable({},meta_K)
Y.sdl = setmetatable(core_sdl, meta_sdl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant