CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/ios/Controls.h
Views: 1401
1
#pragma once
2
3
#include <map>
4
#include <string_view>
5
6
#import <GameController/GameController.h>
7
#import <CoreMotion/CoreMotion.h>
8
9
#include "iCade/iCadeState.h"
10
#include "Common/Input/InputState.h"
11
12
// Code extracted from ViewController.mm, in order to modularize
13
// and share it between multiple view controllers.
14
15
bool InitController(GCController *controller);
16
void ShutdownController(GCController *controller);
17
18
struct TouchTracker {
19
public:
20
void Began(NSSet *touches, UIView *view);
21
void Moved(NSSet *touches, UIView *view);
22
void Ended(NSSet *touches, UIView *view);
23
void Cancelled(NSSet *touches, UIView *view);
24
private:
25
void SendTouchEvent(float x, float y, int code, int pointerId);
26
int ToTouchID(UITouch *uiTouch, bool allowAllocate);
27
UITouch *touches_[10]{};
28
};
29
30
// Can probably get rid of this, but let's keep it for now.
31
struct ICadeTracker {
32
public:
33
void ButtonDown(iCadeState button);
34
void ButtonUp(iCadeState button);
35
void InitKeyMap();
36
private:
37
bool simulateAnalog = false;
38
bool iCadeConnectNotified = false;
39
40
std::map<uint16_t, InputKeyCode> iCadeToKeyMap;
41
42
double lastSelectPress = 0.0f;
43
double lastStartPress = 0.0f;
44
};
45
46
void ProcessAccelerometerData(CMAccelerometerData *accData);
47
InputKeyCode HIDUsageToInputKeyCode(UIKeyboardHIDUsage usage);
48
49
void KeyboardPressesBegan(NSSet<UIPress *> *presses, UIPressesEvent *event);
50
void KeyboardPressesEnded(NSSet<UIPress *> *presses, UIPressesEvent *event);
51
void SendKeyboardChars(std::string_view str);
52