Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cosCrunch.h
Go to the documentation of this file.
1
26
27#pragma once
28
29#include "cosCrunchUtil.h"
30#include "swadge2024.h"
31
33
36#define CC_DRAWABLE_HEIGHT (TFT_HEIGHT - 38)
37
62
68typedef struct
69{
74 const char* verb;
75
80 const char* successMsg;
81
86 const char* failureMsg;
87
91 uint64_t timeoutUs;
92
97 void (*fnInitMicrogame)(void);
98
102 void (*fnDestroyMicrogame)(void);
103
116 void (*fnMainLoop)(int64_t elapsedUs, uint64_t timeRemainingUs, cosCrunchMicrogameState state,
117 buttonEvt_t buttonEvts[], uint8_t buttonEvtCount);
118
134 void (*fnBackgroundDrawCallback)(int16_t x, int16_t y, int16_t w, int16_t h, int16_t up, int16_t upNum);
135
143 bool (*fnMicrogameTimeout)(void);
145
157
166
180void cosCrunchMicrogamePersistSplatter(wsg_t wsg, uint16_t x, uint16_t y);
181
189void cosCrunchMicrogameResult(bool successful);
A set of colors used to tint a greyscale image.
Definition cosCrunchUtil.h:20
uint64_t timeoutUs
How long the player has until they fail the microgame, in microseconds.
Definition cosCrunch.h:91
const char * failureMsg
The phrase that is flashed on the screen after the microgame if the game was failed....
Definition cosCrunch.h:86
bool(* fnMicrogameTimeout)(void)
This function is called when the microgame timer expires. It is optional and intended for microgames ...
Definition cosCrunch.h:143
wsgPalette_t * cosCrunchMicrogameGetWsgPalette(const tintColor_t *tintColor)
Get a palette suitable for tinting a greyscale image using the drawWsgPalette*() functions from wsgPa...
const char * verb
The phrase that is flashed on the screen before the microgame runs. Should be an action: "Sew",...
Definition cosCrunch.h:74
cosCrunchMicrogameState
Definition cosCrunch.h:39
@ CC_MG_PLAYING
The game is in progress: accept input, render the game, all that jazz.
Definition cosCrunch.h:50
@ CC_MG_GET_READY
This state is shown briefly with the game's verb overlaid before the game starts to orient the player...
Definition cosCrunch.h:45
@ CC_MG_CELEBRATING
The player has succeeded. Display something that elevates their spirits.
Definition cosCrunch.h:55
@ CC_MG_DESPAIRING
The player has failed. Display something that underscores their torment.
Definition cosCrunch.h:60
void(* fnInitMicrogame)(void)
This function is called when this microgame is about to be started. It should initialize variables an...
Definition cosCrunch.h:97
void(* fnMainLoop)(int64_t elapsedUs, uint64_t timeRemainingUs, cosCrunchMicrogameState state, buttonEvt_t buttonEvts[], uint8_t buttonEvtCount)
This function is called from the main loop. The microgame should run its game logic and render like a...
Definition cosCrunch.h:116
void(* fnDestroyMicrogame)(void)
This function is called when the microgame is exited. It should free any allocated memory.
Definition cosCrunch.h:102
void cosCrunchMicrogameResult(bool successful)
Submit the player's result of the currently running microgame. Every microgame must have a success co...
const char * successMsg
The phrase that is flashed on the screen after the microgame if the game was succeeded....
Definition cosCrunch.h:80
void(* fnBackgroundDrawCallback)(int16_t x, int16_t y, int16_t w, int16_t h, int16_t up, int16_t upNum)
This function is called when the display driver wishes to update a section of the display....
Definition cosCrunch.h:134
const tintColor_t * cosCrunchMicrogameGetTintColor(void)
Get a color set (base/highlight/lowlight) suitable for greyscale tinting to use for this microgame....
void cosCrunchMicrogamePersistSplatter(wsg_t wsg, uint16_t x, uint16_t y)
Microgames can leave paint, marker, glitter, and whatever else on the mat that persists across a play...
swadgeMode_t cosCrunchMode
The definition for a Cosplay Crunch microgame. Once your microgame is built, add this struct to the m...
Definition cosCrunch.h:69
A button event containing the button that triggered the event, whether it was pressed or released,...
Definition hdw-btn.h:117
A struct of all the function pointers necessary for a swadge mode. If a mode does not need a particul...
Definition wsgPalette.h:74
A sprite using paletteColor_t colors that can be drawn to the display.
Definition wsg.h:57