cptx032 / calcium

A ascii/text game library
MIT License
17 stars 2 forks source link

create a "Scene" class and bind events to it #19

Closed cptx032 closed 6 years ago

cptx032 commented 6 years ago

Today the events are binded to core.GenericWindow, that is, to the Window/terminal it self. This is not much practical if we have many game states. So the idea is that you can bind the events to different scenes, so when you switch the scene the binds are "updated".

"Automatic binds" like "ESC" must be made ate scene level

The new schema (in json, just to have an idea) could be:

window = {
    "scenes": [
        {
                "name": "scene_name",
                "binds": [..., ...]
        }
    ],
    "actual_scene": "scene_name"
}