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

fix: improves in the ginga input #58

Open
RodrigoDornelles opened this issue Aug 27, 2024 · 0 comments
Open

fix: improves in the ginga input #58

RodrigoDornelles opened this issue Aug 27, 2024 · 0 comments
Labels
Core Team responsibility for project maintainers.

Comments

@RodrigoDornelles
Copy link
Member

This is a temporary solution, but the definitive one could be a mix of the current one and this one.

local function event_loop(std, evt)
    if evt.class ~= 'key' then return end
    if not key_bindings[evt.key] then return end
    std.key.frame = 1
    std.key.press[key_bindings[evt.key]] = 1
end

local function install(std, game, application)
    std = std or {}
    std.key.frame = 0
    application.internal.fixed_loop[#application.internal.fixed_loop + 1] = function()
        if std.key.frame == 2 then
            std.key.frame = 0
            std.key.press.up=0
            std.key.press.down=0
            std.key.press.left=0
            std.key.press.right=0
            std.key.press.red=0
            std.key.press.green=0
            std.key.press.yellow=0
            std.key.press.blue=0
            std.key.press.enter=0
            std.key.press.back=0
        end
        std.key.frame = std.key.frame + std.key.frame
    end
    application.internal.event_loop[#application.internal.event_loop + 1] = function (evt)
        event_loop(std, evt)
    end
    return std
end
@RodrigoDornelles RodrigoDornelles added the Core Team responsibility for project maintainers. label Aug 27, 2024
@RodrigoDornelles RodrigoDornelles modified the milestone: 0.0.5 Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Team responsibility for project maintainers.
Projects
None yet
Development

No branches or pull requests

1 participant