Skip to content

Commit

Permalink
nJoy: GUI update
Browse files Browse the repository at this point in the history
- Config GUI now uses wxWidgets (should work in linux!)
- The alignment of text may look crappy in linux, so we still need to fix that.
- Opening the config GUI takes time, crappy XPM image of the controller loads slow (cant we use BMP files???) (line 240)
- Stupid GUI bug present when switching between a default joystick and one with no hat. (line 381)
- For some reason setting the value of a wxTextCtrl doesnt gets updated immediately (line 559)
- If you're using windows and dont want to use wxWidgets for the GUI, you can still use the old one by removing #define USE_WXWIDGETS from nJoy.h line 33.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@95 8ced0084-cf51-0410-be5f-012b33b47a6e
  • Loading branch information
falcon4ever committed Jul 29, 2008
1 parent 7894e6c commit 53ba40f
Show file tree
Hide file tree
Showing 10 changed files with 1,640 additions and 33 deletions.
11 changes: 11 additions & 0 deletions Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="rpcrt4.lib"
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName)d.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32"
Expand Down Expand Up @@ -221,6 +222,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="rpcrt4.lib"
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32"
Expand Down Expand Up @@ -380,6 +382,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="rpcrt4.lib"
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName)df.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32"
Expand Down Expand Up @@ -560,6 +563,14 @@
RelativePath=".\Src\GUI\AboutBox.h"
>
</File>
<File
RelativePath=".\Src\GUI\ConfigBox.cpp"
>
</File>
<File
RelativePath=".\Src\GUI\ConfigBox.h"
>
</File>
</Filter>
<File
RelativePath=".\readme.txt"
Expand Down
9 changes: 0 additions & 9 deletions Source/Plugins/Plugin_nJoy_SDL/Src/GUI/AboutBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,16 @@ void AboutBox::CreateGUIControls()

m_thankyoutext = new wxStaticText(this, ID_THANKYOU, wxT(THANKYOU), wxPoint(18,196), wxDefaultSize, 0, wxT(THANKYOU));
m_thankyoutext->Wrap(167);

m_specialthanks = new wxStaticText(this, ID_SPECIALTHANKS, wxT("F|RES and ector."), wxPoint(18,153), wxDefaultSize, 0, wxT("F|RES and ector."));

m_pluginversion = new wxStaticText(this, ID_PLUGINVERSION, wxT("nJoy v"INPUT_VERSION" by Falcon4ever\n" "Release: "RELDAY"/"RELMONTH"/"RELYEAR"\n" "www.multigesture.net"), wxPoint(18,80), wxDefaultSize, 0, wxT("nJoy v"INPUT_VERSION" by Falcon4ever\n" "Release: "RELDAY"/"RELMONTH"/"RELYEAR"\n" "www.multigesture.net"));

m_OK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(116,343), wxSize(75,25), 0, wxDefaultValidator, wxT("OK"));

m_version = new wxStaticText(this, ID_STATUSV, wxT("PUBLIC RELEASE"), wxPoint(14,349), wxDefaultSize, 0, wxT("PUBLIC RELEASE"));

m_thankyougroup = new wxStaticBox(this, IDG_THANKYOU, wxT("Greetings to:"), wxPoint(10,180), wxSize(180,160));

m_specialthanksgroup = new wxStaticBox(this, IDG_SPECIALTHANKS, wxT("Special thanks to:"), wxPoint(10,135), wxSize(180,39));


m_pluginversiongroup = new wxStaticBox(this, IDG_PLUGINVERSION, wxT("Plugin info:"), wxPoint(10,61), wxSize(180,68));

wxBitmap WxStaticBitmap1_BITMAP(AboutBox_WxStaticBitmap1_XPM);
m_njoylogo = new wxStaticBitmap(this, ID_AWESOMEPICTURE, WxStaticBitmap1_BITMAP, wxPoint(-1,-2), wxSize(200,60));
m_njoylogo->Enable(false);
}

void AboutBox::OnClose(wxCloseEvent& /*event*/)
Expand Down
752 changes: 752 additions & 0 deletions Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp

Large diffs are not rendered by default.

237 changes: 237 additions & 0 deletions Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever ([email protected])
// Site: www.multigesture.net
// Copyright (C) 2003-2008 Dolphin Project.
//
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////

#ifndef __CONFIGBOX_h__
#define __CONFIGBOX_h__

#ifndef WX_PRECOMP
#include <wx/wx.h>
#include <wx/dialog.h>
#else
#include <wx/wxprec.h>
#endif

#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/statbmp.h>

#undef ConfigBox_STYLE
#define ConfigBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX

class ConfigBox : public wxDialog
{
private:
DECLARE_EVENT_TABLE();

public:
ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigBox_STYLE);
virtual ~ConfigBox();

private:
wxButton *m_OK;
wxButton *m_Cancel;

wxPanel *m_Controller[4];
wxNotebook *m_Notebook;

wxComboBox *m_Joyname[4];
wxComboBox *m_Controltype[4];
wxComboBox *m_Deadzone[4];

wxCheckBox *m_Joyattach[4];

wxStaticBox *m_gJoyname[4];
wxStaticBox *m_gExtrasettings[4];
wxStaticBox *m_gControllertype[4];

wxTextCtrl *m_JoyShoulderL[4];
wxTextCtrl *m_JoyShoulderR[4];

