April 2017
Beginner to intermediate
394 pages
9h 16m
English
We have the problem of wanting to decouple a specific function call from the place that calls it. It would be nice to be able to create a button component that could save a function pointer or something like it, and call it when the component is clicked.
One solution could be to create a new component for every action we want to execute. For example, we might want to create a component that will change the stage to the main menu. We could create a component class that knows how to perform that exact action:
//MainMenuComponent.h class MainMenuComponent : public M5Component { public: MainMenuComponent(void); ~MainMenuComponent(void); virtual void Update(float dt); virtual void FromFile(M5IniFile&); virtual ...Read now
Unlock full access