Exemple #1
0
void Drone::draw(SpriteBuffer& sprite_buffer, const Camera& camera) const {
	Sprite drone_spr;
	drone_spr.setImg(34, 1, 24, 24);
	drone_spr.setPos(camera.transform(rb.pos));

	SpriteMatrix matrix;
	matrix.loadIdentity().rotate(angle);

	sprite_buffer.append(drone_spr, matrix);

	if (anim_flags.test(AnimationFlags::YELLOW_STROBE)) {
		drone_spr.img_y = 1+1*25;
		sprite_buffer.append(drone_spr, matrix);
	}

	if (anim_flags.test(AnimationFlags::RED_STROBE)) {
		drone_spr.img_y = 1+2*25;
		sprite_buffer.append(drone_spr, matrix);
	}
}
Exemple #2
0
void Ship::draw(SpriteBuffer& sprite_buffer, const Camera& camera) const {
	Sprite ship_spr;
	ship_spr.img = img_ship_body;
	ship_spr.setPos(camera.transform(rb.pos));

	SpriteMatrix matrix;
	matrix.loadIdentity().rotate(rb.orientation);

	sprite_buffer.append(ship_spr, matrix);

	if (anim_flags.test(AnimationFlags::THRUST_FORWARD)) {
		ship_spr.img = img_ship_thrust;
		sprite_buffer.append(ship_spr, matrix);
	}

	if (anim_flags.test(AnimationFlags::INERTIAL_BRAKE)) {
		ship_spr.img = img_ship_brake;
		sprite_buffer.append(ship_spr, matrix);
	}

	shield.draw(sprite_buffer, ship_spr.x, ship_spr.y);
}