Show planet in background.
This commit is contained in:
parent
7f98080a18
commit
adb86d9f14
|
@ -39,6 +39,8 @@ static SDL_Texture *background;
|
||||||
static int startIndex;
|
static int startIndex;
|
||||||
static Widget *start;
|
static Widget *start;
|
||||||
static int completedChallenges;
|
static int completedChallenges;
|
||||||
|
static SDL_Texture *planetTexture;
|
||||||
|
static PointF planet;
|
||||||
static int totalChallenges;
|
static int totalChallenges;
|
||||||
static int show;
|
static int show;
|
||||||
|
|
||||||
|
@ -58,10 +60,14 @@ void initChallengeHome(void)
|
||||||
app.delegate.draw = &draw;
|
app.delegate.draw = &draw;
|
||||||
memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
|
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;
|
battle.camera.x = battle.camera.y = 0;
|
||||||
|
|
||||||
|
planet.x = SCREEN_WIDTH;
|
||||||
|
planet.y = (rand() % SCREEN_HEIGHT - 128);
|
||||||
|
|
||||||
game.currentMission = NULL;
|
game.currentMission = NULL;
|
||||||
|
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
|
@ -112,6 +118,13 @@ static void logic(void)
|
||||||
|
|
||||||
doStars(0.5, 0);
|
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)
|
switch (show)
|
||||||
{
|
{
|
||||||
case SHOW_CHALLENGES:
|
case SHOW_CHALLENGES:
|
||||||
|
@ -161,6 +174,8 @@ static void draw(void)
|
||||||
{
|
{
|
||||||
drawBackground(background);
|
drawBackground(background);
|
||||||
|
|
||||||
|
blit(planetTexture, planet.x, planet.y, 0);
|
||||||
|
|
||||||
drawStars();
|
drawStars();
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 50, 30, TA_CENTER, colors.white, _("Challenges"));
|
drawText(SCREEN_WIDTH / 2, 50, 30, TA_CENTER, colors.white, _("Challenges"));
|
||||||
|
|
|
@ -54,6 +54,7 @@ extern void playSound(int sound);
|
||||||
extern void selectWidget(const char *name, const char *group);
|
extern void selectWidget(const char *name, const char *group);
|
||||||
extern void updateAllMissions(void);
|
extern void updateAllMissions(void);
|
||||||
extern char *getTranslatedString(char *string);
|
extern char *getTranslatedString(char *string);
|
||||||
|
extern void blit(SDL_Texture *t, int x, int y, int centered);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
Loading…
Reference in New Issue