Loading...
Searching...
No Matches
EventReceiver.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4//
5// EventReceiver.h
6//
7
8#ifndef MALENA_EVENTRECEIVER_H
9#define MALENA_EVENTRECEIVER_H
10
11#pragma once
12
16#include <SFML/Window/Event.hpp>
17#include <map>
18#include <string>
19#include <vector>
20#include <optional>
21namespace ml
22{
41 {
42 public:
52 virtual void process(const std::string& key,
53 const std::optional<sf::Event>& event);
54
65 template<typename ENUM_TYPE>
66 void process(ENUM_TYPE eventName, const std::optional<sf::Event>& event);
67
68 virtual ~EventReceiver() = default;
69
71
78 std::vector<EventCallback>& getCallbacks(const std::string& key);
80
81 private:
82 std::map<std::string, std::vector<EventCallback>> _callbacks;
83 };
84
85} // namespace ml
86
87#include "../../../../src/Engine/Events/EventReceiver.tpp"
88#endif // MALENA_EVENTRECEIVER_H
Base class for all event-receiving traits.
virtual ~EventReceiver()=default
void process(ENUM_TYPE eventName, const std::optional< sf::Event > &event)
Invoke all callbacks registered for eventName.
virtual void process(const std::string &key, const std::optional< sf::Event > &event)
Invoke all callbacks registered for key.
#define MALENA_API
Definition Component.h:22