able to give button a funtion pointer, who will be called when clicked on the button
This commit is contained in:
+7
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user