A
download FloatingText.cpp
Language: C++
LOC: 25
Project Info
TableHockey3D(tablehockey)
Server: SourceForge
Type: cvs
...ey\CVSROOT\tablehockey\src\
   Application.cpp
   Application.h
   Camera.cpp
   Camera.h
   Cube.cpp
   Cube.h
   Data.cpp
   Data.h
   Disk.cpp
   Disk.h
   FloatingText.cpp
   FloatingText.h
   Floor.cpp
   Floor.h
   Input.cpp
   Input.h
   Light.cpp
   Light.h
   log.cpp
   log.h
   main.cpp
   mmgr.cpp
   mmgr.h
   Model.cpp
   Model.h
   nommgr.h
   Puck.cpp
   Puck.h
   Pyramid.cpp
   Pyramid.h
   scene.cpp
   scene.h
   SmartPtr.h
   Sound.cpp
   Sound.h
   TableHockey.dsp
   TableHockey.dsw
   TestScene.cpp
   TestScene.h
   text.cpp
   text.h
   TextHelp.cpp
   TextHelp.h
   texture.cpp
   texture.h
   TexturedCube.cpp
   TexturedCube.h
   timer.cpp
   timer.h
   View.cpp
   View.h

// FloatingText.cpp: implementation of the CFloatingText class.
//
//////////////////////////////////////////////////////////////////////

#include <math.h>
#include "FloatingText.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CFloatingText::CFloatingText()
: cnt1(0.0),
  cnt2(0.0)
{
	BuildFont("Courier New", 24, FW_BOLD);
}

CFloatingText::~CFloatingText()
{

}

void CFloatingText::Draw()
{
	// save current matrix
	glPushMatrix();

	glTranslatef(0.0f,0.0f,-1.0f);						// Move One Unit Into The Screen
	// Pulsing Colors Based On Text Position
	glColor3f(1.0f*float(cos(cnt1)),
			1.0f*float(sin(cnt2)),
			1.0f-0.5f*float(cos(cnt1+cnt2)));

	// Position The Text On The Screen
	glRasterPos2f(-0.45f+0.05f*float(cos(cnt1)), 
		0.32f*float(sin(cnt2)));
 
	// Print GL Text To The Screen with the current FPS
	glPrint("Floating text output - %7.2f FPS", pApp->FramesPerSecond);

	glPopMatrix();
	
	// update variables
	cnt1+=0.051f;						// Increase The First Counter
	cnt2+=0.005f;						// Increase The Second Counter
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us