Well, here it is without the angle printed. I also added an easy way to edit the line size:
//Project: GetAngleFrom2DCoordinate
//Created: 16/07/2003 00:14:38
//Author: Lee 'Dr DB' Bamber :)
#include <DarkGDK.h>
#include <string.h>
//Set coordinates
int youx = 640;
int youy = 480;
//Define size of line
#define line_size 400
//Main loop
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
while ( LoopGDK ( ) )
{
//Set moving target coordinate
int targetx = dbMouseX();
int targety = dbMouseY();
//Calculate angle from YOUR position to TARGET position
int dx = targetx - youx;
int dy = targety - youy;
int angle = dbATANFULL ( dx, dy );
//Clear screen
dbCLS();
//Draw coordinates
dbCircle ( youx, youy, 5 );
dbCircle ( targetx, targety, 5 );
//Show angle by drawing line
dbLine ( youx, youy, dbNewXValue ( youx, angle, line_size ), dbNewZValue ( youy, angle, line_size ) );
dbSync ( );
}
}
You just will have to make a way to print the angle with something like this:
dbCenterText ( 320, 260, "ANGLE = " + dbStr ( int ( dbWrapValue ( angle ) ) ) );
But, C++ isn't so simple. Try using strcat, but better than I did.