示例#1
0
void Renderer::Render2D(double dt)
{
  GLboolean light_enabled = glIsEnabled(GL_LIGHTING);

  //sets up the projection for drawing text on the screen
  glMatrixMode(GL_PROJECTION);
  glPushMatrix();
  glLoadIdentity();  
  glOrtho(0, width, height, 0, 0, 1);
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();

  glDisable(GL_LIGHTING);							//disable light for drawing text
  glLineWidth(1.0);
  //reset the matrices
  glBegin(GL_LINES);
  glVertex3f(width/2 + 9, (float)height/2, 0.0f);
  glVertex3f(width/2 - 8, (float)height/2, 0.0f);
  glVertex3f((float)width/2, height/2 + 8, 0.0f);
  glVertex3f((float)width/2, height/2 - 9, 0.0f);
  glEnd();

  DrawEnergyBar(jetpackBar, 5, 5, width / 5, height / 40);
  DrawEnergyBar(healthBar, 5, 5 + height / 40, width / 5, height / 40);

  glPopMatrix();
  glMatrixMode(GL_PROJECTION);
  glPopMatrix();
  glMatrixMode(GL_MODELVIEW);
  if(light_enabled)
    glEnable(GL_LIGHTING);
}
示例#2
0
INT CGpApp::Render()
{
	if(8>m_nSkip)
		return 0;

	m_pDev->SetRenderState(LC_RS_CLEAR_COLOR, 0xFF006699);
	
	m_pDev->BeginScene();	// Prepare Rendering...
	m_pDev->Clear(LC_CLEAR_COLOR_BUFFER | LC_CLEAR_DEPTH_BUFFER);	// Clear Backbuffer

	
	m_pSpt->Begin();				// Sprite Begin

	// Draw Game Play

	DrawBackground();
	DrawMissile();
	DrawShield();
	DrawPlayer();
	DrawEnergyBar();
	DrawPlayerLife();

	m_pFontScore->DrawTxt();

	if(m_bShowSt)
		m_pFont->DrawTxt();




//	LCXRECT	rc;
//	LCXVECTOR2 vcPos;
//
//	vcPos = m_pFont->GetPosition();
//	m_pFont->GetAttrib(LC_FONT_RECT_SCALEUP, &rc);
//	vcPos.x += rc.w;
//
//	m_pFont->GetRect(&rc, 10);
//	vcPos.x = rc.x;
//	vcPos.y = rc.y;
//	m_pFont->DrawTxt(NULL, 0, -1, &vcPos);


	m_pSpt->End();				// Sprite End

	m_pDev->EndScene();			// Post Rendering...


	return LC_OK;
}