window_interface.odin 777 B

1234567891011121314151617181920212223242526272829303132333435
  1. package karl2d
  2. Window_Interface :: struct {
  3. state_size: proc() -> int,
  4. init: proc(window_state: rawptr, window_width: int, window_height: int, window_title: string, allocator := context.allocator),
  5. shutdown: proc(),
  6. window_handle: proc() -> Window_Handle,
  7. process_events: proc(),
  8. get_events: proc() -> []Window_Event,
  9. clear_events: proc(),
  10. set_position: proc(x: int, y: int),
  11. }
  12. Window_Handle :: distinct uintptr
  13. Window_Event :: union {
  14. Window_Event_Close_Wanted,
  15. Window_Event_Key_Went_Down,
  16. Window_Event_Key_Went_Up,
  17. Window_Event_Mouse_Move,
  18. }
  19. Window_Event_Key_Went_Down :: struct {
  20. key: Keyboard_Key,
  21. }
  22. Window_Event_Key_Went_Up :: struct {
  23. key: Keyboard_Key,
  24. }
  25. Window_Event_Close_Wanted :: struct {}
  26. Window_Event_Mouse_Move :: struct {
  27. position: Vec2,
  28. }