summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAMMJohnson <john_anthony@lavabit.com>2011-04-26 21:12:17 +0100
committerLAMMJohnson <john_anthony@lavabit.com>2011-04-26 21:12:17 +0100
commita9d3df3055ead43bdd8744fed232f55ff7debb35 (patch)
tree938fe40e73f0a60c9daf34401544107536c1fc0c
parent3e124e00f6f3425ef27de31378d6c0187ca75f0e (diff)
downloadnyancat-a9d3df3055ead43bdd8744fed232f55ff7debb35.tar.gz
nyancat-a9d3df3055ead43bdd8744fed232f55ff7debb35.tar.bz2
nyancat-a9d3df3055ead43bdd8744fed232f55ff7debb35.zip
Added sparkle pre-population
-rw-r--r--nyah.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/nyah.c b/nyah.c
index 3e3a013..7d616bc 100644
--- a/nyah.c
+++ b/nyah.c
@@ -44,7 +44,7 @@ void update_sparkles(void);
unsigned int SCREEN_WIDTH = 1920;
unsigned int SCREEN_HEIGHT = 1080;
-unsigned int FRAMERATE = 12;
+unsigned int FRAMERATE = 14;
unsigned int SCREEN_BPP = 32;
static SDL_Surface *screen = NULL;
@@ -112,7 +112,7 @@ draw_cats(unsigned int frame) {
pos.x = c->loc.x;
pos.y = c->loc.y;
- if(frame == 0)
+ if(frame < 2)
pos.y -= 5;
SDL_BlitSurface( cat_img[frame], NULL, screen, &pos );
@@ -227,6 +227,9 @@ void
update_sparkles(void) {
sparkle_instance* next, *s = sparkles_list;
+ add_sparkle();
+ add_sparkle();
+
while(s) {
s->loc.x -= s->speed;
next = s->next;
@@ -269,14 +272,15 @@ int main( int argc, char *argv[] )
/* clear initial input */
while( SDL_PollEvent( &event ) ) {}
+ /* Pre-populate with sparkles */
+ for (i = 0; i < 200; i++)
+ update_sparkles();
+
/* Main loop */
while( running )
{
last_draw = SDL_GetTicks();
- add_sparkle();
- add_sparkle();
-
CLEARSCR();
draw_sparkles(0);
draw_cats(curr_frame);