Skip to content
Snippets Groups Projects
Commit 35d85071 authored by Eila Aurora Huru Bergene's avatar Eila Aurora Huru Bergene
Browse files

Fix callback example

parent 6715a8f4
No related branches found
No related tags found
No related merge requests found
Pipeline #231114 passed
......@@ -105,8 +105,8 @@ class SuperManWindow : public AnimationWindow {
void superCallbackFunction();
void fly();
private:
Button flyButton();
}
Button flyButton;
};
void SuperManWindow::superCallbackFunction() {
std::cout << "Thanks for clicking, im going to fly\n";
......@@ -115,11 +115,12 @@ void SuperManWindow::superCallbackFunction() {
}
SuperManWindow::SuperManWindow()
: AnimationWindow(100, 100, 100, 100, "Super man window"),
flyButton{{10, 10}, 5, 5, "fly"} {
: AnimationWindow(50, 50, 500, 500, "Super man window"),
flyButton{{100, 100}, 50, 50, "fly"} {
// Here we convert the class method to a void function
// by binding this instance of the class to the function
flyButton.setCallback(std::bind(&SuperManWindow::superCallbackFunction, this));
add(flyButton);
}
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment