Draw clouds on hub map.
This commit is contained in:
parent
299b15dac5
commit
17cb8bdc84
Binary file not shown.
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.7 MiB |
|
@ -58,6 +58,7 @@ static PointF cursor;
|
||||||
static float blipSize;
|
static float blipSize;
|
||||||
static float blipValue;
|
static float blipValue;
|
||||||
static int showingWidgets;
|
static int showingWidgets;
|
||||||
|
static PointF cloudPos;
|
||||||
|
|
||||||
void initHub(void)
|
void initHub(void)
|
||||||
{
|
{
|
||||||
|
@ -183,6 +184,9 @@ void initHub(void)
|
||||||
teeka->status = MS_LOCKED;
|
teeka->status = MS_LOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cloudPos.x = randF() - randF();
|
||||||
|
cloudPos.y = randF() - randF();
|
||||||
|
|
||||||
app.delegate.logic = &logic;
|
app.delegate.logic = &logic;
|
||||||
app.delegate.draw = &draw;
|
app.delegate.draw = &draw;
|
||||||
|
|
||||||
|
@ -197,6 +201,8 @@ static void logic(void)
|
||||||
|
|
||||||
blipSize = 64 + (sin(blipValue) * 16);
|
blipSize = 64 + (sin(blipValue) * 16);
|
||||||
|
|
||||||
|
scrollBackground(cloudPos.x, cloudPos.y);
|
||||||
|
|
||||||
animateSprites();
|
animateSprites();
|
||||||
|
|
||||||
doCursor();
|
doCursor();
|
||||||
|
@ -291,6 +297,8 @@ static void draw(void)
|
||||||
{
|
{
|
||||||
blitRectScaled(atlasTexture->texture, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, &worldMap->rect, 0);
|
blitRectScaled(atlasTexture->texture, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, &worldMap->rect, 0);
|
||||||
|
|
||||||
|
drawBackground(atlasTexture->texture, &clouds->rect);
|
||||||
|
|
||||||
drawMissions();
|
drawMissions();
|
||||||
|
|
||||||
drawInfoBar();
|
drawInfoBar();
|
||||||
|
|
|
@ -50,6 +50,9 @@ extern void stopMusic(void);
|
||||||
extern void startSectionTransition(void);
|
extern void startSectionTransition(void);
|
||||||
extern void endSectionTransition(void);
|
extern void endSectionTransition(void);
|
||||||
extern void initWorld(void);
|
extern void initWorld(void);
|
||||||
|
extern void drawBackground(SDL_Texture *texture, SDL_Rect *srcRect);
|
||||||
|
extern void scrollBackground(float x, float y);
|
||||||
|
extern double randF(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
|
@ -22,6 +22,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
static void initColor(SDL_Color *c, int r, int g, int b);
|
static void initColor(SDL_Color *c, int r, int g, int b);
|
||||||
|
|
||||||
|
static PointF backgroundPoint[4];
|
||||||
|
|
||||||
|
void initBackground(void)
|
||||||
|
{
|
||||||
|
backgroundPoint[0].x = -SCREEN_WIDTH / 2;
|
||||||
|
backgroundPoint[0].y = -SCREEN_HEIGHT / 2;
|
||||||
|
|
||||||
|
backgroundPoint[1].x = SCREEN_WIDTH / 2;
|
||||||
|
backgroundPoint[1].y = -SCREEN_HEIGHT / 2;
|
||||||
|
|
||||||
|
backgroundPoint[2].x = -SCREEN_WIDTH / 2;
|
||||||
|
backgroundPoint[2].y = SCREEN_HEIGHT / 2;
|
||||||
|
|
||||||
|
backgroundPoint[3].x = SCREEN_WIDTH / 2;
|
||||||
|
backgroundPoint[3].y = SCREEN_HEIGHT / 2;
|
||||||
|
}
|
||||||
|
|
||||||
void initGraphics(void)
|
void initGraphics(void)
|
||||||
{
|
{
|
||||||
initColor(&colors.red, 255, 0, 0);
|
initColor(&colors.red, 255, 0, 0);
|
||||||
|
@ -187,6 +204,47 @@ void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a)
|
||||||
SDL_RenderDrawRect(app.renderer, &rect);
|
SDL_RenderDrawRect(app.renderer, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void scrollBackground(float x, float y)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0 ; i < 4 ; i++)
|
||||||
|
{
|
||||||
|
backgroundPoint[i].x += x;
|
||||||
|
backgroundPoint[i].y += y;
|
||||||
|
|
||||||
|
if (backgroundPoint[i].x < 0)
|
||||||
|
{
|
||||||
|
backgroundPoint[i].x += (SCREEN_WIDTH * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backgroundPoint[i].x >= SCREEN_WIDTH)
|
||||||
|
{
|
||||||
|
backgroundPoint[i].x -= (SCREEN_WIDTH * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backgroundPoint[i].y < 0)
|
||||||
|
{
|
||||||
|
backgroundPoint[i].y += (SCREEN_HEIGHT * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backgroundPoint[i].y >= SCREEN_HEIGHT)
|
||||||
|
{
|
||||||
|
backgroundPoint[i].y -= (SCREEN_HEIGHT * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawBackground(SDL_Texture *texture, SDL_Rect *srcRect)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0 ; i < 4 ; i++)
|
||||||
|
{
|
||||||
|
blitRectScaled(texture, backgroundPoint[i].x, backgroundPoint[i].y, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, srcRect, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void initColor(SDL_Color *c, int r, int g, int b)
|
static void initColor(SDL_Color *c, int r, int g, int b)
|
||||||
{
|
{
|
||||||
memset(c, 0, sizeof(SDL_Color));
|
memset(c, 0, sizeof(SDL_Color));
|
||||||
|
|
|
@ -134,6 +134,7 @@ void initGameSystem(void)
|
||||||
int i, numInitFuns;
|
int i, numInitFuns;
|
||||||
void (*initFuncs[]) (void) = {
|
void (*initFuncs[]) (void) = {
|
||||||
initGraphics,
|
initGraphics,
|
||||||
|
initBackground,
|
||||||
initFonts,
|
initFonts,
|
||||||
initAtlas,
|
initAtlas,
|
||||||
initWidgets,
|
initWidgets,
|
||||||
|
|
|
@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern void createSaveFolder(void);
|
extern void createSaveFolder(void);
|
||||||
extern void setLanguage(char *applicationName, char *languageCode);
|
extern void setLanguage(char *applicationName, char *languageCode);
|
||||||
|
extern void initBackground(void);
|
||||||
extern void initGraphics(void);
|
extern void initGraphics(void);
|
||||||
extern void initFonts(void);
|
extern void initFonts(void);
|
||||||
extern void initAtlas(void);
|
extern void initAtlas(void);
|
||||||
|
|
Loading…
Reference in New Issue