Skip to content
Snippets Groups Projects
ButtonEventDispatcher.hpp 432 B
Newer Older
Christian Werner's avatar
Christian Werner committed
#pragma once

Christian Werner's avatar
Christian Werner committed
#include "ButtonEvent.hpp"
Christian Werner's avatar
Christian Werner committed
#include <cstddef>

class ButtonEventDispatcher {

private:
	static constexpr size_t capacity = 4;
	void (*callbackFuncPtr[capacity])(const ButtonEvent& e);
public:
    typedef void (*callbackPtr_t)(const ButtonEvent& e);

	ButtonEventDispatcher();
	void Dispatch(const ButtonEvent& e) const;
	void RegisterButtonHandler(callbackPtr_t cb);
	void UnregisterButtonHandler(callbackPtr_t cb);
};