input: Add option to make show screen button a toggle (#1383)

This commit is contained in:
goeiecool9999 2024-10-19 01:56:56 +02:00 committed by GitHub
parent d6575455ee
commit f9a4b2dbb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 64 additions and 31 deletions

View file

@ -5,6 +5,7 @@
#include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/slider.h>
#include <wx/checkbox.h>
#include "gui/helpers/wxControlObject.h"
@ -131,11 +132,23 @@ VPADInputPanel::VPADInputPanel(wxWindow* parent)
}
// Blow Mic
row = 9;
row = 8;
add_button_row(main_sizer, row, column, VPADController::kButtonId_Mic, _("blow mic"));
row++;
add_button_row(main_sizer, row, column, VPADController::kButtonId_Screen, _("show screen"));
row++;
auto toggleScreenText = new wxStaticText(this, wxID_ANY, _("toggle screen"));
main_sizer->Add(toggleScreenText,
wxGBPosition(row, column),
wxDefaultSpan,
wxALL | wxALIGN_CENTER_VERTICAL, 5);
m_togglePadViewCheckBox = new wxCheckBox(this, wxID_ANY, {}, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
wxString toggleScreenTT = _("Makes the \"show screen\" button toggle between the TV and gamepad screens");
m_togglePadViewCheckBox->SetToolTip(toggleScreenTT);
toggleScreenText->SetToolTip(toggleScreenTT);
main_sizer->Add(m_togglePadViewCheckBox, wxGBPosition(row,column+1), wxDefaultSpan, wxALL | wxEXPAND, 5);
//////////////////////////////////////////////////////////////////
@ -168,6 +181,8 @@ void VPADInputPanel::on_timer(const EmulatedControllerPtr& emulated_controller,
{
InputPanel::on_timer(emulated_controller, controller_base);
static_cast<VPADController*>(emulated_controller.get())->set_screen_toggle(m_togglePadViewCheckBox->GetValue());
if(emulated_controller)
{
const auto axis = emulated_controller->get_axis();
@ -182,3 +197,10 @@ void VPADInputPanel::OnVolumeChange(wxCommandEvent& event)
{
}
void VPADInputPanel::load_controller(const EmulatedControllerPtr& controller)
{
InputPanel::load_controller(controller);
const bool isToggle = static_cast<VPADController*>(controller.get())->is_screen_active_toggle();
m_togglePadViewCheckBox->SetValue(isToggle);
}