able to click with cursor, button detect clicking event

This commit is contained in:
Remco
2016-06-20 13:29:28 +02:00
parent 1ec3c8f346
commit 2e50d11e07
5 changed files with 33 additions and 2 deletions
+8
View File
@@ -9,6 +9,7 @@ Cursor::Cursor()
{
enabled = false;
mousePosition = Vec2f(CrystalPoint::width / 2, CrystalPoint::height / 2);
clicked = false;
}
Cursor::~Cursor()
@@ -68,4 +69,11 @@ void Cursor::update(Vec2f newPosition)
newPosition.y = CrystalPoint::height;
mousePosition = newPosition;
if (clicked)
clicked = !clicked;
if (state != prev)
if(state == GLUT_UP)
clicked = true;
prev = state;
}