From 909cdd76f3947bd372c96fbd38f929892fe3e058 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 14 Feb 2016 11:08:03 +0000 Subject: [PATCH] Now drawing stars after planet. Increased size of brightest stars by one pixel. --- src/battle/battle.c | 4 ++-- src/battle/starfield.c | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/battle/battle.c b/src/battle/battle.c index d23ae05..ff24465 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -195,10 +195,10 @@ static void draw(void) drawBackground(battle.background); - drawStars(); - blit(battle.planetTexture, battle.planet.x, battle.planet.y, 1); + drawStars(); + drawEntities(); drawBullets(); diff --git a/src/battle/starfield.c b/src/battle/starfield.c index fe569e9..0820fd2 100644 --- a/src/battle/starfield.c +++ b/src/battle/starfield.c @@ -32,7 +32,7 @@ void initStars(void) { stars[i].x = rand() % SCREEN_WIDTH; stars[i].y = rand() % SCREEN_HEIGHT; - stars[i].speed = 10 + rand() % 30; + stars[i].speed = 5 + rand() % 35; stars[i].speed *= 0.1; } @@ -76,10 +76,15 @@ void drawStars(void) 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_RenderDrawPoint(app.renderer, stars[i].x, stars[i].y); + + if (c >= 240) + { + SDL_RenderDrawPoint(app.renderer, stars[i].x + 1, stars[i].y + 1); + } } }