3D Game Builder SDK

SDK Functions

gameSin( float angle )

Description

Return the arc sine value for an angle in degrees.

Specification

float gameSin( float angle )

float angle

= angle in degrees (use -360 to 360)

return value

= sine value for the angle

Notes

This function allows you to calculate arcs, circles and movement in a particular direction.

For Example

#include "3dgamebuilder.h"


// exported game function
DLL_EXPORT int gameLoop(void)
{
	int		i;
	float	angle;

	while(1)
	{
		// read the controller
		gamePadRead();

		// start drawing
		gameStartRender();

		// init OpenGL projection matrix
		glMatrixMode( GL_PROJECTION );
		glLoadIdentity();
		
		// init OpenGL model view matrix
		glMatrixMode( GL_MODELVIEW );
		glLoadIdentity();

		// draw 2 OpenGL triangles using 6 vert's
		// (poor performance)
		glBegin( GL_TRIANGLE_FAN );
			glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
			glVertex2f( 0.0f,  0.0f );
			for (i=0;i<=270;i++)
			{
				angle = i;
				glVertex2f( gameSin(angle) * 0.8f, 
						gameCos(angle) * 0.8f );
			}
		glEnd();

		// end of drawing
		gameEndRender();
	}

	return 0;
}

See Also

  gameSin( float angle )
  gameCos( float angle )

Go Back

SDK Functions