Skip to content

Commit

Permalink
use C enum instead
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Feb 6, 2025
1 parent 8b519f0 commit 420a20d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions gameboy.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#define WIDTH 160

enum KeypadKey {
typedef enum KeypadKey {
Right,
Left,
Up,
Expand All @@ -18,8 +18,7 @@ enum KeypadKey {
B,
Select,
Start,
};
typedef uint8_t KeypadKey;
} KeypadKey;

typedef struct String String;

Expand All @@ -37,9 +36,9 @@ void load(const unsigned char *bytes, uintptr_t bytes_length);

void frame(void);

void keydown(KeypadKey key);
void keydown(enum KeypadKey key);

void keyup(KeypadKey key);
void keyup(enum KeypadKey key);

struct ImageBuffer image(void);

Expand Down
2 changes: 1 addition & 1 deletion src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub struct Keypad {
}

#[derive(Copy, Clone)]
#[repr(u8)]
#[repr(C)]
pub enum KeypadKey {
Right,
Left,
Expand Down

0 comments on commit 420a20d

Please sign in to comment.