KTech 1.1.0
C++ 2D terminal game engine library
Loading...
Searching...
No Matches
callback.hpp
1/*
2 KTech, Kaup's C++ 2D terminal game engine library.
3 Copyright (C) 2023-2025 Ethan Kaufman (AKA Kaup)
4
5 This file is part of KTech.
6
7 KTech is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 any later version.
11
12 KTech is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with KTech. If not, see <https://www.gnu.org/licenses/>.
19*/
20
21#pragma once
22
23#include <utility>
24
25#include "input.hpp"
26
27struct KTech::Input::Callback
28{
29 enum class Status : uint8_t
30 {
31 disabled,
32 enabled,
33 awaitingDeletion
34 };
35
36 Status status = Status::disabled;
37 const std::function<bool()> ptr;
38 std::shared_ptr<Handler> const parentHandler;
39
40 Callback(const std::function<bool()>& callback, std::shared_ptr<Handler> parentHandler)
41 : ptr(callback), parentHandler(std::move(parentHandler)) {}
42};