// Author: Jasongamer
// Description: A tool for helping people learn trig

Main();

#include <drivers\drv_gl.txt>

void Main()
{
    glClear( 0, 0, 0 ); // Clear screen
    glCoordPipe( GL_CPIPE_N1_1 ); // Set coordinate pipe (-1 to 1 mode)

    timer R0; // Set time to curtime()
    R0 = -R0 * 1;

    glColor( 255, 255, 255 ); // Set draw color
    glCircle( *orig.x, *orig.y, 0.66, 40 ); // Draw circle (x, y, radius, quality)

    glColor( 0, 0, 0 );
    glCircle( *orig.x, *orig.y, 0.64, 40 );

    // Set the points for the trig
    fcos *cos,R0;
    fsin *sin,R0;

    *PosR.x = *cos;
    *PosR.x *= 0.65;
    *PosR.x += *orig.x;

    *PosR.y = *sin;
    *PosR.y *= 0.65;
    *PosR.y += *orig.y;

    *PosX.x = *PosR.x;

    glLineWidth( 0.01 ); // Set line width
    glFontSize( 24 ); // Set font size

    // X part of triangle
    glColor( 0, 0, 255 );
    glLine( *orig.x, *orig.y, *PosX.x, *PosX.y ); // Draw line
    glWriteFmt( -0.95, -0.95, sCos ) // Write formatted string

    // Y part of triangle
    glColor( 255, 0, 0 );
    glLine( *PosR.x, *PosR.y, *PosX.x, *PosX.y );
    *sin *= -1; // Negate
    glWriteFmt( -0.95, -0.85, sSin );

    glColor( 255, 255, 255 );
    glLine( *orig.x, *orig.y, *PosR.x, *PosR.y ); // Draw line

    glExit(); // Exit
}

vec2f orig,0,0;
vec2f PosR,0,0;
vec2f PosX,0,0;

string sCos,"Cosine = %f";
alloc cos;

string sSin,"Sine   = %f";
alloc sin;
