Process and show trophies.
This commit is contained in:
parent
4258575a26
commit
6e93955589
Binary file not shown.
|
@ -41,16 +41,19 @@ void initTrophies(void)
|
||||||
{
|
{
|
||||||
memset(&trophyHead, 0, sizeof(Trophy));
|
memset(&trophyHead, 0, sizeof(Trophy));
|
||||||
trophyTail = &trophyHead;
|
trophyTail = &trophyHead;
|
||||||
|
|
||||||
|
alertRect.h = 90;
|
||||||
|
alertRect.y = 10;
|
||||||
|
|
||||||
numTrophies = 0;
|
numTrophies = 0;
|
||||||
|
|
||||||
awarded = 0;
|
awarded = 0;
|
||||||
|
|
||||||
alertTimer = 0;
|
|
||||||
|
|
||||||
sparkleAngle = 0;
|
sparkleAngle = 0;
|
||||||
|
|
||||||
loadTrophyData();
|
loadTrophyData();
|
||||||
|
|
||||||
|
resetAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
void awardTrophy(char *id)
|
void awardTrophy(char *id)
|
||||||
|
@ -171,11 +174,9 @@ void drawTrophyAlert(void)
|
||||||
|
|
||||||
if (alertTrophy)
|
if (alertTrophy)
|
||||||
{
|
{
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
drawRect(alertRect.x, alertRect.y, alertRect.w, alertRect.h, 0, 0, 0, 255);
|
||||||
SDL_RenderFillRect(app.renderer, &alertRect);
|
|
||||||
|
drawOutlineRect(alertRect.x, alertRect.y, alertRect.w, alertRect.h, 64, 64, 64, 255);
|
||||||
SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, SDL_ALPHA_OPAQUE);
|
|
||||||
SDL_RenderDrawRect(app.renderer, &alertRect);
|
|
||||||
|
|
||||||
drawText(alertRect.x + 15, alertRect.y + 5, 30, TA_LEFT, colors.white, alertTrophy->title);
|
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);
|
drawText(alertRect.x + 15, alertRect.y + 45, 20, TA_LEFT, colors.white, alertTrophy->description);
|
||||||
|
|
|
@ -27,6 +27,8 @@ extern long lookup(const char *name);
|
||||||
extern void textSize(char *text, int size, int *w, int *h);
|
extern void textSize(char *text, int size, int *w, int *h);
|
||||||
extern void playSound(int snd, int ch);
|
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 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 float mod(float n, float x);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
|
|
|
@ -57,10 +57,14 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
app.delegate.logic();
|
app.delegate.logic();
|
||||||
|
|
||||||
|
doTrophyAlerts();
|
||||||
|
|
||||||
prepareScene();
|
prepareScene();
|
||||||
|
|
||||||
app.delegate.draw();
|
app.delegate.draw();
|
||||||
|
|
||||||
|
drawTrophyAlert();
|
||||||
|
|
||||||
presentScene();
|
presentScene();
|
||||||
|
|
||||||
then = capFrameRate(then);
|
then = capFrameRate(then);
|
||||||
|
|
|
@ -31,6 +31,8 @@ extern void initAtlasTest(void);
|
||||||
extern void init18N(int argc, char *argv[]);
|
extern void init18N(int argc, char *argv[]);
|
||||||
extern void initLookups(void);
|
extern void initLookups(void);
|
||||||
extern void awardTrophies(void);
|
extern void awardTrophies(void);
|
||||||
|
extern void doTrophyAlerts(void);
|
||||||
|
extern void drawTrophyAlert(void);
|
||||||
|
|
||||||
App app;
|
App app;
|
||||||
Camera camera;
|
Camera camera;
|
||||||
|
|
|
@ -128,6 +128,7 @@ static void loadSounds(void)
|
||||||
sounds[SND_CONFIRMED] = loadSound("sound/39028__wildweasel__cardlock-open.ogg");
|
sounds[SND_CONFIRMED] = loadSound("sound/39028__wildweasel__cardlock-open.ogg");
|
||||||
sounds[SND_HEART_CELL] = loadSound("sound/162467__kastenfrosch__gotitem.ogg");
|
sounds[SND_HEART_CELL] = loadSound("sound/162467__kastenfrosch__gotitem.ogg");
|
||||||
sounds[SND_MISSION_COMPLETE] = loadSound("sound/113989__kastenfrosch__gewonnen.ogg");
|
sounds[SND_MISSION_COMPLETE] = loadSound("sound/113989__kastenfrosch__gewonnen.ogg");
|
||||||
|
sounds[SND_TROPHY] = loadSound("sound/278142__ricemaster__effect-notify.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroySounds(void)
|
void destroySounds(void)
|
||||||
|
|
Loading…
Reference in New Issue