36 #ifndef __CU_GESTURE_INPUT_H__
37 #define __CU_GESTURE_INPUT_H__
38 #include <cugl/input/CUInput.h>
39 #include <cugl/math/CUVec2.h>
40 #include <cugl/io/CUPathname.h>
41 #include <cugl/util/CUThreadPool.h>
42 #include <condition_variable>
48 #pragma mark GestureEvent
83 key = name; fingers = down; error = delta; timestamp = stamp;
89 #pragma mark GestureListener
117 #pragma mark GestureStateListener
214 #pragma mark GestureInput
279 std::unordered_map<SDL_GestureID, std::string>
_gestures;
281 std::unordered_map<std::string, SDL_GestureID>
_inverses;
338 bool read(
const std::string& file, std::function<
void(
bool success)> callback=
nullptr);
360 bool store(
Pathname& file, std::function<
void(
bool success)> callback=
nullptr);
363 #pragma mark Constructor
382 virtual void dispose()
override;
385 #pragma mark Device State
498 bool record(
const std::string& key);
517 return record(std::string(key));
541 bool remove(
const std::string& key);
554 bool remove(
const char* key) {
555 return remove(std::string(key));
570 bool rename(
const std::string& key,
const std::string& name);
584 bool rename(
const char* key,
const std::string& name) {
585 return rename(std::string(key),name);
600 bool rename(
const std::string& key,
const char* name) {
601 return rename(key,std::string(name));
616 bool rename(
const char* key,
const char* name) {
617 return rename(std::string(key),std::string(name));
620 #pragma mark Serialization
645 bool load(
const std::string& file) {
728 void loadAsync(
const std::string& file, std::function<
void(
bool success)> callback) {
757 void loadAsync(
const char* file, std::function<
void(
bool success)> callback) {
786 void loadAsync(
const Pathname& file, std::function<
void(
bool success)> callback);
867 void loadAssetAsync(
const std::string& file, std::function<
void(
bool success)> callback);
894 void loadAssetAsync(
const char* file, std::function<
void(
bool success)> callback) {
917 bool save(
const std::string& file) {
987 void saveAsync(
const std::string& file, std::function<
void(
bool success)> callback) {
1012 void saveAsync(
const char* file, std::function<
void(
bool success)> callback) {
1040 #pragma mark Data Polling
1058 const std::string
getKey()
const {
return _match ? _event.
key :
""; }
1083 #pragma mark Listeners
1211 #pragma mark Input Device
1243 virtual void queryEvents(std::vector<Uint32>& eventset)
override;
GestureEvent()
Definition: CUGestureInput.h:72
GestureState
Definition: CUGestureInput.h:126
int fingers
Definition: CUGestureInput.h:67
Definition: CUTimestamp.h:61
Definition: CUGestureInput.h:52
GestureEvent(const std::string &name, float delta, int down, const Timestamp &stamp)
Definition: CUGestureInput.h:82
std::string key
Definition: CUGestureInput.h:57
float error
Definition: CUGestureInput.h:65
std::function< void(GestureState ostate, GestureState nstate)> GestureStateListener
Definition: CUGestureInput.h:210
Definition: CUAnimationNode.h:52
Definition: CUPathname.h:85
Timestamp timestamp
Definition: CUGestureInput.h:55
std::function< void(const GestureEvent &event, bool focus)> GestureListener
Definition: CUGestureInput.h:113