Files
cell/playdate/common.h
2025-12-10 15:01:20 -06:00

65 lines
1.9 KiB
C

// playdate/common.h - Common declarations for Playdate Cell integration
// This header declares the global API pointers that are initialized in main_playdate.c
// and used by all the Playdate integration modules.
#ifndef PLAYDATE_COMMON_H
#define PLAYDATE_COMMON_H
#include "pd_api/pd_api_file.h"
#include "pd_api/pd_api_gfx.h"
#include "pd_api/pd_api_sys.h"
#include "pd_api/pd_api_sound.h"
#include "pd_api/pd_api_sprite.h"
#include "pd_api/pd_api_display.h"
#include "pd_api/pd_api_json.h"
#include "pd_api/pd_api_lua.h"
#include "pd_api/pd_api_network.h"
#include "pd_api/pd_api_scoreboards.h"
// Forward declare the main PlaydateAPI struct
typedef struct PlaydateAPI PlaydateAPI;
struct PlaydateAPI
{
const struct playdate_sys *system;
const struct playdate_file *file;
const struct playdate_graphics *graphics;
const struct playdate_sprite *sprite;
const struct playdate_display *display;
const struct playdate_sound *sound;
const struct playdate_lua *lua;
const struct playdate_json *json;
const struct playdate_scoreboards *scoreboards;
const struct playdate_network *network;
};
// System events
typedef enum
{
kEventInit,
kEventInitLua,
kEventLock,
kEventUnlock,
kEventPause,
kEventResume,
kEventTerminate,
kEventKeyPressed,
kEventKeyReleased,
kEventLowPower
} PDSystemEvent;
// Global API pointers - defined in main_playdate.c
extern PlaydateAPI *pd;
extern const struct playdate_file *pd_file;
extern const struct playdate_sys *pd_sys;
extern const struct playdate_graphics *pd_gfx;
extern const struct playdate_sprite *pd_sprite;
extern const struct playdate_display *pd_display;
extern const struct playdate_sound *pd_sound;
extern const struct playdate_lua *pd_lua;
extern const struct playdate_json *pd_json;
extern const struct playdate_scoreboards *pd_scoreboards;
extern const struct playdate_network *pd_network;
#endif // PLAYDATE_COMMON_H