81 lines
1.9 KiB
C++
81 lines
1.9 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"
|
|
#include "display.hpp"
|
|
|
|
typedef rk_handle_t rk_events_t;
|
|
|
|
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;
|
|
};
|
|
};
|
|
|
|
RK_EXPORT rk_events_t rk_create_events(
|
|
rk_display_t display);
|
|
|
|
RK_EXPORT void rk_destroy_events(
|
|
rk_display_t display,
|
|
rk_events_t events);
|
|
|
|
RK_EXPORT void rk_set_key_autorepeat(
|
|
rk_events_t events,
|
|
rk_bool autorepeat);
|
|
|
|
RK_EXPORT void rk_set_motion_acceleration(
|
|
rk_events_t events,
|
|
rk_uint numerator,
|
|
rk_uint denominator,
|
|
rk_uint threshold);
|
|
|
|
RK_EXPORT rk_uint rk_consume_events(
|
|
rk_events_t events,
|
|
rk_event * buffer,
|
|
rk_uint max_events);
|
|
|
|
#endif // _RK_ENGINE_EVENTS_H
|