#include "DarkGDK.h"
bool Delayed_Mouse_Click(int Duration);
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
while ( LoopGDK ( ) )
{
if(Delayed_Mouse_Click(1000)) // approx. 1 sec. Enter any number in the parameters for the delay
dbPrint("Mouse has been clicked and held"); // Will stay on screen unless dbCLS is called.
dbSync ( );
}
return;
}
bool Delayed_Mouse_Click(int Duration) {
static int starttime = dbTimer();
static int time = 0;
static bool mouseclick = false;
if(dbMouseClick() == 1 && !mouseclick) {
mouseclick = true;
starttime = dbTimer();
time = 0;
}
if(mouseclick) {
time = dbTimer() - starttime;
if(time > Duration) {
time = 0;
starttime = 0;
mouseclick = false;
return true; // Mouse has been held for Duration.
}
if(dbMouseClick() != 1) { // If mouse not held anymore, reset everything and stop counting.
mouseclick = false;
starttime = 0;
time = 0;
}
}
return false; // Mouse not pressed or held long enough.
}
I think it's fairly understandable, so I won't explain it (also I don't have enough time right now)
#ifdef _DEBUG
FixBugs(All);
#endif