forked from AbleOS/ableos
changes or something idk
This commit is contained in:
parent
8b04b275f3
commit
7723799e76
|
@ -12,8 +12,8 @@ KeyEvent := struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseEvent := struct {
|
MouseEvent := struct {
|
||||||
x_change: u8,
|
x_change: i8,
|
||||||
y_change: u8,
|
y_change: i8,
|
||||||
left: u8,
|
left: u8,
|
||||||
middle: u8,
|
middle: u8,
|
||||||
right: u8,
|
right: u8,
|
||||||
|
|
|
@ -16,7 +16,7 @@ recieve_key_event := fn(): ?KeyEvent {
|
||||||
key_event := KeyEvent.(0, 0, 2)
|
key_event := KeyEvent.(0, 0, 2)
|
||||||
// return key_event
|
// return key_event
|
||||||
|
|
||||||
return null
|
// return null
|
||||||
}
|
}
|
||||||
|
|
||||||
recieve_mouse_event := fn(): ?MouseEvent {
|
recieve_mouse_event := fn(): ?MouseEvent {
|
||||||
|
@ -28,8 +28,8 @@ recieve_mouse_event := fn(): ?MouseEvent {
|
||||||
buffer.recv(MouseEvent, buf_id, mem_page)
|
buffer.recv(MouseEvent, buf_id, mem_page)
|
||||||
if *mem_page != 0 {
|
if *mem_page != 0 {
|
||||||
log.info("Mouse events\0")
|
log.info("Mouse events\0")
|
||||||
dx := *mem_page
|
dx := @as(i8, @bitcast(*mem_page))
|
||||||
dy := *mem_page + 1
|
dy := @as(i8, @bitcast(*mem_page + 1))
|
||||||
mevent := MouseEvent.(dx, dy, 0, 0, 0)
|
mevent := MouseEvent.(dx, dy, 0, 0, 0)
|
||||||
return mevent
|
return mevent
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,14 +65,11 @@ main := fn(): int {
|
||||||
// key_event := intouch.recieve_key_event();
|
// key_event := intouch.recieve_key_event();
|
||||||
// log.info("before mouse event check\0");
|
// 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()
|
mouse_event := intouch.recieve_mouse_event()
|
||||||
//
|
//
|
||||||
|
|
||||||
if mouse_event != null {
|
if mouse_event != null {
|
||||||
log.warn("Mouse event recieved\0")
|
// log.warn("Mouse event recieved\0")
|
||||||
|
|
||||||
mouse_x += mouse_event.x_change
|
mouse_x += mouse_event.x_change
|
||||||
mouse_y += mouse_event.y_change
|
mouse_y += mouse_event.y_change
|
||||||
|
@ -85,20 +82,20 @@ main := fn(): int {
|
||||||
|
|
||||||
// TODO: Get windows out of a collection and iter through
|
// TODO: Get windows out of a collection and iter through
|
||||||
|
|
||||||
render.put_rect(screen, .(0, 0), .(screen.width - 1, screen.height - 1), render.white)
|
// render.put_rect(screen, .(0, 0), .(screen.width - 1, screen.height - 1), render.white)
|
||||||
{
|
// {
|
||||||
// Scroll bar :ThumbsUp:
|
// // Scroll bar :ThumbsUp:
|
||||||
render.put_rect(screen, .(100, 100), .(100, 10), render.white)
|
// render.put_rect(screen, .(100, 100), .(100, 10), render.white)
|
||||||
render.put_filled_rect(screen, .(110, 100), .(20, 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_rect(screen, .(90, 110), .(10, 100), render.white)
|
||||||
render.put_filled_rect(screen, .(90, 120), .(10, 20), render.white)
|
// render.put_filled_rect(screen, .(90, 120), .(10, 20), render.white)
|
||||||
}
|
// }
|
||||||
|
|
||||||
{
|
// {
|
||||||
pos := Vec2(uint).(1, screen.height - 21)
|
// pos := Vec2(uint).(1, screen.height - 21)
|
||||||
render_label_to_surface(screen, text_label, font, pos)
|
// render_label_to_surface(screen, text_label, font, pos)
|
||||||
}
|
// }
|
||||||
// Sync the screen
|
// Sync the screen
|
||||||
render.sync(screen)
|
render.sync(screen)
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,12 +144,10 @@ main := fn(): int {
|
||||||
dy.sign = (status & 0x20) == 0
|
dy.sign = (status & 0x20) == 0
|
||||||
|
|
||||||
if dy.value != 0 & dx.value != 0 {
|
if dy.value != 0 & dx.value != 0 {
|
||||||
y_change := dy.value
|
y_change := @as(i8, @bitcast(dy.value))
|
||||||
x_change := dx.value
|
x_change := @as(i8, @bitcast(dx.value))
|
||||||
event := MouseEvent.(x_change, y_change, 0, 0, 0)
|
event := MouseEvent.(x_change, y_change, 0, 0, 0)
|
||||||
buffer.write(MouseEvent, &event, mouse_buffer)
|
buffer.write(MouseEvent, &event, mouse_buffer)
|
||||||
|
|
||||||
// mouse_moved(.(dx, dy))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
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
|
return 0
|
||||||
}
|
}
|
Loading…
Reference in a new issue