Process and show trophies.

This commit is contained in:
Steve 2018-02-14 22:31:42 +00:00
parent 4258575a26
commit 6e93955589
6 changed files with 17 additions and 7 deletions

Binary file not shown.

View File

@ -41,16 +41,19 @@ void initTrophies(void)
{
memset(&trophyHead, 0, sizeof(Trophy));
trophyTail = &trophyHead;
alertRect.h = 90;
alertRect.y = 10;
numTrophies = 0;
awarded = 0;
alertTimer = 0;
sparkleAngle = 0;
loadTrophyData();
resetAlert();
}
void awardTrophy(char *id)
@ -171,11 +174,9 @@ void drawTrophyAlert(void)
if (alertTrophy)
{
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
SDL_RenderFillRect(app.renderer, &alertRect);
SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, SDL_ALPHA_OPAQUE);
SDL_RenderDrawRect(app.renderer, &alertRect);
drawRect(alertRect.x, alertRect.y, alertRect.w, alertRect.h, 0, 0, 0, 255);
drawOutlineRect(alertRect.x, alertRect.y, alertRect.w, alertRect.h, 64, 64, 64, 255);
drawText(alertRect.x + 15, alertRect.y + 5, 30, TA_LEFT, colors.white, alertTrophy->title);
drawText(alertRect.x + 15, alertRect.y + 45, 20, TA_LEFT, colors.white, alertTrophy->description);

View File

@ -27,6 +27,8 @@ extern long lookup(const char *name);
extern void textSize(char *text, int size, int *w, int *h);
extern void playSound(int snd, int ch);
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
extern void drawRect(int x, int y, int w, int h, int r, int g, int b, int a);
extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a);
extern float mod(float n, float x);
extern App app;

View File

@ -57,10 +57,14 @@ int main(int argc, char *argv[])
app.delegate.logic();
doTrophyAlerts();
prepareScene();
app.delegate.draw();
drawTrophyAlert();
presentScene();
then = capFrameRate(then);

View File

@ -31,6 +31,8 @@ extern void initAtlasTest(void);
extern void init18N(int argc, char *argv[]);
extern void initLookups(void);
extern void awardTrophies(void);
extern void doTrophyAlerts(void);
extern void drawTrophyAlert(void);
App app;
Camera camera;

View File

@ -128,6 +128,7 @@ static void loadSounds(void)
sounds[SND_CONFIRMED] = loadSound("sound/39028__wildweasel__cardlock-open.ogg");
sounds[SND_HEART_CELL] = loadSound("sound/162467__kastenfrosch__gotitem.ogg");
sounds[SND_MISSION_COMPLETE] = loadSound("sound/113989__kastenfrosch__gewonnen.ogg");
sounds[SND_TROPHY] = loadSound("sound/278142__ricemaster__effect-notify.ogg");
}
void destroySounds(void)