able to give button a funtion pointer, who will be called when clicked on the button

This commit is contained in:
Remco
2016-06-20 13:42:28 +02:00
parent 2e50d11e07
commit 7758f2c294
3 changed files with 23 additions and 2 deletions
+7 -1
View File
@@ -54,7 +54,13 @@ void Button::update(int x, int y)
alfa = 0.5f;
if (cursorOnButton && Cursor::getInstance()->clicked)
this->setColor(Vec3f(0, 255, 0));
if(action != nullptr)
action(this);
}
void Button::addAction(action_function action)
{
this->action = action;
}
void Button::setForeground(Vec3f color)