71 lines
1.7 KiB
C++
71 lines
1.7 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_FOCUS_IN = 0,
|
|
RK_EVENT_FOCUS_OUT = 1,
|
|
RK_EVENT_KEY_PRESS = 2,
|
|
RK_EVENT_KEY_RELEASE = 3,
|
|
RK_EVENT_BUTTON_PRESS = 4,
|
|
RK_EVENT_BUTTON_RELEASE = 5,
|
|
RK_EVENT_MOTION = 6
|
|
};
|
|
|
|
struct rk_event_key {
|
|
rk_uint code;
|
|
rk_uint symbol;
|
|
rk_wchar character;
|
|
};
|
|
|
|
struct rk_event_button {
|
|
rk_uint index;
|
|
};
|
|
|
|
struct rk_event_motion {
|
|
rk_int x;
|
|
rk_int y;
|
|
};
|
|
|
|
struct rk_event {
|
|
rk_event_type type;
|
|
union {
|
|
rk_event_key key;
|
|
rk_event_button button;
|
|
rk_event_motion motion;
|
|
};
|
|
};
|
|
|
|
extern bool rk_initialize_events();
|
|
extern void rk_terminate_events();
|
|
|
|
RK_EXPORT void rk_set_autorepeat(
|
|
rk_bool autorepeat);
|
|
|
|
RK_EXPORT void rk_set_acceleration(
|
|
rk_uint numerator,
|
|
rk_uint denominator,
|
|
rk_uint threshold);
|
|
|
|
RK_EXPORT rk_uint rk_consume_events(
|
|
rk_event * events,
|
|
rk_uint max_events);
|
|
|
|
#endif // _RK_ENGINE_EVENTS_H
|