mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
nJoy: GUI update
- 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
This commit is contained in:
@@ -64,6 +64,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="rpcrt4.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName)d.dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32"
|
||||
@@ -221,6 +222,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="rpcrt4.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32"
|
||||
@@ -380,6 +382,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="rpcrt4.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName)df.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32"
|
||||
@@ -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"
|
||||
|
||||
@@ -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*/)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,237 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Project description
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
// Name: nJoy
|
||||
// Description: A Dolphin Compatible Input Plugin
|
||||
//
|
||||
// Author: Falcon4ever (nJoy@falcon4ever.com)
|
||||
// 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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@ Import('env')
|
||||
output = "../../../../Binary/linux/Plugins/Plugin_nJoy_SDL.so"
|
||||
files = [ "nJoy.cpp",
|
||||
"GUI/AboutBox.cpp",
|
||||
"GUI/ConfigBox.cpp",
|
||||
]
|
||||
padenv=env.Copy(CXXFLAGS = " `wx-config --cppflags` `pkg-config --cflags sdl`", LINKFLAGS = "`wx-config --libs` `pkg-config --libs sdl` ")
|
||||
padenv.SharedLibrary(output, files, LIBS=["common"])
|
||||
@@ -30,10 +30,13 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// whole file... until we fix the GUI
|
||||
#ifdef _WIN32
|
||||
|
||||
|
||||
#include "nJoy.h"
|
||||
|
||||
#ifndef USE_WXWIDGETS
|
||||
#ifdef _WIN32
|
||||
|
||||
extern CONTROLLER_INFO *joyinfo;
|
||||
extern CONTROLLER_MAPPING joysticks[4];
|
||||
extern bool emulator_running;
|
||||
@@ -617,3 +620,4 @@ BOOL CALLBACK AboutDlg(HWND abouthWnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -30,6 +30,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// whole file... until we fix the GUI
|
||||
#ifndef USE_WXWIDGETS
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h> // includes basic windows functionality
|
||||
@@ -39,8 +40,6 @@
|
||||
|
||||
#include "../Res/resource.h" // includes GUI IDs
|
||||
|
||||
#pragma comment(lib, "comctl32.lib")
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Config dialog functions
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
@@ -72,3 +71,4 @@ void OpenAbout(HINSTANCE hInst, HWND _hParent);
|
||||
BOOL CALLBACK AboutDlg(HWND abouthWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -66,7 +66,7 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
InitCommonControls();
|
||||
|
||||
|
||||
#ifdef USE_WXWIDGETS
|
||||
switch (dwReason)
|
||||
@@ -91,6 +91,8 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
InitCommonControls();
|
||||
#endif
|
||||
|
||||
nJoy_hInst = hinstDLL;
|
||||
@@ -147,20 +149,55 @@ void DllAbout(HWND _hParent)
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
||||
{
|
||||
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
LoadConfig(); // load settings
|
||||
if(OpenConfig(nJoy_hInst, _hParent))
|
||||
{
|
||||
SaveConfig();
|
||||
}
|
||||
LoadConfig(); // reload settings
|
||||
#endif
|
||||
#ifdef USE_WXWIDGETS
|
||||
#ifdef _WIN32
|
||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
||||
{
|
||||
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
LoadConfig(); // load settings
|
||||
|
||||
wxWindow win;
|
||||
win.SetHWND((WXHWND)_hParent);
|
||||
win.Enable(false);
|
||||
|
||||
ConfigBox frame(&win);
|
||||
frame.ShowModal();
|
||||
|
||||
win.Enable(true);
|
||||
win.SetHWND(0);
|
||||
|
||||
#else
|
||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
||||
{
|
||||
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
LoadConfig(); // load settings
|
||||
|
||||
ConfigBox frame(NULL);
|
||||
frame.ShowModal();
|
||||
#endif
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
|
||||
{
|
||||
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
LoadConfig(); // load settings
|
||||
if(OpenConfig(nJoy_hInst, _hParent))
|
||||
{
|
||||
SaveConfig();
|
||||
}
|
||||
LoadConfig(); // reload settings
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// Init PAD (start emulation)
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
// Set this if you want to use the new wxWidgets GUI
|
||||
#define USE_WXWIDGETS
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
@@ -40,23 +39,32 @@
|
||||
#include <tchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_WXWIDGETS
|
||||
#include "GUI/AboutBox.h"
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <SDL.h> // includes SDL
|
||||
|
||||
#include "Common.h"
|
||||
#ifdef _WIN32
|
||||
#define SLEEP(x) Sleep(x)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define SLEEP(x) usleep(x*1000)
|
||||
#endif
|
||||
|
||||
#include "pluginspecs_pad.h"
|
||||
#ifdef USE_WXWIDGETS
|
||||
#include "GUI/AboutBox.h"
|
||||
#include "GUI/ConfigBox.h"
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "Common.h"
|
||||
#include "pluginspecs_pad.h"
|
||||
#include "IniFile.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma comment(lib, "SDL.lib")
|
||||
#pragma comment(lib, "comctl32.lib")
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user