GCPad/Wiimote New: Added a set defaults button to the config dialog. (gave new wiimote plugin a few default buttons, not done) Moved MSWindows cursor position code to ControllerInterface/DInput (plan on moving Linux's cursor code to Xlib as well). IR Up,Down,L,R now must have Cursor X/Y/-+ mapped for regular mouse control on Windows. (hopefully this isn't too confusing, the reset to default button automatically sets this up). Renamed One,Two,Minus,Plus to 12-+ (you will have to reconfigure these buttons, sorry). Added text labels for the button and trigger preview bitmaps. -other minor stuff.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5865 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-07-10 06:48:24 +00:00
parent 2bcdf4f5a4
commit a0aa506453
26 changed files with 359 additions and 222 deletions

View File

@ -284,6 +284,17 @@ void GamepadPage::ClearAll( wxCommandEvent& event )
UpdateGUI();
}
void GamepadPage::LoadDefaults( wxCommandEvent& event )
{
controller->LoadDefaults(m_plugin.controller_interface);
m_plugin.controls_crit.Enter(); // enter
controller->UpdateReferences(m_plugin.controller_interface);
m_plugin.controls_crit.Leave(); // leave
UpdateGUI();
}
void ControlDialog::SetControl( wxCommandEvent& event )
{
control_reference->expression = STR_FROM_WXSTR(textctrl->GetValue());
@ -877,7 +888,7 @@ GamepadPage::GamepadPage( wxWindow* parent, InputPlugin& plugin, const unsigned
wxStaticBoxSizer* const device_sbox = new wxStaticBoxSizer( wxHORIZONTAL, this, wxT("Device") );
device_cbox = new wxComboBox( this, -1, wxT(""), wxDefaultPosition, wxSize(128,-1), 0, 0, wxTE_PROCESS_ENTER );
device_cbox = new wxComboBox( this, -1, wxT(""), wxDefaultPosition, wxSize(64,-1), 0, 0, wxTE_PROCESS_ENTER );
wxButton* refresh_button = new wxButton( this, -1, wxT("Refresh"), wxDefaultPosition, wxSize(60,-1) );
@ -888,13 +899,17 @@ GamepadPage::GamepadPage( wxWindow* parent, InputPlugin& plugin, const unsigned
device_sbox->Add( device_cbox, 1, wxLEFT|wxRIGHT, 3 );
device_sbox->Add( refresh_button, 0, wxRIGHT|wxBOTTOM, 3 );
wxStaticBoxSizer* const clear_sbox = new wxStaticBoxSizer( wxHORIZONTAL, this, wxT("Clear") );
wxButton* all_button = new wxButton( this, -1, wxT("All"), wxDefaultPosition, wxSize(48,-1) );
clear_sbox->Add( all_button, 1, wxLEFT|wxRIGHT, 3 );
wxButton* const default_button = new wxButton( this, -1, wxT("Default"), wxDefaultPosition, wxSize(48,-1) );
wxButton* const clearall_button = new wxButton( this, -1, wxT("Clear"), wxDefaultPosition, wxSize(48,-1) );
_connect_macro_(all_button, GamepadPage::ClearAll, wxEVT_COMMAND_BUTTON_CLICKED, this);
wxStaticBoxSizer* const clear_sbox = new wxStaticBoxSizer( wxHORIZONTAL, this, wxT("Reset") );
clear_sbox->Add(default_button, 1, wxLEFT, 3);
clear_sbox->Add(clearall_button, 1, wxRIGHT, 3);
profile_cbox = new wxComboBox( this, -1, wxT(""), wxDefaultPosition, wxSize(128,-1) );
_connect_macro_(clearall_button, GamepadPage::ClearAll, wxEVT_COMMAND_BUTTON_CLICKED, this);
_connect_macro_(default_button, GamepadPage::LoadDefaults, wxEVT_COMMAND_BUTTON_CLICKED, this);
profile_cbox = new wxComboBox( this, -1, wxT(""), wxDefaultPosition, wxSize(64,-1) );
wxButton* const pload_btn = new wxButton( this, -1, wxT("Load"), wxDefaultPosition, wxSize(48,-1) );
wxButton* const psave_btn = new wxButton( this, -1, wxT("Save"), wxDefaultPosition, wxSize(48,-1) );

View File

@ -206,6 +206,7 @@ public:
void SetDevice( wxCommandEvent& event );
void ClearAll( wxCommandEvent& event );
void LoadDefaults( wxCommandEvent& event );
void AdjustControlOption( wxCommandEvent& event );
void AdjustSetting( wxCommandEvent& event );

View File

@ -21,8 +21,11 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
{
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage( m_pad_notebook->GetSelection() );
std::vector< ControlGroupBox* >::iterator g = current_page->control_groups.begin(),
ge = current_page->control_groups.end();
wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
std::vector< ControlGroupBox* >::iterator
g = current_page->control_groups.begin(),
ge = current_page->control_groups.end();
for ( ; g != ge; ++g )
{
// if this control group has a bitmap
@ -42,14 +45,12 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
dc.SelectObject(bitmap);
dc.Clear();
dc.SetFont(small_font);
dc.SetTextForeground(0xC0C0C0);
// label for sticks and stuff
if (64 == bitmap.GetHeight())
{
wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
dc.SetFont(small_font);
dc.SetTextForeground(0xC0C0C0);
dc.DrawText(wxString::FromAscii((*g)->control_group->name).Upper(), 4, 2);
}
switch ( (*g)->control_group->type )
{
@ -208,22 +209,27 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
dc.SetPen(*wxGREY_PEN);
unsigned int * const bitmasks = new unsigned int[ button_count ];
for ( unsigned int n = 0; n<button_count; ++n )
bitmasks[n] = ( 1 << n );
for (unsigned int n = 0; n<button_count; ++n)
bitmasks[n] = (1 << n);
unsigned int buttons = 0;
((ControllerEmu::Buttons*)(*g)->control_group)->GetState( &buttons, bitmasks );
for ( unsigned int n = 0; n<button_count; ++n )
for (unsigned int n = 0; n<button_count; ++n)
{
if ( buttons & bitmasks[n] )
dc.SetBrush( *wxRED_BRUSH );
else
{
unsigned char amt = 255 - (*g)->control_group->controls[n]->control_ref->State() * 128;
dc.SetBrush( wxBrush( wxColor( amt, amt, amt ) ) );
dc.SetBrush(wxBrush(wxColor(amt, amt, amt)));
}
dc.DrawRectangle(n*12, 0, 14, 12);
dc.DrawRectangle(n * 12, 0, 14, 12);
// text
const char* const name = (*g)->control_group->controls[n]->name;
// bit of hax so ZL, ZR show up as L, R
dc.DrawText(wxString::FromAscii((name[1] && name[1] < 'a') ? name[1] : name[0]), n*12 + 2, 1);
}
delete[] bitmasks;
@ -257,6 +263,9 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
// deadzone affected
dc.SetBrush(*wxRED_BRUSH);
dc.DrawRectangle(0, n*12, trigs[n], 14);
// text
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n]->name), 3, n*12 + 1);
}
delete[] trigs;
@ -289,6 +298,10 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(trig_a*64, n*12, 64+20, 14);
dc.DrawRectangle(64, n*12, 32, 14);
// text
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n+trigger_count]->name), 3, n*12 + 1);
dc.DrawText(wxString::FromAscii((*g)->control_group->controls[n]->name[0]), 64 + 3, n*12 + 1);
}
// threshold box