static inline void starfield_move_and_draw(struct starfield * starfield) { int i; for(i=0;i<starfield->nb_stars;++i) { star_move(&(starfield->tab[i]), starfield->z_move, starfield->color); star_draw(&(starfield->tab[i]), starfield->z_move, starfield->color); } }
main() { unsigned char c; star_t *st, stars[MAX_STARS]; set_color(15, 1, 1); // set video mode to screen 2 set_mode(mode_2); //msx_screen(2); // set whole screen to color white/black fill(MODE2_ATTR, 0xf1, MODE2_MAX); // initialize stars for (c=0; c < MAX_STARS; c++) { st = stars + c; star_randomize(st); st->z = (rand() & 63) ; st->addr = 0; } // animation loop while (!get_trigger(0)) { // calculate star movement for (st=stars, c=0; c < MAX_STARS; c++, st++) star_move(st); // erase previous stars for (st=stars, c=0; c < MAX_STARS; c++, st++) vpoke(st->last, 0); // show new stars for (st=stars, c=0; c < MAX_STARS; c++, st++) vmerge(st->addr, st->sub); } //set_mode(mode_0); msx_screen(0); }