sunset := @use("../../../libraries/sunset_proto/src/lib.hb") render := @use("../../../libraries/render/src/lib.hb") intouch := @use("../../../libraries/intouch/src/lib.hb") main := fn(): void { screen := render.init(true) sunset.server.start() render.clear(screen, render.black) mouse_x := 0 mouse_y := 0 loop { mouse_event := intouch.recieve_mouse_event() if mouse_event != null { change_x := @as(i16, mouse_event.x_change) change_x = change_x << 8 change_x = change_x >> 8 mouse_x += change_x if mouse_x < 0 { mouse_x = 0 } if mouse_x >= screen.width - 20 { mouse_x = @intcast(screen.width - 21) } change_y := @as(i16, mouse_event.y_change) change_y = change_y << 8 change_y = change_y >> 8 if mouse_y < 0 { mouse_y = 0 } if mouse_y >= screen.height - 20 { mouse_y = @intcast(screen.height - 21) } mouse_y -= change_y if mouse_event.left { // set_label_text(text_label, "LEFT CLICK\0") } if mouse_event.middle { // set_label_text(text_label, "MIDDLE CLICK\0") } if mouse_event.right { // set_label_text(text_label, "RIGHT CLICK\0") } } { // render.clear(screen, render.black) } if sunset.server.incoming() { // render.clear(screen, render.black) // sunset.server.collect_frames() sunset.server.render_clients(screen) } // Mouse cursor { render.put_filled_rect(screen, .(mouse_x, mouse_y), .(20, 20), render.black) render.put_rect(screen, .(mouse_x, mouse_y), .(20, 20), render.white) } render.sync(screen) } }