Skip to documentation
SLOP

tiny.windowing.Gamepad

Reference tiny.windowing Gamepad

Defined in gamepad.

API (11)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callsgamepadGamepad
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/windowing/src/gamepad.zig:134

zig
pub const Gamepad = struct {    connected: bool = false,    name_bytes: []const u8 = &.{},    buttons: [button_count]bool = @splat(false),    pressed: [button_count]bool = @splat(false),    released: [button_count]bool = @splat(false),    axes: [axis_count]f32 = @splat(0),    pub fn name(self: *const Gamepad) []const u8 {        return self.name_bytes;    }    pub fn isDown(self: *const Gamepad, control: Button) bool {        return self.buttons[@backingInt(control)];    }    pub fn isPressed(self: *const Gamepad, control: Button) bool {        return self.pressed[@backingInt(control)];    }    pub fn isReleased(self: *const Gamepad, control: Button) bool {        return self.released[@backingInt(control)];    }    pub fn axisValue(self: *const Gamepad, control: Axis) f32 {        return self.axes[@backingInt(control)];    }    fn beginPoll(self: *Gamepad) void {        @memset(&self.pressed, false);        @memset(&self.released, false);    }    fn setButton(self: *Gamepad, control: Button, down: bool) void {        const index = @backingInt(control);        if (down and !self.buttons[index]) self.pressed[index] = true;        if (!down and self.buttons[index]) self.released[index] = true;        self.buttons[index] = down;    }    fn setAxis(self: *Gamepad, control: Axis, value: f32) void {        self.axes[@backingInt(control)] = value;    }};

Source: lib/windowing/src/root.zig:91

zig
pub const Gamepad = gamepad_module.Gamepad;

Audit

Definitions6
Public names12
Members6
Version26.7.0
Revisiondaab053ee433