Now drawing stars after planet. Increased size of brightest stars by one pixel.

This commit is contained in:
Steve 2016-02-14 11:08:03 +00:00
parent 17c55ec080
commit 909cdd76f3
2 changed files with 9 additions and 4 deletions

View File

@ -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();

View File

@ -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);
}
} }
} }