Now drawing stars after planet. Increased size of brightest stars by one pixel.
This commit is contained in:
parent
17c55ec080
commit
909cdd76f3
|
@ -195,10 +195,10 @@ static void draw(void)
|
||||||
|
|
||||||
drawBackground(battle.background);
|
drawBackground(battle.background);
|
||||||
|
|
||||||
drawStars();
|
|
||||||
|
|
||||||
blit(battle.planetTexture, battle.planet.x, battle.planet.y, 1);
|
blit(battle.planetTexture, battle.planet.x, battle.planet.y, 1);
|
||||||
|
|
||||||
|
drawStars();
|
||||||
|
|
||||||
drawEntities();
|
drawEntities();
|
||||||
|
|
||||||
drawBullets();
|
drawBullets();
|
||||||
|
|
|
@ -32,7 +32,7 @@ void initStars(void)
|
||||||
{
|
{
|
||||||
stars[i].x = rand() % SCREEN_WIDTH;
|
stars[i].x = rand() % SCREEN_WIDTH;
|
||||||
stars[i].y = rand() % SCREEN_HEIGHT;
|
stars[i].y = rand() % SCREEN_HEIGHT;
|
||||||
stars[i].speed = 10 + rand() % 30;
|
stars[i].speed = 5 + rand() % 35;
|
||||||
|
|
||||||
stars[i].speed *= 0.1;
|
stars[i].speed *= 0.1;
|
||||||
}
|
}
|
||||||
|
@ -76,10 +76,15 @@ void drawStars(void)
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_STARS ; i++)
|
for (i = 0 ; i < MAX_STARS ; i++)
|
||||||
{
|
{
|
||||||
c = 85 * stars[i].speed;
|
c = 64 * stars[i].speed;
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, c, c, c, 255);
|
SDL_SetRenderDrawColor(app.renderer, c, c, c, 255);
|
||||||
|
|
||||||
SDL_RenderDrawPoint(app.renderer, stars[i].x, stars[i].y);
|
SDL_RenderDrawPoint(app.renderer, stars[i].x, stars[i].y);
|
||||||
|
|
||||||
|
if (c >= 240)
|
||||||
|
{
|
||||||
|
SDL_RenderDrawPoint(app.renderer, stars[i].x + 1, stars[i].y + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue