window_interface.odin 900 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. set_internal_state: proc(state: rawptr),
  12. }
  13. Window_Handle :: distinct uintptr
  14. Window_Event :: union {
  15. Window_Event_Close_Wanted,
  16. Window_Event_Key_Went_Down,
  17. Window_Event_Key_Went_Up,
  18. Window_Event_Mouse_Move,
  19. Window_Event_Mouse_Wheel,
  20. }
  21. Window_Event_Key_Went_Down :: struct {
  22. key: Keyboard_Key,
  23. }
  24. Window_Event_Key_Went_Up :: struct {
  25. key: Keyboard_Key,
  26. }
  27. Window_Event_Close_Wanted :: struct {}
  28. Window_Event_Mouse_Move :: struct {
  29. position: Vec2,
  30. }
  31. Window_Event_Mouse_Wheel :: struct {
  32. delta: f32,
  33. }