mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-24 06:43:45 +01:00
Merge pull request #110 from thedax/master
Native: Remove hard-coded accept and escape keys.
This commit is contained in:
commit
d2bdffcc54
3 files changed
+28
-3
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#include "input/input_state.h"
|
||||
#include "input/keycodes.h"
|
||||
#include <vector>
|
||||
|
||||
const char *GetDeviceName(int deviceId) {
|
||||
switch (deviceId) {
|
||||
@@ -41,6 +42,22 @@ int MapPadButtonFixed(int keycode) {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<keycode_t> confirmKeys;
|
||||
std::vector<keycode_t> cancelKeys;
|
||||
|
||||
void SetConfirmCancelKeys(std::vector<keycode_t> confirm, std::vector<keycode_t> cancel) {
|
||||
confirmKeys = confirm;
|
||||
cancelKeys = cancel;
|
||||
}
|
||||
|
||||
void AddConfirmKey(keycode_t confirmKey) {
|
||||
confirmKeys.push_back(confirmKey);
|
||||
}
|
||||
|
||||
void AddCancelKey(keycode_t cancelKey) {
|
||||
cancelKeys.push_back(cancelKey);
|
||||
}
|
||||
|
||||
uint32_t ButtonTracker::Update() {
|
||||
pad_buttons_ |= pad_buttons_async_set;
|
||||
pad_buttons_ &= ~pad_buttons_async_clear;
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
#include "math/lin/vec3.h"
|
||||
#include "base/mutex.h"
|
||||
#include "base/basictypes.h"
|
||||
#include "input/keycodes.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
// Default device IDs
|
||||
|
||||
@@ -112,6 +114,13 @@ private:
|
||||
void UpdateInputState(InputState *input, bool merge = false);
|
||||
void EndInputState(InputState *input);
|
||||
|
||||
// Is there a nicer place for this stuff? It's here to avoid dozens of linking errors in UnitTest..
|
||||
extern std::vector<keycode_t> confirmKeys;
|
||||
extern std::vector<keycode_t> cancelKeys;
|
||||
void SetConfirmCancelKeys(std::vector<keycode_t> confirm, std::vector<keycode_t> cancel);
|
||||
void AddConfirmKey(keycode_t confirmKey);
|
||||
void AddCancelKey(keycode_t confirmKey);
|
||||
|
||||
enum {
|
||||
TOUCH_MOVE = 1,
|
||||
TOUCH_DOWN = 2,
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ struct DispatchQueueItem {
|
||||
|
||||
std::queue<DispatchQueueItem> g_dispatchQueue;
|
||||
|
||||
|
||||
void EventTriggered(Event *e, EventParams params) {
|
||||
lock_guard guard(mutex_);
|
||||
|
||||
@@ -187,11 +186,11 @@ void Clickable::Touch(const TouchInput &input) {
|
||||
// TODO: O/X confirm preference for xperia play?
|
||||
|
||||
bool IsAcceptKeyCode(int keyCode) {
|
||||
return keyCode == NKCODE_SPACE || keyCode == NKCODE_ENTER || keyCode == NKCODE_Z || keyCode == NKCODE_BUTTON_A || keyCode == NKCODE_BUTTON_CROSS || keyCode == NKCODE_BUTTON_1;
|
||||
return std::find(confirmKeys.begin(), confirmKeys.end(), (keycode_t)keyCode) != confirmKeys.end();
|
||||
}
|
||||
|
||||
bool IsEscapeKeyCode(int keyCode) {
|
||||
return keyCode == NKCODE_ESCAPE || keyCode == NKCODE_BACK || keyCode == NKCODE_BUTTON_CIRCLE || keyCode == NKCODE_BUTTON_B || keyCode == NKCODE_BUTTON_2;
|
||||
return std::find(cancelKeys.begin(), cancelKeys.end(), (keycode_t)keyCode) != cancelKeys.end();
|
||||
}
|
||||
|
||||
void Clickable::Key(const KeyInput &key) {
|
||||
|
||||
Reference in new issue
Block a user