Commits

Trammell Hudson  committed 801c37d

Switch to a 128x screen and slow maximum rotation speed

  • Participants
  • Parent commits 0367044

Comments (0)

Files changed (1)

 #include "app.h"
 #include "sin_table.h"
 
-#define MAX_STARS 64
+#define MAX_STARS 128
 
 
 struct star
 {
-	int16_t x; // scaled by 16
+	int16_t x; // scaled by 128
 	int16_t y;
 	int8_t dx;
 	int8_t dy;
 stars_twist(void)
 {
 	// Pick a slow rotate speed
-	uint8_t rotate = (rand() & 0x7) - 4;
+	uint8_t rotate = (rand() & 0x3) - 2;
 	APP->rotate_sin = sin_lookup(rotate);
 	APP->rotate_cos = cos_lookup(rotate);
 }
 	color24_t color
 )
 {
-	int16_t x = star->x / 16 + SCREEN_WIDTH / 2;
-	int16_t y = star->y / 16 + SCREEN_HEIGHT / 2;
+	int16_t x = star->x / 128 + SCREEN_WIDTH / 2;
+	int16_t y = star->y / 128 + SCREEN_HEIGHT / 2;
 
 	pulse_set_draw_window(x, y, x, y);
 	pulse_draw_point24(color);
 	int32_t dy = (APP->rotate_cos * star->dy + APP->rotate_sin * star->dx) / 120;
 
 	// Rotate the position, also allowing for some speed up
-	int32_t x = (APP->rotate_cos * star->x - APP->rotate_sin * star->y + dx / 2) / 120 + dx;
+	int32_t x = (APP->rotate_cos * star->x - APP->rotate_sin * star->y) / 120 + dx;
 	int32_t y = (APP->rotate_cos * star->y + APP->rotate_sin * star->x) / 120 + dy;
 
-	if (x <= -SCREEN_WIDTH * 8 || x >= SCREEN_WIDTH * 8
-	||  y <= -SCREEN_HEIGHT * 8 || y >= SCREEN_HEIGHT * 8
-	||  star->age++ > 2000)
+	if (x <= -SCREEN_WIDTH * 64 || x >= SCREEN_WIDTH * 64
+	||  y <= -SCREEN_HEIGHT * 64 || y >= SCREEN_HEIGHT * 64
+	||  star->age++ > 4000)
 	{
 		star_create(star);
 		return;
 	};
 
 	// Earlier stars are darker
-	if (star->age < 100)
+	if (star->age < 1000)
 		color.red = color.blue = color.green = star->brightness / 4;
 	else
-	if (star->age < 200)
+	if (star->age < 2000)
 		color.red = color.blue = color.green = star->brightness / 2;
 
 	star_draw_point(star, color);