diff --git a/sysdata/libraries/intouch/src/events.hb b/sysdata/libraries/intouch/src/events.hb index 1d54423..0ede6d5 100644 --- a/sysdata/libraries/intouch/src/events.hb +++ b/sysdata/libraries/intouch/src/events.hb @@ -12,8 +12,8 @@ KeyEvent := struct { } MouseEvent := struct { - x_change: u8, - y_change: u8, + x_change: i8, + y_change: i8, left: u8, middle: u8, right: u8, diff --git a/sysdata/libraries/intouch/src/lib.hb b/sysdata/libraries/intouch/src/lib.hb index ebfde1b..a0e9b4d 100644 --- a/sysdata/libraries/intouch/src/lib.hb +++ b/sysdata/libraries/intouch/src/lib.hb @@ -16,7 +16,7 @@ recieve_key_event := fn(): ?KeyEvent { key_event := KeyEvent.(0, 0, 2) // return key_event - return null + // return null } recieve_mouse_event := fn(): ?MouseEvent { @@ -28,8 +28,8 @@ recieve_mouse_event := fn(): ?MouseEvent { buffer.recv(MouseEvent, buf_id, mem_page) if *mem_page != 0 { log.info("Mouse events\0") - dx := *mem_page - dy := *mem_page + 1 + dx := @as(i8, @bitcast(*mem_page)) + dy := @as(i8, @bitcast(*mem_page + 1)) mevent := MouseEvent.(dx, dy, 0, 0, 0) return mevent } diff --git a/sysdata/programs/horizon/src/main.hb b/sysdata/programs/horizon/src/main.hb index 5ac1a3a..624a659 100644 --- a/sysdata/programs/horizon/src/main.hb +++ b/sysdata/programs/horizon/src/main.hb @@ -65,14 +65,11 @@ main := fn(): int { // key_event := intouch.recieve_key_event(); // log.info("before mouse event check\0"); { - // Note: MLokis, this inline halts the compiler forever - // mouse_event := @inline(intouch.recieve_mouse_event) - // Note: MLokis, this function returns null unless the mouse is moving mouse_event := intouch.recieve_mouse_event() // if mouse_event != null { - log.warn("Mouse event recieved\0") + // log.warn("Mouse event recieved\0") mouse_x += mouse_event.x_change mouse_y += mouse_event.y_change @@ -85,20 +82,20 @@ main := fn(): int { // TODO: Get windows out of a collection and iter through - render.put_rect(screen, .(0, 0), .(screen.width - 1, screen.height - 1), render.white) - { - // Scroll bar :ThumbsUp: - render.put_rect(screen, .(100, 100), .(100, 10), render.white) - render.put_filled_rect(screen, .(110, 100), .(20, 10), render.white) + // render.put_rect(screen, .(0, 0), .(screen.width - 1, screen.height - 1), render.white) + // { + // // Scroll bar :ThumbsUp: + // render.put_rect(screen, .(100, 100), .(100, 10), render.white) + // render.put_filled_rect(screen, .(110, 100), .(20, 10), render.white) - render.put_rect(screen, .(90, 110), .(10, 100), render.white) - render.put_filled_rect(screen, .(90, 120), .(10, 20), render.white) - } + // render.put_rect(screen, .(90, 110), .(10, 100), render.white) + // render.put_filled_rect(screen, .(90, 120), .(10, 20), render.white) + // } - { - pos := Vec2(uint).(1, screen.height - 21) - render_label_to_surface(screen, text_label, font, pos) - } + // { + // pos := Vec2(uint).(1, screen.height - 21) + // render_label_to_surface(screen, text_label, font, pos) + // } // Sync the screen render.sync(screen) } diff --git a/sysdata/programs/ps2_mouse_driver/src/main.hb b/sysdata/programs/ps2_mouse_driver/src/main.hb index 1f66ada..5e74c07 100644 --- a/sysdata/programs/ps2_mouse_driver/src/main.hb +++ b/sysdata/programs/ps2_mouse_driver/src/main.hb @@ -144,12 +144,10 @@ main := fn(): int { dy.sign = (status & 0x20) == 0 if dy.value != 0 & dx.value != 0 { - y_change := dy.value - x_change := dx.value + y_change := @as(i8, @bitcast(dy.value)) + x_change := @as(i8, @bitcast(dx.value)) event := MouseEvent.(x_change, y_change, 0, 0, 0) buffer.write(MouseEvent, &event, mouse_buffer) - - // mouse_moved(.(dx, dy)) } } diff --git a/sysdata/programs/tests/src/main.hb b/sysdata/programs/tests/src/main.hb index 049e404..02cc278 100644 --- a/sysdata/programs/tests/src/main.hb +++ b/sysdata/programs/tests/src/main.hb @@ -1,19 +1,3 @@ -.{log, string, memory, buffer} := @use("../../../libraries/stn/src/lib.hb") - -service_search := fn(): void { - a := "\{01}\0" - @eca(3, 0, a, 2) - - return -} - main := fn(): int { - //service_search() - buf := "\0\0\0\0" - x := @as(int, 0) - loop if x > 255 break else { - log.info(string.display_int(x, buf, 2)) - x += 1 - } return 0 } \ No newline at end of file