Show the last key event on the analogs testing screen
(which I guess is now a generic testing screen) May help investigating #7254
This commit is contained in:
parent
5e97a287c0
commit
d545908b6c
2 changed files with 25 additions and 6 deletions
|
@ -421,10 +421,23 @@ void JoystickHistoryView::Update(const InputState &input_state) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalogTestScreen::CreateViews() {
|
bool AnalogTestScreen::key(const KeyInput &key) {
|
||||||
root_ = new UI::LinearLayout(UI::ORIENT_VERTICAL);
|
char buf[512];
|
||||||
|
snprintf(buf, sizeof(buf), "Keycode: %d Device ID: %d [%s%s%s%s]", key.keyCode, key.deviceId,
|
||||||
|
(key.flags & KEY_IS_REPEAT) ? "REP" : "",
|
||||||
|
(key.flags & KEY_UP) ? "UP" : "",
|
||||||
|
(key.flags & KEY_DOWN) ? "DOWN" : "",
|
||||||
|
(key.flags & KEY_CHAR) ? "CHAR" : "");
|
||||||
|
lastKeyEvent_->SetText(buf);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
UI::LinearLayout *theTwo = new UI::LinearLayout(UI::ORIENT_HORIZONTAL, new UI::LinearLayoutParams(1.0f));
|
void AnalogTestScreen::CreateViews() {
|
||||||
|
using namespace UI;
|
||||||
|
|
||||||
|
root_ = new LinearLayout(ORIENT_VERTICAL);
|
||||||
|
|
||||||
|
LinearLayout *theTwo = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(1.0f));
|
||||||
|
|
||||||
int axis1, device1, dir1;
|
int axis1, device1, dir1;
|
||||||
int axis2, device2, dir2;
|
int axis2, device2, dir2;
|
||||||
|
@ -432,14 +445,16 @@ void AnalogTestScreen::CreateViews() {
|
||||||
if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_X_MAX, &device1, &axis1, &dir1)) axis1 = -1;
|
if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_X_MAX, &device1, &axis1, &dir1)) axis1 = -1;
|
||||||
if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_Y_MAX, &device2, &axis2, &dir2)) axis2 = -1;
|
if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_Y_MAX, &device2, &axis2, &dir2)) axis2 = -1;
|
||||||
|
|
||||||
theTwo->Add(new JoystickHistoryView(axis1, device1, axis2, device2, new UI::LinearLayoutParams(1.0f)));
|
theTwo->Add(new JoystickHistoryView(axis1, device1, axis2, device2, new LinearLayoutParams(1.0f)));
|
||||||
|
|
||||||
if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_RIGHT_X_MAX, &device1, &axis1, &dir1)) axis1 = -1;
|
if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_RIGHT_X_MAX, &device1, &axis1, &dir1)) axis1 = -1;
|
||||||
if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_RIGHT_Y_MAX, &device2, &axis2, &dir2)) axis2 = -1;
|
if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_RIGHT_Y_MAX, &device2, &axis2, &dir2)) axis2 = -1;
|
||||||
|
|
||||||
theTwo->Add(new JoystickHistoryView(axis1, device1, axis2, device2, new UI::LinearLayoutParams(1.0f)));
|
theTwo->Add(new JoystickHistoryView(axis1, device1, axis2, device2, new LinearLayoutParams(1.0f)));
|
||||||
|
|
||||||
root_->Add(theTwo);
|
root_->Add(theTwo);
|
||||||
|
|
||||||
root_->Add(new UI::Button("Back"))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
lastKeyEvent_ = root_->Add(new TextView("", new LayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||||
|
|
||||||
|
root_->Add(new Button("Back"))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,10 @@ class AnalogTestScreen : public UIDialogScreenWithBackground {
|
||||||
public:
|
public:
|
||||||
AnalogTestScreen() {}
|
AnalogTestScreen() {}
|
||||||
|
|
||||||
|
bool key(const KeyInput &key) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void CreateViews() override;
|
virtual void CreateViews() override;
|
||||||
|
|
||||||
|
UI::TextView *lastKeyEvent_;
|
||||||
};
|
};
|
Loading…
Add table
Add a link
Reference in a new issue