#ifndef PW_GAME_H #define PW_GAME_H #include #include #include "audio.h" #include "cart.h" #include "env.h" #include "fb.h" #include "input.h" #include "pico8.h" #include "player.h" #include "scale.h" /** * Executing PICO-8 game state. */ struct pw_game { struct w2c_pico8 instance; struct w2c_env *env; struct pw_framebuffer *fb; struct pw_audio *audio; struct pw_input *input; struct pw_cart *cart; }; /** * Allocates and initializes the game state. */ struct pw_game *pw_game_init(SDL_Renderer *renderer, enum pw_scale_mode mode, size_t memory); /** * Frees the game state. */ void pw_game_free(struct pw_game *game); /** * Starts a PICO-8 game. */ bool pw_game_start(struct pw_game *game, struct pw_players *players, struct pw_cart *cart); /** * Handles SDL events for game state. */ bool pw_game_event(struct pw_game *game, struct pw_players *players, SDL_Event *event); /** * Iterate a new frame for the game state. */ bool pw_game_iterate(struct pw_game *game, bool *shutdown); /** * Renders the game state. */ bool pw_game_render(struct pw_game *game); #endif