Refactor context handling and redraw requests

Remove unsafe pointer shenanigans and give Lua instance ownership over
`Context`. Event handlers now directly mutate Context instead of using a
shared app state which is then hooked up to Context via unsafe pointers.
The removal of a shared state means stages (previously called "modes")
are now responsible for keeping their own internal state.

Additionally, clean up draw request handling and module hierarchy.
This commit is contained in:
meehl committed 2026-08-23 23:55:43 +02:00
1 parent 337e876571
commit cc6de120f2
27 files changed
+803 -876

No files matched your search

+5 -5
View File
@@ -34,17 +34,17 @@ pub struct InputState {
impl InputState {
/// Updates [`Self::keys_pressed`] based on `is_pressed`.
pub fn set_key_pressed(&mut self, key: Key, is_pressed: bool) {
pub fn set_key_pressed(&mut self, key: &Key, is_pressed: bool) {
if is_pressed {
self.keys_pressed.insert(key);
self.keys_pressed.insert(key.clone());
} else {
self.keys_pressed.remove(&key);
self.keys_pressed.remove(key);
}
}
/// Returns if the key is pressed (`true`) or not pressed (`false`).
pub fn key_pressed(&self, key: Key) -> bool {
self.keys_pressed.contains(&key)
pub fn key_pressed(&self, key: &Key) -> bool {
self.keys_pressed.contains(key)
}
/// Updates [`Self::mouse_pressed`](field@Self::mouse_pressed) based on provided