2017-12-14 11:38:44 +01:00
|
|
|
#ifndef CONVERT_H
|
|
|
|
#define CONVERT_H
|
|
|
|
|
2019-03-02 23:52:22 +01:00
|
|
|
#include <stdbool.h>
|
2017-12-14 11:38:44 +01:00
|
|
|
#include <SDL2/SDL_events.h>
|
2019-03-02 23:52:22 +01:00
|
|
|
|
2019-09-29 22:36:56 +02:00
|
|
|
#include "config.h"
|
2019-05-31 14:55:11 +02:00
|
|
|
#include "control_msg.h"
|
2017-12-14 11:38:44 +01:00
|
|
|
|
2018-01-22 16:50:08 +01:00
|
|
|
struct complete_mouse_motion_event {
|
|
|
|
SDL_MouseMotionEvent *mouse_motion_event;
|
|
|
|
struct size screen_size;
|
|
|
|
};
|
|
|
|
|
2017-12-14 11:38:44 +01:00
|
|
|
struct complete_mouse_wheel_event {
|
|
|
|
SDL_MouseWheelEvent *mouse_wheel_event;
|
2018-01-22 16:50:08 +01:00
|
|
|
struct point position;
|
2017-12-14 11:38:44 +01:00
|
|
|
};
|
|
|
|
|
2019-03-02 23:52:22 +01:00
|
|
|
bool
|
2019-09-15 16:32:46 +02:00
|
|
|
convert_input_key(const SDL_KeyboardEvent *from, struct control_msg *to);
|
2019-03-02 20:09:56 +01:00
|
|
|
|
2019-03-02 23:52:22 +01:00
|
|
|
bool
|
2019-09-15 16:32:46 +02:00
|
|
|
convert_mouse_button(const SDL_MouseButtonEvent *from, struct size screen_size,
|
|
|
|
struct control_msg *to);
|
2019-03-02 20:09:56 +01:00
|
|
|
|
|
|
|
// the video size may be different from the real device size, so we need the
|
|
|
|
// size to which the absolute position apply, to scale it accordingly
|
2019-03-02 23:52:22 +01:00
|
|
|
bool
|
2019-09-15 16:32:46 +02:00
|
|
|
convert_mouse_motion(const SDL_MouseMotionEvent *from, struct size screen_size,
|
|
|
|
struct control_msg *to);
|
2018-01-22 16:50:08 +01:00
|
|
|
|
2019-09-22 21:30:05 +02:00
|
|
|
bool
|
|
|
|
convert_touch(const SDL_TouchFingerEvent *from, struct size screen_size,
|
|
|
|
struct control_msg *to);
|
|
|
|
|
2018-01-22 16:50:08 +01:00
|
|
|
// on Android, a scroll event requires the current mouse position
|
2019-03-02 23:52:22 +01:00
|
|
|
bool
|
2019-09-15 16:32:46 +02:00
|
|
|
convert_mouse_wheel(const SDL_MouseWheelEvent *from, struct position position,
|
|
|
|
struct control_msg *to);
|
2017-12-14 11:38:44 +01:00
|
|
|
|
|
|
|
#endif
|