wxButton *m_bJoyShoulderL[4];
wxButton *m_bJoyShoulderR[4];

wxTextCtrl *m_JoyButtonA[4];
wxTextCtrl *m_JoyButtonB[4];
wxTextCtrl *m_JoyButtonX[4];
wxTextCtrl *m_JoyButtonY[4];
wxTextCtrl *m_JoyButtonZ[4];
wxTextCtrl *m_JoyButtonStart[4];
wxTextCtrl *m_JoyButtonHalfpress[4];

wxButton *m_bJoyButtonA[4];
wxButton *m_bJoyButtonB[4];
wxButton *m_bJoyButtonX[4];
wxButton *m_bJoyButtonY[4];
wxButton *m_bJoyButtonZ[4];
wxButton *m_bJoyButtonStart[4];
wxButton *m_bJoyButtonHalfpress[4];

wxTextCtrl *m_JoyAnalogMainX[4];
wxTextCtrl *m_JoyAnalogMainY[4];
wxTextCtrl *m_JoyAnalogSubX[4];
wxTextCtrl *m_JoyAnalogSubY[4];

wxButton *m_bJoyAnalogMainX[4];
wxButton *m_bJoyAnalogMainY[4];
wxButton *m_bJoyAnalogSubX[4];
wxButton *m_bJoyAnalogSubY[4];

wxTextCtrl *m_JoyDpadUp[4];
wxTextCtrl *m_JoyDpadDown[4];
wxTextCtrl *m_JoyDpadLeft[4];
wxTextCtrl *m_JoyDpadRight[4];

wxButton *m_bJoyDpadUp[4];
wxButton *m_bJoyDpadDown[4];
wxButton *m_bJoyDpadLeft[4];
wxButton *m_bJoyDpadRight[4];

wxStaticText *m_textMainX;
wxStaticText *m_textMainY;
wxStaticText *m_textDpadUp;
wxStaticText *m_textDpadDown;
wxStaticText *m_textDpadLeft;
wxStaticText *m_textDpadRight;
wxStaticText *m_textDeadzone;
wxStaticText *m_textHalfpress;
wxStaticText *m_textSubX;
wxStaticText *m_textSubY;
wxStaticText *m_textWebsite;

wxTextCtrl *m_PlaceholderBMP[4];
wxStaticBitmap *m_controllerimage[4];

int notebookpage;
private:
enum
{
ID_OK = 1000,
ID_CANCEL,
ID_NOTEBOOK,
ID_CONTROLLERPAGE1,
ID_CONTROLLERPAGE2,
ID_CONTROLLERPAGE3,
ID_CONTROLLERPAGE4,

IDC_JOYNAME,
IDC_CONTROLTYPE,
IDC_DEADZONE,

IDC_JOYATTACH,
IDG_JOYSTICK,
IDG_EXTRASETTINGS,
IDG_CONTROLLERTYPE,
ID_CONTROLLERPICTURE,

ID_SHOULDER_L = 2000,
ID_SHOULDER_R,

ID_BUTTON_A,
ID_BUTTON_B,
ID_BUTTON_X,
ID_BUTTON_Y,
ID_BUTTON_Z,
ID_BUTTONSTART,
ID_BUTTONHALFPRESS,

ID_ANALOG_MAIN_X,
ID_ANALOG_MAIN_Y,
ID_ANALOG_SUB_X,
ID_ANALOG_SUB_Y,

ID_DPAD_UP,
ID_DPAD_DOWN,
ID_DPAD_LEFT,
ID_DPAD_RIGHT,

IDB_SHOULDER_L = 3000,
IDB_SHOULDER_R,

IDB_BUTTON_A,
IDB_BUTTON_B,
IDB_BUTTON_X,
IDB_BUTTON_Y,
IDB_BUTTON_Z,
IDB_BUTTONSTART,
IDB_BUTTONHALFPRESS,

IDB_ANALOG_MAIN_X,
IDB_ANALOG_MAIN_Y,
IDB_ANALOG_SUB_X,
IDB_ANALOG_SUB_Y,

IDB_DPAD_UP,
IDB_DPAD_DOWN,
IDB_DPAD_LEFT,
IDB_DPAD_RIGHT,

IDT_ANALOG_MAIN_X = 4000,
IDT_ANALOG_MAIN_Y,
IDT_DPAD_UP,
IDT_DPAD_DOWN,
IDT_DPAD_LEFT,
IDT_DPAD_RIGHT,
IDT_DEADZONE,
IDT_BUTTONHALFPRESS,
IDT_ANALOG_SUB_X,
IDT_ANALOG_SUB_Y,
IDT_WEBSITE,

ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};

private:
void OKClick(wxCommandEvent& event);
void CancelClick(wxCommandEvent& event);

void ChangeJoystick(wxCommandEvent& event);
void ChangeControllertype(wxCommandEvent& event);

void OnClose(wxCloseEvent& event);
void CreateGUIControls();

void SetControllerAll(int controller);
void UpdateVisibleItems(int controller);
void GetControllerAll(int controller);

void NotebookPageChanged(wxNotebookEvent& event);

void GetButtons(wxCommandEvent& event);
void GetHats(int ID);
void GetAxis(wxCommandEvent& event);

void SetButtonText(int id, char text[128]);
};

#endif
Loading

0 comments on commit 53ba40f

Please sign in to comment.