4#ifndef SMK_INPUTIMPL_H_
5#define SMK_INPUTIMPL_H_
7#include <smk/Input.hpp>
8#include <unordered_set>
12 #include <emscripten.h>
19 void Update(GLFWwindow* window);
21 void OnTouchEvent(
int eventType,
const EmscriptenTouchEvent* keyEvent);
23 void OnScrollEvent(glm::vec2 offset);
24 void OnCharacterTyped(
wchar_t character);
26 class CharacterListenerImpl;
27 void BindCharacterListener(CharacterListenerImpl*);
28 void UnBindCharacterListener(CharacterListenerImpl*);
36 glm::vec2
mouse()
const override;
37 std::map<FingerID, Touch>&
touches()
override;
42 glm::vec2
cursor()
const override;
44 CharacterListener MakeCharacterListener()
override;
48 std::map<int, std::pair<int, int>> key_state_;
51 std::map<int, std::pair<int, int>> mouse_state_;
52 glm::vec2 mouse_ = {0.f, 0.f};
55 std::map<FingerID, Touch> touches_;
58 glm::vec2 cursor_ = {0, 0};
59 bool cursor_press_ =
false;
60 bool cursor_press_previous_ =
false;
61 bool touching_ =
true;
64 glm::vec2 scroll_ = {0.f, 0.f};
65 glm::vec2 scroll_old_ = {0.f, 0.f};
68 std::unordered_set<CharacterListenerImpl*> character_listeners_;