Example #1
0
void Scope::draw() {
#ifndef NO_GRAPHICS
	glPushMatrix();
	glScalef(0.8, 0.8, 1);
	glTranslatef(0, -0.5, 0);

	glColor4f(0, 0.5, 0, 1);
	glLineWidth(1);

	for (int i = 0; i < ticks.size(); ++i) {
		ticks[i]->draw();
	}

	glLineWidth(2);
	for (int i = 0; i < spokes.size(); ++i) {
		spokes[i]->draw();
	}

	if (enabled) {
		glColor4f(0.2, 0.8, 0.2, 1);
	} else {
		glColor4f(0.8, 0.2, 0.2, 1);
	}
	for (int i = 0; i < 4; ++i) {
		glLineWidth(i == 0 ? 5 : 2);
		rings[i]->draw();
	}

	long long when = now();

	{
		QMutexLocker locker(&lock);

		for (int i = 0; i < hits.size(); ++i) {
			Hit * current = hits[i];
			if (current->refresh(when)) {
				current->draw();
			}
		}

	}

	glPopMatrix();
#endif
}