Skip to content

Commit

Permalink
Update macro to support init on kEventInitLua
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyoung committed Oct 15, 2023
1 parent 5b289e5 commit 3e54be6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ impl<T: 'static + Game> GameRunner<T> {
#[macro_export]
macro_rules! crankstart_game {
($game_struct:tt) => {
crankstart_game!($game_struct, PDSystemEvent::kEventInit)
};
($game_struct:tt, $pd_system_event:expr) => {
pub mod game_setup {
extern crate alloc;
use super::*;
Expand Down Expand Up @@ -250,7 +253,7 @@ macro_rules! crankstart_game {
event: PDSystemEvent,
_arg: u32,
) -> crankstart_sys::ctypes::c_int {
if event == PDSystemEvent::kEventInit {
if event == $pd_system_event {
// This would only fail if PlaydateAPI has null pointers, which shouldn't happen.
let mut playdate = match Playdate::new(playdate, sprite_update, sprite_draw) {
Ok(playdate) => playdate,
Expand Down

0 comments on commit 3e54be6

Please sign in to comment.