rk_engine/cpp/events.hpp

46 lines
1.2 KiB
C++

// Copyright (C) 2022 RozK
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef _RK_ENGINE_EVENTS_H
#define _RK_ENGINE_EVENTS_H
#include "types.hpp"
enum rk_event_type : rk_uint {
RK_EVENT_KEY_PRESS = 0,
RK_EVENT_KEY_RELEASE = 1
};
struct rk_event_key {
rk_uint code;
rk_ushort symbol;
wchar_t character;
};
struct rk_event {
rk_event_type type;
union {
rk_event_key key;
};
};
RK_EXPORT rk_uint rk_consume_events(
rk_event * events,
rk_uint max_events);
RK_EXPORT void rk_flush_events();
#endif // _RK_ENGINE_EVENTS_H