This should do it, but it doesn't use the darkGDK random functions
#include "DarkGDK.h"
#include <Time.h>
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
srand(time(NULL));
float Point1x;//the lines endpoints
float Point1y;
float Point2x;
float Point2y;
Point1x = 250 + rand()%200;
Point1y = 250 + rand()%200;
Point2x = 250 + rand()%200;
Point2y = 250 + rand()%200;
while ( LoopGDK ( ) )
{
dbInk (dbRGB (255, 255, 255), 0);
dbLine (Point1x, Point1y, Point2x, Point2y);
dbCircle ((Point1x + Point2x)/2, (Point1y + Point2y)/2, 5);
dbInk (dbRGB (255, 0, 0), 0);
dbDot ((Point1x + Point2x)/2, (Point1y + Point2y)/2);//put a dot on the midpoint
if (dbReturnKey() == 1)
{
Point1x = 250 + rand()%200;
Point1y = 250 + rand()%200;
Point2x = 250 + rand()%200;
Point2y = 250 + rand()%200;
dbCLS();
}
// update the screen
dbSync ( );
}
// return back to windows
return;
}