diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-07-31 14:22:09 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-07-31 14:26:11 -0700 |
commit | e3d7338a979e1c2cba2328df5ac29856f4de1e0e (patch) | |
tree | 80a35955f1b79623a7c5ff0ec3cc5a6d00e11d72 /src/play.h | |
parent | b4911c2abfa513e91c82a712ef277f7e6209b502 (diff) |
play: add flags to play_startup()
Introduce flags for disabling audio/video/gamecontroller caps
Most of the time, all of these will be desirable for a game. But
sometimes I might use this as a quick bootstrap into SDL land,
especially as I accumulate play_ops_t boilerplate I'd like to
be maximally reusable. The video-only use case is particularly
likely especially for development tools, and I'm likely to have
a corpus of play_ops_t integrations for the myriad GL/vulkan
flavors...
Note the flags are plumbed down to the play_ops_t.init hook so
ops implementations can also be flags-aware.
I didn't try make things like audio samplerate/channels
configurable, as this library is intended to be a vendored .a
anyways there's no hard ABI/API commitments. It can always
grow and evolve when the need arises.
Diffstat (limited to 'src/play.h')
-rw-r--r-- | src/play.h | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -33,6 +33,10 @@ typedef enum play_ticks_t { PLAY_TICKS_CNT } play_ticks_t; +#define PLAY_FLAG_NOAUDIO (1L) +#define PLAY_FLAG_NOVIDEO (1L << 1) +#define PLAY_FLAG_NOGAMEPAD (1L << 2) + #define PLAY_MUSIC_FLAG_LOOP (1L) #define PLAY_MUSIC_FLAG_FADEIN (1L << 1) #define PLAY_MUSIC_FLAG_OPTIONAL (1L << 2) @@ -42,7 +46,7 @@ typedef enum play_ticks_t { typedef struct play_t play_t; typedef struct play_ops_t { - void * (*init)(play_t *play, int argc, char *argv[]); + void * (*init)(play_t *play, int argc, char *argv[], unsigned flags); void (*destroy)(play_t *play, void *context); void (*enter)(play_t *play, void *context); void (*leave)(play_t *play, void *context); @@ -51,7 +55,7 @@ typedef struct play_ops_t { void (*dispatch)(play_t *play, void *context, SDL_Event *event); } play_ops_t; -play_t * play_startup(int argc, char *argv[], const play_ops_t *ops[]); +play_t * play_startup(int argc, char *argv[], unsigned flags, const play_ops_t *ops[]); int play_shutdown(play_t *play); void play_run(play_t *play); |