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));
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -57,10 +57,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
app.delegate.logic();
|
||||
|
||||
doTrophyAlerts();
|
||||
|
||||
prepareScene();
|
||||
|
||||
app.delegate.draw();
|
||||
|
||||
drawTrophyAlert();
|
||||
|
||||
presentScene();
|
||||
|
||||
then = capFrameRate(then);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue