Started work on touch input rewrite
This commit is contained in:
parent
f359ecef79
commit
df49687f51
36 changed files with 557 additions and 560 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include <Helpers/SCollision.hpp>
|
||||
|
||||
#include "CustomEvents.hpp"
|
||||
#include "FingerInputTracker.hpp"
|
||||
|
||||
using namespace Eigen;
|
||||
class MainProgram;
|
||||
|
|
@ -90,20 +91,6 @@ struct InputManager {
|
|||
bool middleDown = false;
|
||||
} mouse;
|
||||
|
||||
struct Touch {
|
||||
uint8_t leftClicksSaved = 0;
|
||||
uint8_t fingerTapsSaved = 0;
|
||||
std::chrono::steady_clock::time_point lastLeftClickTime;
|
||||
std::chrono::steady_clock::time_point lastFingerTapTime;
|
||||
std::vector<SDL_TouchFingerEvent> fingers;
|
||||
enum TypeOfTouchEvent {
|
||||
NO_TOUCH_EVENT,
|
||||
ONE_FINGER_EVENT,
|
||||
TWO_FINGER_EVENT,
|
||||
EVENT_DONE
|
||||
} touchEventType = EVENT_DONE;
|
||||
} touch;
|
||||
|
||||
struct Pen {
|
||||
bool inProximity = false;
|
||||
bool isDown = false;
|
||||
|
|
@ -116,6 +103,8 @@ struct InputManager {
|
|||
std::array<KeyData, 256> buttons;
|
||||
} pen;
|
||||
|
||||
FingerInput::InputTracker fingerTracker;
|
||||
|
||||
bool isTouchDevice = true;
|
||||
|
||||
enum AndroidInputType : int {
|
||||
|
|
@ -263,11 +252,6 @@ struct InputManager {
|
|||
uint32_t make_generic_key_mod(SDL_Keymod m);
|
||||
void set_key_up(const SDL_KeyboardEvent& e, KeyCode kCode, bool acceptingTextInput);
|
||||
void set_key_down(const SDL_KeyboardEvent& e, KeyCode kCode, bool acceptingTextInput);
|
||||
std::vector<Vector2f> get_multiple_finger_positions();
|
||||
std::vector<Vector2f> get_multiple_finger_motions();
|
||||
void touch_finger_do_mouse_down();
|
||||
void touch_finger_do_mouse_up(const SDL_TouchFingerEvent& f);
|
||||
void touch_finger_do_mouse_motion(const SDL_TouchFingerEvent& f);
|
||||
|
||||
Vector2f backend_cursor_pos_calculation(const Vector2f& cursorPos);
|
||||
Vector2f backend_cursor_delta_calculation(const Vector2f& cursorDelta);
|
||||
|
|
@ -289,9 +273,7 @@ struct InputManager {
|
|||
void backend_pen_touch_up_update(const SDL_PenTouchEvent& e);
|
||||
void backend_pen_motion_update(const SDL_PenMotionEvent& e);
|
||||
void backend_pen_axis_update(const SDL_PenAxisEvent& e);
|
||||
void backend_touch_finger_down_update(const SDL_TouchFingerEvent& e);
|
||||
void backend_touch_finger_up_update(const SDL_TouchFingerEvent& e);
|
||||
void backend_touch_finger_motion_update(const SDL_TouchFingerEvent& e);
|
||||
void backend_touch_finger_update(const SDL_TouchFingerEvent& e);
|
||||
void backend_window_resize_update();
|
||||
void backend_window_scale_update(const SDL_WindowEvent& e);
|
||||
|
||||
|
|
@ -388,34 +370,6 @@ struct InputManager {
|
|||
const char* data;
|
||||
};
|
||||
|
||||
struct MultiFingerTouchCallbackArgs {
|
||||
bool down;
|
||||
std::vector<Vector2f> pos;
|
||||
};
|
||||
|
||||
struct MultiFingerMotionCallbackArgs {
|
||||
std::vector<Vector2f> pos;
|
||||
std::vector<Vector2f> move;
|
||||
};
|
||||
|
||||
struct FingerTouchCallbackArgs {
|
||||
SDL_FingerID fingerID;
|
||||
bool down;
|
||||
Vector2f pos;
|
||||
size_t fingerDownCount;
|
||||
int fingerTapCount;
|
||||
};
|
||||
|
||||
struct FingerMotionCallbackArgs {
|
||||
SDL_FingerID fingerID;
|
||||
Vector2f pos;
|
||||
Vector2f move;
|
||||
size_t fingerDownCount;
|
||||
};
|
||||
|
||||
static MouseButtonCallbackArgs convert_finger_touch_to_mouse_button(const FingerTouchCallbackArgs& touch);
|
||||
static MouseMotionCallbackArgs convert_finger_motion_to_mouse_motion(const FingerMotionCallbackArgs& motion);
|
||||
|
||||
struct WindowResizeCallbackArgs {
|
||||
Vector2i size;
|
||||
SCollision::AABB<float> safeArea;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue