able to give button a funtion pointer, who will be called when clicked on the button
This commit is contained in:
+8
-1
@@ -25,7 +25,14 @@ void CrystalPoint::init()
|
||||
menu = new Menu();
|
||||
menu->AddMenuElement(new Text("Hello", Vec2f(10, 10)));
|
||||
menu->AddMenuElement(new Button("Start", Vec2f(1920 / 2 - 50, 1080 / 2 - 25), 100, 50));
|
||||
menu->AddMenuElement(new Button("Test", Vec2f(1920 / 2 - 50, 1080 / 2 - 100), 100, 50));
|
||||
Button* b = new Button("Test", Vec2f(1920 / 2 - 50, 1080 / 2 - 100), 100, 50);
|
||||
|
||||
b->addAction([](Button* b)
|
||||
{
|
||||
b->setColor(Vec3f(0, 255, 0));
|
||||
});
|
||||
menu->AddMenuElement(b);
|
||||
|
||||
lastFrameTime = 0;
|
||||
|
||||
glClearColor(0.7f, 0.7f, 1.0f, 1.0f);
|
||||
|
||||
Reference in New Issue
Block a user