|
Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
Trophies for swadge modes.
Data Structures | |
| struct | trophyDataWrapper_t |
| struct | trophyDisplayList_t |
| struct | trophySystem_t |
| struct | packedTrophy_t |
Macros | |
| #define | DEFAULT_MILESTONE 25 |
| #define | BANNER_HEIGHT 48 |
| #define | BANNER_MAX_ICON_DIM 36 |
| #define | SCREEN_CORNER_CLEARANCE 19 |
| #define | IMAGE_BUFFER 8 |
| #define | NUMBER_TEXT_BUFFER 25 |
| #define | NUM_COLORS 6 |
Functions | |
| void | trophySystemInit (const trophyDataList_t *data, const char *modeName) |
| Initializes the Trophy system settings. The system is a global setting and every mode needs to set this when entered to avoid copying from other modes. | |
| bool | trophyUpdate (const trophyData_t *t, int newVal, bool drawUpdate) |
| Updates specifed trophy if required. | |
| bool | trophyUpdateMilestone (const trophyData_t *t, int newVal, int threshold) |
Updates just like trophyUpdate(), but only draws when crossing percentage boundary. | |
| int32_t | trophyGetSavedValue (const trophyData_t *t) |
| Returns the value saved to the NVS or 0 if the key isn't found. | |
| bool | trophySetChecklistTask (const trophyData_t *t, int32_t flag, bool set, bool drawUpdate) |
| Sets or unsets a checklist item. | |
| void | trophyClear (const trophyData_t *t) |
| Erases completion data from swadge. Only use in extreme circumstances. | |
| bool | checkBitFlag (int32_t flags, int8_t idx) |
| Checks an individual bit flag out of a int32. | |
| void | setBitFlag (int32_t *flags, int8_t idx, bool setTrue) |
| Set a bit flag. | |
| int | trophyGetPoints (bool total, const char *namespace) |
| Get the point totals for the gamer score. | |
| const trophyData_t * | trophyGetLatest () |
| Get the Latest Trophy Idx object. | |
| void | trophySetSystemData (const trophyDataList_t *dl, const char *modeName) |
| Set the Trophy System to a specific mode's values. | |
| bool | isTrophyDrawing (void) |
| Check if a trophy is currently being drawn. | |
| void | trophyDraw (font_t *fnt, int64_t elapsedUs) |
| Draws the banner if one is queued. | |
| void | trophyDrawListInit (trophyListDisplayMode_t mode) |
| Initialize the trophy Draw list. | |
| void | trophyDrawListColors (paletteColor_t background, paletteColor_t panel, paletteColor_t shadowBoxes, paletteColor_t dimText, paletteColor_t titleText, paletteColor_t checkmark) |
| Set the colors of the panel to custom. Call after initialization of the list, or it'll be overwritten. | |
| void | trophyDrawListDeinit () |
| Tears down the WSGs and height list. | |
| void | trophyDrawList (font_t *fnt, int yOffset) |
| Draws the list. | |
| struct trophyDataWrapper_t |
| Data Fields | ||
|---|---|---|
| trophyData_t | trophyData | Individual trophy data. |
| int32_t | currentVal | Saved value of the trophy. |
| wsg_t | image | Where the image is loaded. |
| bool | active | If this slot is loaded and ready to animate. |
| struct trophyDisplayList_t |
| Data Fields | ||
|---|---|---|
| int * | heights | Total height of the stack. |
| int | platHeight | Height of ther plat frame. |
| wsg_t * | images | Array of images to display. |
| trophyListDisplayMode_t | mode | Current display mode. |
| paletteColor_t | colorList[NUM_COLORS] | |
| struct trophySystem_t |
| Data Fields | ||
|---|---|---|
| const trophyDataList_t * | data | The settings of how the trophies behave. |
| list_t | trophyQueue | List of trophy updates to display. Holds type trophyDataWrapper_t*. |
| int | numTrophiesScore | Num of trophies adjusted for difficulty. |
| trophyData_t | plat | Platinum trophy data. |
| int32_t | platVal | Value of the platinum trophy. |
| wsg_t | platImg | Platinum's image. |
| bool | active | If the mode should be drawing a banner. |
| int32_t | animTimer | Timer used for sliding in and out. |
| wsgPalette_t | grayPalette | Grayscale palette for locked trophies. |
| wsgPalette_t | normalPalette | Normal colors. |
| trophyDisplayList_t | tdl | Display list data. |
| #define DEFAULT_MILESTONE 25 |
| #define BANNER_HEIGHT 48 |
| #define BANNER_MAX_ICON_DIM 36 |
| #define SCREEN_CORNER_CLEARANCE 19 |
| #define IMAGE_BUFFER 8 |
| #define NUMBER_TEXT_BUFFER 25 |
| #define NUM_COLORS 6 |
| void trophySystemInit | ( | const trophyDataList_t * | settings, |
| const char * | modeName ) |
Initializes the Trophy system settings. The system is a global setting and every mode needs to set this when entered to avoid copying from other modes.
| settings | The settings data |
| modeName | Name of the mode |
| bool trophyUpdate | ( | const trophyData_t * | t, |
| int | newVal, | ||
| bool | drawUpdate ) |
Updates specifed trophy if required.
| t | Trophy to update |
| newVal | New value to try to set. Behavior is set by trophy type |
| drawUpdate | If this update should be drawn to the screen |
| bool trophyUpdateMilestone | ( | const trophyData_t * | t, |
| int | newVal, | ||
| int | threshold ) |
Updates just like trophyUpdate(), but only draws when crossing percentage boundary.
| t | Trophy to update |
| newVal | Value to attempt to set |
| threshold | Value (0-100, representing a percent) to draw at |
| int32_t trophyGetSavedValue | ( | const trophyData_t * | t | ) |
Returns the value saved to the NVS or 0 if the key isn't found.
| t | Trophy to grab value for |
| bool trophySetChecklistTask | ( | const trophyData_t * | t, |
| int32_t | flag, | ||
| bool | unset, | ||
| bool | drawUpdate ) |
Sets or unsets a checklist item.
| t | Trophy to set |
| flag | Task that was just completed |
| unset | If we're unsetting the bit |
| drawUpdate | If this update should be drawn |
| void trophyClear | ( | const trophyData_t * | t | ) |
Erases completion data from swadge. Only use in extreme circumstances.
| t | Trophy to set to 0 |
| bool checkBitFlag | ( | int32_t | flags, |
| int8_t | idx ) |
Checks an individual bit flag out of a int32.
| flags | int32 containing the flag to check |
| idx | Index of the bit |
| void setBitFlag | ( | int32_t * | flags, |
| int8_t | idx, | ||
| bool | setTrue ) |
Set a bit flag.
| flags | pointer to variable to store flags |
| idx | Index of the bit to set |
| setTrue | Set to false to unset the |
| int trophyGetPoints | ( | bool | total, |
| const char * | namespace ) |
Get the point totals for the gamer score.
| total | If loading the full score or for the current mode |
| namespace | namespace to load points from. Set to NULL to get currently loaded mode |
| const trophyData_t * trophyGetLatest | ( | void | ) |
Get the Latest Trophy Idx object.
| void trophySetSystemData | ( | const trophyDataList_t * | dl, |
| const char * | modeName ) |
Set the Trophy System to a specific mode's values.
| dl | Data object from the mode |
| modeName | Name of the mode |
| bool isTrophyDrawing | ( | void | ) |
Check if a trophy is currently being drawn.
| void trophyDraw | ( | font_t * | fnt, |
| int64_t | elapsedUs ) |
Draws the banner if one is queued.
| fnt | Font to be used |
| elapsedUs | Time since last frame |
| void trophyDrawListInit | ( | trophyListDisplayMode_t | mode | ) |
Initialize the trophy Draw list.
| mode | What display mode to draw |
| void trophyDrawListColors | ( | paletteColor_t | background, |
| paletteColor_t | panel, | ||
| paletteColor_t | shadowBoxes, | ||
| paletteColor_t | dimText, | ||
| paletteColor_t | titleText, | ||
| paletteColor_t | checkmark ) |
Set the colors of the panel to custom. Call after initialization of the list, or it'll be overwritten.
| background | Color of the background behind the panels |
| panel | The main panel color |
| shadowBoxes | The check box and image shadowbox colors |
| dimText | Description text and numbers |
| titleText | Title of the trophy |
| checkmark | Color of the checkmark |
| void trophyDrawListDeinit | ( | void | ) |
Tears down the WSGs and height list.
| void trophyDrawList | ( | font_t * | fnt, |
| int | yOffset ) |
Draws the list.
| fnt | Font to use |
| yOffset | Current Y offset. Higher numbers effectively scroll down |