Skip to content

Commit

Permalink
feat(framework): make sure input structs impl Copy (#483)
Browse files Browse the repository at this point in the history
Very straightforward changes.

While working on [jumpy
#933](fishfolk/jumpy#933) I realized some of
these events don't `impl Copy`.
  • Loading branch information
nelson137 authored Oct 11, 2024
1 parent 008a95d commit 016ed7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions framework_crates/bones_framework/src/input/gamepad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct GamepadInputs {
}

/// A gamepad event.
#[derive(HasSchema, Clone, Debug)]
#[derive(HasSchema, Clone, Copy, Debug)]
#[repr(C, u8)]
pub enum GamepadEvent {
/// A connection event.
Expand All @@ -29,7 +29,7 @@ impl Default for GamepadEvent {
}

/// A gamepad connection event.
#[derive(HasSchema, Clone, Debug, Default)]
#[derive(HasSchema, Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct GamepadConnectionEvent {
/// The ID of the gamepad.
Expand All @@ -39,7 +39,7 @@ pub struct GamepadConnectionEvent {
}

/// The kind of gamepad connection event.
#[derive(HasSchema, Clone, Debug, Default)]
#[derive(HasSchema, Clone, Copy, Debug, Default)]
#[repr(u8)]
pub enum GamepadConnectionEventKind {
#[default]
Expand All @@ -50,7 +50,7 @@ pub enum GamepadConnectionEventKind {
}

/// A gamepad button event.
#[derive(HasSchema, Clone, Debug, Default)]
#[derive(HasSchema, Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct GamepadButtonEvent {
/// The ID of the gamepad.
Expand All @@ -64,7 +64,7 @@ pub struct GamepadButtonEvent {

/// A specific button on a gamepad.
#[allow(missing_docs)]
#[derive(HasSchema, Clone, Debug, Default, PartialEq, Eq, Hash)]
#[derive(HasSchema, Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[repr(C, u8)]
pub enum GamepadButton {
#[default]
Expand Down Expand Up @@ -122,7 +122,7 @@ impl std::fmt::Display for GamepadButton {
}

/// A gamepad axis event.
#[derive(HasSchema, Clone, Debug)]
#[derive(HasSchema, Clone, Copy, Debug)]
#[schema(no_default)]
#[repr(C)]
pub struct GamepadAxisEvent {
Expand All @@ -135,7 +135,7 @@ pub struct GamepadAxisEvent {
}

/// A specific gamepad axis that may have changed.
#[derive(HasSchema, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HasSchema, Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[schema(no_default)]
#[allow(missing_docs)]
#[repr(C, u8)]
Expand Down Expand Up @@ -168,7 +168,7 @@ impl std::fmt::Display for GamepadAxis {
}

/// Struct that represents intensity of a rumble
#[derive(HasSchema, Default, Clone, Debug, Copy)]
#[derive(HasSchema, Default, Clone, Copy, Debug)]
pub struct GamepadRumbleIntensity {
/// The intensity of the strong motor, between 0.0 - 1.0.
strong_motor: f32,
Expand Down
2 changes: 1 addition & 1 deletion framework_crates/bones_framework/src/input/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct KeyboardInputs {
}

/// A keyboard input event.
#[derive(HasSchema, Clone, Debug, Copy, Default)]
#[derive(HasSchema, Clone, Copy, Debug, Default)]
#[repr(C)]
pub struct KeyboardEvent {
/// The scan code of the pressed key.
Expand Down

0 comments on commit 016ed7e

Please sign in to comment.