示例#1
0
void Starfield_Step(Starfield *starfield)
{
	for (int i = 0; i < num_stars; i++) {
		StarfieldStar *star = &starfield->stars[i];

		star->x += (max_depth - star->depth + 1);

		if (star->x > SCREEN_WIDTH) {
			star->x = 0;
			star->y = mod32(rand(), 192);
			star->depth = mod32(rand(), max_depth);
		}
	}
}
示例#2
0
static inline uint32_t update32(uint32_t *_reg, uint32_t _clr, uint32_t _set, uint32_t _val)
{
	uint32_t set = _val & _set;
	uint32_t clr = _clr & _val;
	return mod32(_reg, clr | _set, set);
}
示例#3
0
void Starfield_InitStar(StarfieldStar *star)
{
	star->x = rand() & 255;
	star->y = mod32(rand(), 192);
	star->depth = mod32(rand(), max_depth);
}