System/wsr rst and state now work

This commit is contained in:
JJ Bliss
2026-04-26 18:35:41 -04:00
parent 1a4408cadf
commit aba1bbb4fd
2 changed files with 54 additions and 8 deletions
+38 -4
View File
@@ -124,7 +124,14 @@ export fn main() void = {
if(state.screen_vector != 0){
// fmt::println("Executing screen vector")!;
uxn::uxn_eval(state.screen_vector, state)!;
match (uxn::uxn_eval(state.screen_vector, state)) {
case done =>
yield;
case uxn::quit =>
run = false;
case let err: uxn::error =>
fmt::fatalf("Error evaluating: {}", uxn::strerror(err));
};
};
};
if(state.screen_size_changed){
@@ -223,17 +230,44 @@ export fn main() void = {
const x = ev.motion.x / scale: f32;
const y = ev.motion.y / scale: f32;
uxn::set_mouse_motion(x: u16,y: u16,state);
if(state.mouse_vector != 0 ) uxn::uxn_eval(state.mouse_vector,state)!;
if(state.mouse_vector != 0 ){
match (uxn::uxn_eval(state.mouse_vector, state)) {
case done =>
yield;
case uxn::quit =>
run = false;
case let err: uxn::error =>
fmt::fatalf("Error evaluating: {}", uxn::strerror(err));
};
};
case sdl3::EventType::MOUSE_BUTTON_DOWN =>
// fmt::printfln("Mouse Down: 0x{:x}", ev.button.button: u8 )!;
const b = 1 << (ev.button.button: u8 - 1);
uxn::set_mouse_down(b,state);
if(state.mouse_vector != 0 ) uxn::uxn_eval(state.mouse_vector,state)!;
if(state.mouse_vector != 0 ){
match (uxn::uxn_eval(state.mouse_vector, state)) {
case done =>
yield;
case uxn::quit =>
run = false;
case let err: uxn::error =>
fmt::fatalf("Error evaluating: {}", uxn::strerror(err));
};
};
case sdl3::EventType::MOUSE_BUTTON_UP =>
// fmt::printfln("Mouse Up: 0x{:x}", ev.button.button: u8 )!;
const b = 1 << (ev.button.button: u8 - 1);
uxn::set_mouse_up(b,state);
if(state.mouse_vector != 0 ) uxn::uxn_eval(state.mouse_vector,state)!;
if(state.mouse_vector != 0 ){
match (uxn::uxn_eval(state.mouse_vector, state)) {
case done =>
yield;
case uxn::quit =>
run = false;
case let err: uxn::error =>
fmt::fatalf("Error evaluating: {}", uxn::strerror(err));
};
};
case sdl3::EventType::MOUSE_WHEEL =>
fmt::printfln("Mouse Wheel!")!;
case sdl3::EventType::WINDOW_EXPOSED =>