Show planet in background.

This commit is contained in:
Steve 2016-02-29 12:09:36 +00:00
parent 7f98080a18
commit adb86d9f14
2 changed files with 17 additions and 1 deletions

View File

@ -39,6 +39,8 @@ static SDL_Texture *background;
static int startIndex;
static Widget *start;
static int completedChallenges;
static SDL_Texture *planetTexture;
static PointF planet;
static int totalChallenges;
static int show;
@ -58,10 +60,14 @@ void initChallengeHome(void)
app.delegate.draw = &draw;
memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
background = getTexture("gfx/backgrounds/background04.jpg");
background = getTexture("gfx/backgrounds/background06.jpg");
planetTexture = getTexture("gfx/planets/bluePlanet.png");
battle.camera.x = battle.camera.y = 0;
planet.x = SCREEN_WIDTH;
planet.y = (rand() % SCREEN_HEIGHT - 128);
game.currentMission = NULL;
startIndex = 0;
@ -112,6 +118,13 @@ static void logic(void)
doStars(0.5, 0);
planet.x -= 0.25;
if (planet.x <= -200)
{
planet.x = SCREEN_WIDTH + (rand() % SCREEN_WIDTH);
planet.y = (rand() % SCREEN_HEIGHT - 128);
}
switch (show)
{
case SHOW_CHALLENGES:
@ -161,6 +174,8 @@ static void draw(void)
{
drawBackground(background);
blit(planetTexture, planet.x, planet.y, 0);
drawStars();
drawText(SCREEN_WIDTH / 2, 50, 30, TA_CENTER, colors.white, _("Challenges"));

View File

@ -54,6 +54,7 @@ extern void playSound(int sound);
extern void selectWidget(const char *name, const char *group);
extern void updateAllMissions(void);
extern char *getTranslatedString(char *string);
extern void blit(SDL_Texture *t, int x, int y, int centered);
extern App app;
extern Battle battle;