tiny.windowing.GamepadCapacity
Defined in gamepad.
API (9)
Actions
Public operations.
Fields and members
Public fields and members.
name_bytesread_event_bytesread_event_countretained_gamepad_countretained_name_byte_count_per_gamepadretained_storage_bytesscanned_source_countslot_bytes
Source
Source: lib/windowing/src/gamepad.zig:36
zig
pub const Capacity = struct { retained_gamepad_count: usize, retained_name_byte_count_per_gamepad: usize, read_event_count: usize, scanned_source_count: u32, slot_bytes: usize, name_bytes: usize, read_event_bytes: usize, retained_storage_bytes: usize, pub fn derive(limits: Limits) CapacityError!Capacity { if (limits.retained_gamepad_count == 0) return error.GamepadStorageEmpty; if (limits.retained_name_byte_count_per_gamepad == 0) return error.NameStorageEmpty; if (source_kind == .evdev and limits.retained_name_byte_count_per_gamepad > sys.evdev.max_query_bytes) { return error.NameStorageTooLarge; } if (source_kind == .evdev and limits.read_event_count == 0) { return error.EventReadStorageEmpty; } if (limits.scanned_source_count == 0) return error.SourceScanEmpty; const slot_bytes = std.math.mul( usize, limits.retained_gamepad_count, @sizeOf(?Slot), ) catch return error.CapacityOverflow; const name_bytes = std.math.mul( usize, limits.retained_gamepad_count, limits.retained_name_byte_count_per_gamepad, ) catch return error.CapacityOverflow; const read_event_count = if (source_kind == .evdev) limits.read_event_count else 0; const read_event_bytes = if (source_kind == .evdev) std.math.mul( usize, read_event_count, @sizeOf(sys.evdev.InputEvent), ) catch return error.CapacityOverflow else 0; const retained_gamepad_bytes = std.math.add( usize, slot_bytes, name_bytes, ) catch return error.CapacityOverflow; const retained_storage_bytes = std.math.add( usize, retained_gamepad_bytes, read_event_bytes, ) catch return error.CapacityOverflow; return .{ .retained_gamepad_count = limits.retained_gamepad_count, .retained_name_byte_count_per_gamepad = limits.retained_name_byte_count_per_gamepad, .read_event_count = read_event_count, .scanned_source_count = limits.scanned_source_count, .slot_bytes = slot_bytes, .name_bytes = name_bytes, .read_event_bytes = read_event_bytes, .retained_storage_bytes = retained_storage_bytes, }; }};Source: lib/windowing/src/root.zig:111
zig
pub const GamepadCapacity = gamepad_module.Capacity;Audit
| Definitions | 2 |
|---|---|
| Public names | 4 |
| Members | 8 |
| Version | 26.7.0 |
| Revision | daab053ee433 |