Integrating the Event Manager class
Because the event manager needs to check all the events that get processed, it makes sense to keep it in our Window
class, where we actually do the event polling. After all, the events that we're processing all originate from the window that's open, so it only makes sense to keep an instance of the event manager here. Let's make a slight adjustment to the Window
class by adding a data member to it:
class Window{ public: ... bool IsFocused(); EventManager* GetEventManager(); void ToggleFullscreen(EventDetails* l_details); void Close(EventDetails* l_details = nullptr); ... private: ... EventManager m_eventManager; bool m_isFocused; };
In addition to adding an extra method for obtaining the event manager, the full screen toggle method has been modified to take in the EventDetails
structure as an argument. A Close
method is also added to our Window
class, as well as a flag to keep track of whether the window is in focus or...