December 2015
Beginner to intermediate
522 pages
11h 21m
English
Providing fluid interactivity with the interface and a painless way of associating changes with actions inside your application may be the most important criterion to separate good GUI systems from bad ones. As we are already learning SFML, we can use the SFML method and omit events.
Firstly, we have to define all the possible events that could take place in an interface. Create a GUI_Event.h file and construct an enumeration, as shown here:
enum class GUI_EventType{ None, Click, Release, Hover, Leave };We must also define a custom structure in the same file that is used to hold event information:
struct ClickCoordinates{ float x, y; }; struct GUI_Event{ GUI_EventType m_type; const char* m_element; const char* m_interface; union{ ...Read now
Unlock full access