Android: Switch dpad default to use HAT X/Y +/- instead of "dpad", as documented.

Add a simple "autoconfigure" facility for input devices, that lets the user choose
if several are connected.

Can be expanded in the future to provide custom default mapppings for various devices as long as we manage to identify them.

Ideally, key mappings should be unique per device but they aren't yet.
This commit is contained in:
Henrik Rydgard committed 2014-05-19 23:31:11 +02:00
1 parent c4d8b31956
commit 3023f7d06b
7 files changed
+75 -9

No files matched your search

+21
View File
@@ -199,6 +199,9 @@ void ControlMappingScreen::CreateViews() {
LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT));
leftColumn->Add(new Choice(k->T("Clear All")))->OnClick.Handle(this, &ControlMappingScreen::OnClearMapping);
leftColumn->Add(new Choice(k->T("Default All")))->OnClick.Handle(this, &ControlMappingScreen::OnDefaultMapping);
if (KeyMap::GetSeenPads().size()) {
leftColumn->Add(new Choice(k->T("Autoconfigure")))->OnClick.Handle(this, &ControlMappingScreen::OnAutoConfigure);
}
leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f)));
leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
@@ -238,6 +241,24 @@ UI::EventReturn ControlMappingScreen::OnDefaultMapping(UI::EventParams &params)
return UI::EVENT_DONE;
}
UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
std::vector<std::string> items;
for (auto s : KeyMap::GetSeenPads()) {
items.push_back(s);
}
ListPopupScreen *autoConfList = new ListPopupScreen("Autoconfigure for device", items, -1);
screenManager()->push(autoConfList);
return UI::EVENT_DONE;
}
void ControlMappingScreen::dialogFinished(const Screen *dialog, DialogResult result) {
if (result == DR_OK && dialog->tag() == "listpopup") {
ListPopupScreen *popup = (ListPopupScreen *)dialog;
KeyMap::AutoConfForPad(popup->GetChoiceString());
RecreateViews();
}
}
void KeyMappingNewKeyDialog::CreatePopupContents(UI::ViewGroup *parent) {
using namespace UI;