Skip to content

Event system refactors. #3

@HexDecimal

Description

@HexDecimal

Currently events are mainly handled by overriding UmbraModule::keyboard and UmbraModule::mouse. These are using libtcod's event system which has known issues. Mostly input lag or silently dropping events depending on how it's being used.

Several classes capture these events and handle them later in their update function. I think is a poor way of handing events and it makes it very hard to refactor them. Some of these might be replaceable with SDL_GetKeyboardState or SDL_GetMouseState.

The latest revision of Umbra adds UmbraModule::onEvent which handles SDL events, but due to how sensitive libtcod's event handing is combined with how the current code relies on several side effects, the event handing will be broken by updating to this version. Which means updating the code to use SDL for events will be a struggle.

Another thing is that SDL provides pixel coordinates which need to be converted by a libtcod function to tile coords for things like window management.

The plan is to remove all overrides of UmbraModule::keyboard and UmbraModule::mouse, and any other calls to libtcod's event system using whatever means possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions