mirror of
https://github.com/niellun/FastCarPlay.git
synced 2026-06-07 09:38:25 +02:00
Added key mappings
This commit is contained in:
@@ -47,7 +47,7 @@ The project is using make. You can edit ./conf/settings.txt after copy if needed
|
||||
make clean
|
||||
make release
|
||||
mkdir ./conf
|
||||
cp ./settings.txt /conf
|
||||
cp ./settings.txt ./conf
|
||||
./out/app ./conf/settings.txt
|
||||
```
|
||||
|
||||
|
||||
@@ -134,6 +134,14 @@
|
||||
#on-connect-script =
|
||||
#on-disconnect-script =
|
||||
|
||||
# Map extra keys for control with there codes
|
||||
# If you set logging true you and press keys you will see there codes in logs
|
||||
#key-left = 0
|
||||
#key-right = 0
|
||||
#key-enter = 0
|
||||
#key-back = 0
|
||||
#key-home = 0
|
||||
|
||||
##############################################################################
|
||||
# 4.Debug
|
||||
##############################################################################
|
||||
|
||||
@@ -35,6 +35,14 @@
|
||||
#define CMD_VERSION 204
|
||||
#define CMD_ENCRYPTION 240
|
||||
|
||||
#define BTN_LEFT 100
|
||||
#define BTN_RIGHT 101
|
||||
#define BTN_SELECT_DOWN 104
|
||||
#define BTN_SELECT_UP 105
|
||||
#define BTN_BACK 106
|
||||
#define BTN_HOME 200
|
||||
|
||||
|
||||
#define AUDIO_BUFFER_SIZE 2560
|
||||
#define AUDIO_BUFFER_OFFSET 12
|
||||
|
||||
|
||||
+40
-12
@@ -51,32 +51,60 @@ void processKey(Protocol &protocol, SDL_Keysym key, RunParams ¶ms)
|
||||
params.fullscreen = !params.fullscreen; // Toggle fullscreen mode
|
||||
SDL_SetWindowFullscreen(window, params.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
||||
SDL_SetWindowBordered(window, params.fullscreen ? SDL_FALSE : SDL_TRUE);
|
||||
break;
|
||||
return;
|
||||
|
||||
case SDLK_q:
|
||||
active = false;
|
||||
break;
|
||||
return;
|
||||
|
||||
case SDLK_r:
|
||||
params.dirty = true;
|
||||
break;
|
||||
return;
|
||||
|
||||
case SDLK_LEFT:
|
||||
protocol.sendKey(100);
|
||||
break;
|
||||
protocol.sendKey(BTN_LEFT);
|
||||
return;
|
||||
|
||||
case SDLK_RIGHT:
|
||||
protocol.sendKey(101);
|
||||
break;
|
||||
protocol.sendKey(BTN_RIGHT);
|
||||
return;
|
||||
|
||||
case SDLK_RETURN:
|
||||
protocol.sendKey(104);
|
||||
protocol.sendKey(105);
|
||||
break;
|
||||
protocol.sendKey(BTN_SELECT_DOWN);
|
||||
protocol.sendKey(BTN_SELECT_UP);
|
||||
return;
|
||||
|
||||
case SDLK_BACKSPACE:
|
||||
protocol.sendKey(106);
|
||||
break;
|
||||
protocol.sendKey(BTN_BACK);
|
||||
return;
|
||||
|
||||
case 0:
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.sym == Settings::keyLeft)
|
||||
{
|
||||
protocol.sendKey(BTN_LEFT);
|
||||
}
|
||||
else if (key.sym == Settings::keyRight)
|
||||
{
|
||||
protocol.sendKey(BTN_RIGHT);
|
||||
}
|
||||
else if (key.sym == Settings::keyEnter)
|
||||
{
|
||||
protocol.sendKey(BTN_SELECT_DOWN);
|
||||
protocol.sendKey(BTN_SELECT_UP);
|
||||
}
|
||||
else if (key.sym == Settings::keyBack)
|
||||
{
|
||||
protocol.sendKey(BTN_BACK);
|
||||
}
|
||||
else if (key.sym == Settings::keyHome)
|
||||
{
|
||||
protocol.sendKey(BTN_HOME);
|
||||
} else
|
||||
{
|
||||
std::cout << "[Key] Unmapped key " << key.sym << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-6
@@ -26,13 +26,11 @@ public:
|
||||
static inline Setting<bool> wifi5{"wifi-5", true};
|
||||
static inline Setting<bool> bluetoothAudio{"bluetooth-audio", false};
|
||||
static inline Setting<int> micType{"mic-type", 1};
|
||||
static inline Setting<int> dpi{"android-dpi", 120};
|
||||
static inline Setting<int> dpi{"android-dpi", 120};
|
||||
static inline Setting<int> androidMode{"android-resolution", 0};
|
||||
static inline Setting<int> mediaDelay{"android-media-delay", 300};
|
||||
static inline Setting<int> mediaDelay{"android-media-delay", 300};
|
||||
|
||||
|
||||
|
||||
// Application configuration section
|
||||
// Application configuration section
|
||||
static inline Setting<int> fontSize{"font-size", 30};
|
||||
static inline Setting<bool> vsync{"vsync", false};
|
||||
static inline Setting<float> aspectCorrection{"aspect-correction", 1};
|
||||
@@ -40,11 +38,16 @@ public:
|
||||
static inline Setting<int> videoQueue{"video-buffer-size", 32};
|
||||
static inline Setting<int> audioQueue{"audio-buffer-size", 16};
|
||||
static inline Setting<int> audioDelay{"audio-buffer-wait", 2};
|
||||
static inline Setting<int> audioDelayCall{"audio-buffer-wait-call", 8};
|
||||
static inline Setting<int> audioDelayCall{"audio-buffer-wait-call", 8};
|
||||
static inline Setting<float> audioFade{"audio-fade", 0.3};
|
||||
static inline Setting<std::string> audioDriver{"audio-driver", ""};
|
||||
static inline Setting<std::string> onConnect{"on-connect-script", ""};
|
||||
static inline Setting<std::string> onDisconnect{"on-disconnect-script", ""};
|
||||
static inline Setting<int> keyLeft{"key-left", 0};
|
||||
static inline Setting<int> keyRight{"key-right", 0};
|
||||
static inline Setting<int> keyEnter{"key-enter", 0};
|
||||
static inline Setting<int> keyBack{"key-back", 0};
|
||||
static inline Setting<int> keyHome{"key-home", 0};
|
||||
|
||||
// Debug section
|
||||
static inline Setting<int> protocolDebug{"protocol-debug", 0};
|
||||
|
||||
Reference in New Issue
Block a user