Example #1
0
void ProfileDrawer::DrawScreen()
{
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glLoadIdentity();
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	gluOrtho2D(0,1,0,1);

	glDisable(GL_TEXTURE_2D);
	font->Begin();
	font->SetTextColor(1,1,0.5f,0.8f);

	DrawThreadBarcode();
	DrawFrameBarcode();
	DrawProfiler();
	DrawInfoText();

	font->End();
	glColor4f(1.0f,1.0f,1.0f,1.0f);
	glEnable(GL_TEXTURE_2D);
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
}
Example #2
0
void App::OnPaint(HWND hwnd) {
	PAINTSTRUCT ps;
	RECT client_rect;

	HDC hdc = BeginPaint(hwnd, &ps);

	GetClientRect(hwnd, &client_rect);

	// Copies of bitmaps for drawing on them
	HDC hdc_mem = CreateCompatibleDC(hdc);
	HBITMAP h_mem_bitmap = CreateCompatibleBitmap(hdc, client_rect.right, client_rect.bottom);

	SelectObject(hdc_mem, GetStockObject(WHITE_BRUSH));
	SelectObject(hdc_mem, h_mem_bitmap);

	Rectangle(hdc_mem, client_rect.left - 1, client_rect.top - 1, client_rect.right + 1, client_rect.bottom + 1);

	m_background.Draw(hdc_mem, 0, 0, client_rect.right, client_rect.bottom);

	// Drawing here

	// Drawing number of bunnies on the screen
	DrawInfoText(hdc_mem);

	for (std::list<Bunny*>::iterator i = m_bunnies.begin(); i != m_bunnies.end(); ++i) {
		(*i)->Draw(hdc_mem);
	}

	// Stop drawing

	StretchBlt(hdc, 0, 0, client_rect.right, client_rect.bottom, hdc_mem, 0, 0, client_rect.right, client_rect.bottom, SRCCOPY);

	DeleteObject(hdc_mem);
	DeleteObject(h_mem_bitmap);

	EndPaint(hwnd, &ps);
}