You need to make your own function that remembers if the mouse has been pressed/held etc. and then do logic to find out if it has been just released or just pressed.
Here's a sample of what you want. Please note that these may be primitive; there may be room for improvement.
bool MousePressed(int Button) { // Returns true if the mouse has been pressed.
static bool pressed = false;
static bool held = false;
if(pressed) {
pressed = false;
return false;
}
else if(dbMouseClick() == Button && !pressed && !held) {
pressed = true;
held = true;
return true;
}
else if(dbMouseClick() == Button) {
held = true;
pressed = false;
}
else
held = false;
return pressed;
}
bool MousePressedDelay(int Button, int Delay) { // Returns true if the mouse has been pressed until the Delay (milliseconds) is met.
static bool held = false;
static bool pressed = false;
static int prev = dbTimer();
int timer = 0;
if(dbMouseClick() == Button && !held && !pressed) {
prev = dbTimer();
pressed = true;
}
else if(dbMouseClick() == Button && !held && pressed) {
timer = dbTimer() - prev;
if(timer > Delay) {
pressed = false;
held = true;
}
}
else if(dbMouseClick() != Button) {
held = false;
pressed = false;
}
return pressed;
}
bool MouseReleased(int Button) { // Returns true if the mouse has just been released.
static bool held = false;
if(dbMouseClick() == Button && !held) {
held = true;
//return false;
}
else if(dbMouseClick() != Button && held) {
held = false;
//return true;
}
return !held;
}
bool MouseReleasedDelay(int Button, int Delay) { // Returns true if the mouse has been released until the Delay is met.
static bool held = false;
static bool released = false;
static int prev = dbTimer();
int timer = 0;
if(dbMouseClick() == Button && !held && !released)
held = true;
else if(dbMouseClick() != Button && held && !released) {
released = true;
held = false;
prev = dbTimer();
}
else if(released) {
timer = dbTimer() - prev;
if(timer > Delay)
released = false;
}
return released;
}
In case you don't know what 'static' means, it keeps the variable from being initialized/declared a second time and remembers it's value (the value never gets erased even when it's out of scope).
Edit: Tested and fixed problems.
#ifdef _DEBUG
FixBugs(All);
#endif