Input work
This commit is contained in:
parent
f5f68bc2df
commit
0bc757164f
|
@ -1,6 +1,8 @@
|
|||
stn := @use("rel:../../stn/src/lib.hb");
|
||||
.{string, memory, buffer} := stn
|
||||
|
||||
input := @use("rel:../../intouch/src/lib.hb")
|
||||
|
||||
WindowID := struct {
|
||||
host_id: int,
|
||||
window_id: int,
|
||||
|
@ -14,11 +16,10 @@ create_window := fn(channel: int): void {
|
|||
windowing_system_buffer := buffer.search("XHorizon\0")
|
||||
|
||||
if windowing_system_buffer == 0 {
|
||||
return
|
||||
} else {
|
||||
msg := "\{01}\0"
|
||||
msg_length := 2
|
||||
@eca(void, 3, windowing_system_buffer, msg, msg_length)
|
||||
return @eca(3, windowing_system_buffer, msg, msg_length)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
20
sysdata/libraries/intouch/README.md
Normal file
20
sysdata/libraries/intouch/README.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# intouch
|
||||
This library is exclusively focused on allowing your to get input regardless of which devices you have.
|
||||
|
||||
Partially modeled after SDL.
|
||||
|
||||
Current goals include
|
||||
- Interfaces
|
||||
- PS/2
|
||||
- Device Types
|
||||
- Keyboard
|
||||
- Mouse
|
||||
|
||||
Longer Term goals
|
||||
- Interfaces
|
||||
- USB
|
||||
- USB-HID
|
||||
- Device Types
|
||||
- Gamepads/controllers
|
||||
- Drawing Tablets
|
||||
- Microphones
|
2
sysdata/libraries/intouch/key_maps/ps2.map
Normal file
2
sysdata/libraries/intouch/key_maps/ps2.map
Normal file
|
@ -0,0 +1,2 @@
|
|||
0x0D -> press Tab
|
||||
0xF0 0x0D -> release Tab
|
8
sysdata/libraries/intouch/src/keycodes.hb
Normal file
8
sysdata/libraries/intouch/src/keycodes.hb
Normal file
|
@ -0,0 +1,8 @@
|
|||
KeyCode := u32
|
||||
|
||||
// https://www.libsdl.org/release/SDL-1.2.15/include/SDL_keysym.h
|
||||
Backspace := KeyCode.(8)
|
||||
Tab := KeyCode.(9)
|
||||
Clear := KeyCode.(12)
|
||||
Return := KeyCode.(13)
|
||||
Pause := KeyCode.(19)
|
22
sysdata/libraries/intouch/src/lib.hb
Normal file
22
sysdata/libraries/intouch/src/lib.hb
Normal file
|
@ -0,0 +1,22 @@
|
|||
keycodes := @use("rel:keycodes.hb");
|
||||
.{KeyCode} := keycodes
|
||||
|
||||
MouseEvent := struct {
|
||||
x_change: u8,
|
||||
y_change: u8,
|
||||
left: u8,
|
||||
middle: u8,
|
||||
right: u8,
|
||||
}
|
||||
|
||||
KeyEvent := struct {
|
||||
// 0 if down
|
||||
// 1 if up
|
||||
up: u8,
|
||||
// 0 if not just triggered
|
||||
// 1 if just triggered
|
||||
just_triggered: u8,
|
||||
key: KeyCode,
|
||||
}
|
||||
|
||||
GamepadEvent := struct {}
|
|
@ -1,22 +1,22 @@
|
|||
string := @use("rel:string.hb")
|
||||
|
||||
receive_message := fn(buffer_id: int, memory_map_location: ^u8, length: int): ^u8 {
|
||||
return @eca(^u8, 4, buffer_id, memory_map_location, length)
|
||||
return @eca(4, buffer_id, memory_map_location, length)
|
||||
}
|
||||
|
||||
send_message := fn(msg: ^u8, buffer_id: int, length: int): void {
|
||||
return @eca(void, 3, buffer_id, msg, length)
|
||||
return @eca(3, buffer_id, msg, length)
|
||||
}
|
||||
|
||||
create := fn(msg: ^u8): int {
|
||||
msg_length := @inline(string.length, msg);
|
||||
*msg = 0
|
||||
return @eca(int, 3, 0, msg, msg_length)
|
||||
return @eca(3, 0, msg, msg_length)
|
||||
}
|
||||
|
||||
search := fn(msg: ^u8): int {
|
||||
msg_length := @inline(string.length, msg);
|
||||
*msg = 3
|
||||
|
||||
return @eca(int, 3, 0, msg, msg_length)
|
||||
return @eca(3, 0, msg, msg_length)
|
||||
}
|
|
@ -2,7 +2,7 @@ request_page := fn(page_count: u8): ^u8 {
|
|||
msg := "\{00}\{01}xxxxxxxx\0"
|
||||
msg_page_count := msg + 1;
|
||||
*msg_page_count = page_count
|
||||
return @eca(^u8, 3, 2, msg, 12)
|
||||
return @eca(3, 2, msg, 12)
|
||||
}
|
||||
|
||||
release_page := fn(ptr: ^u8, page_count: u8): void {
|
||||
|
@ -14,7 +14,7 @@ release_page := fn(ptr: ^u8, page_count: u8): void {
|
|||
msg_ptr := @as(^^u8, @bitcast(msg + 2));
|
||||
*msg_ptr = ptr
|
||||
|
||||
return @eca(void, 3, 2, msg, 12)
|
||||
return @eca(3, 2, msg, 12)
|
||||
}
|
||||
|
||||
OutbMsg := struct {a: u8, b: u8, addr: u16, value: u8}
|
||||
|
@ -27,7 +27,7 @@ outb := fn(addr: u16, value: u8): void {
|
|||
}
|
||||
|
||||
inb := fn(addr: u16): u8 {
|
||||
return @eca(u8, 3, 3, &InbMsg.(0, 0, addr), @sizeof(InbMsg))
|
||||
return @eca(3, 3, &InbMsg.(0, 0, addr), @sizeof(InbMsg))
|
||||
}
|
||||
|
||||
outl := fn(addr: u16, value: u32): void {
|
||||
|
|
|
@ -32,11 +32,11 @@ resolution = "1024x768x24"
|
|||
# [boot.limine.ableos.modules.serial_driver_test]
|
||||
# path = "boot:///serial_driver_test.hbf"
|
||||
|
||||
# [boot.limine.ableos.modules.horizon]
|
||||
# path = "boot:///horizon.hbf"
|
||||
[boot.limine.ableos.modules.horizon]
|
||||
path = "boot:///horizon.hbf"
|
||||
|
||||
# [boot.limine.ableos.modules.horizon_testing_program]
|
||||
# path = "boot:///horizon_testing_program.hbf"
|
||||
[boot.limine.ableos.modules.horizon_testing_program]
|
||||
path = "boot:///horizon_testing_program.hbf"
|
||||
|
||||
# [boot.limine.ableos.modules.dt_buffer_test]
|
||||
# path = "boot:///dt_buffer_test.hbf"
|
||||
|
@ -44,6 +44,9 @@ resolution = "1024x768x24"
|
|||
[boot.limine.ableos.modules.svga_driver]
|
||||
path = "boot:///svga_driver.hbf"
|
||||
|
||||
[boot.limine.ableos.modules.ps2_driver]
|
||||
path = "boot:///ps2_driver.hbf"
|
||||
|
||||
# [boot.limine.ableos.modules.filesystem_fat32]
|
||||
# path = "boot:///filesystem_fat32.hbf"
|
||||
# [boot.limine.ableos.modules.pumpkin_print]
|
||||
|
|
Loading…
Reference in a new issue