changes or something idk

This commit is contained in:
Able 2024-11-09 20:44:08 -06:00
parent 8b04b275f3
commit 7723799e76
5 changed files with 20 additions and 41 deletions

View file

@ -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,

View file

@ -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
}

View file

@ -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)
}

View file

@ -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))
}
}

View file

@ -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
}