A simple and lightweight C++ event library to use out of the box.
Report a bug or request a feature
Clone the repo (git clone https:://github.com/torresflo/Simple-Event-Library.git
) and add the EventSystem folder to your project, you are ready to go!
#include <EventSystem\Event.hpp>
#include <EventSystem\EventHandler.hpp>
#include <EventSystem\IEventListener.hpp>
//Declaration of an event
class EventExample : public EventSystem::Event {};
//Declaration of an event listener for this event
class EventListenerExample : public EventSystem::IEventListener
{
public:
virtual void onEvent(const EventSystem::Event & event) override { /*Do something...*/ }
};
//Usage
EventListenerExample listener;
EventSystem::EventHandler eventHandler;
eventHandler.registerListener<EventExample>(&listener);
eventHandler.sendEvent<EventExample>(/*Parameters of the event if needed*/);
eventHandler.unregisterListener<EventExample>(&listener);
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU General Public License v3.0. See LICENSE
for more information.