| 1 | module sapp |
| 2 | |
| 3 | // Shared state structs for the V sokol_app backends. |
| 4 | // Platform-specific state (SappState, g_sapp_state, SappWayland, SappWin32, etc.) |
| 5 | // lives in sapp_state_linux.v / sapp_state_windows.v respectively. |
| 6 | |
| 7 | const ring_num_slots = 256 |
| 8 | const max_title_length = 128 |
| 9 | const mousecursor_num = 27 |
| 10 | |
| 11 | // Timing state for frame duration averaging |
| 12 | struct SappTiming { |
| 13 | mut: |
| 14 | last f64 |
| 15 | accum f64 |
| 16 | avg f64 |
| 17 | spike_count int |
| 18 | num int |
| 19 | ring_head int |
| 20 | ring_tail int |
| 21 | ring_buf [ring_num_slots]f64 |
| 22 | } |
| 23 | |
| 24 | // Mouse state |
| 25 | struct SappMouse { |
| 26 | mut: |
| 27 | x f32 |
| 28 | y f32 |
| 29 | dx f32 |
| 30 | dy f32 |
| 31 | shown bool |
| 32 | locked bool |
| 33 | pos_valid bool |
| 34 | current_cursor MouseCursor |
| 35 | } |
| 36 | |
| 37 | // Clipboard state |
| 38 | struct SappClipboard { |
| 39 | mut: |
| 40 | enabled bool |
| 41 | buf_size int |
| 42 | buffer &char = unsafe { nil } |
| 43 | } |
| 44 | |
| 45 | // Drag and drop state |
| 46 | struct SappDrop { |
| 47 | mut: |
| 48 | enabled bool |
| 49 | max_files int |
| 50 | max_path_length int |
| 51 | num_files int |
| 52 | buf_size int |
| 53 | buffer &char = unsafe { nil } |
| 54 | } |
| 55 | |
| 56 | // GL state |
| 57 | struct SappGl { |
| 58 | mut: |
| 59 | framebuffer u32 |
| 60 | major int |
| 61 | minor int |
| 62 | } |
| 63 | |