From a0aa506453195d99d8b7e1c0297bb1e285428d0c Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sat, 10 Jul 2010 06:48:24 +0000 Subject: 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 --- Source/Core/InputCommon/Src/ControllerEmu.cpp | 38 ++++++++++++--------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'Source/Core/InputCommon/Src/ControllerEmu.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerEmu.cpp b/Source/Core/InputCommon/Src/ControllerEmu.cpp index e1b25d28dc..78b597f3a5 100644 --- a/Source/Core/InputCommon/Src/ControllerEmu.cpp +++ b/Source/Core/InputCommon/Src/ControllerEmu.cpp @@ -307,27 +307,25 @@ ControllerEmu::Cursor::Cursor( const char* const _name, const SWiimoteInitialize } +void ControllerEmu::LoadDefaults(const ControllerInterface &ciface) +{ + // load an empty inifile section, clears everything + IniFile::Section sec; + LoadConfig(&sec); + + if (ciface.Devices().size()) + { + default_device.FromDevice(ciface.Devices()[0]); + UpdateDefaultDevice(); + } +} + +// TODO: remove this hackery void GetMousePos(float& x, float& y, const SWiimoteInitialize* const wiimote_initialize) { -#if ( defined(_WIN32) || (defined(HAVE_X11) && HAVE_X11)) - unsigned int win_width = 2, win_height = 2; -#endif +#if defined(HAVE_X11) && HAVE_X11 -#ifdef _WIN32 - // Get the cursor position for the entire screen - POINT point = { 1, 1 }; - GetCursorPos(&point); - // Get the cursor position relative to the upper left corner of the rendering window - ScreenToClient(wiimote_initialize->hWnd, &point); - - // Get the size of the rendering window. (In my case Rect.top and Rect.left was zero.) - RECT Rect; - GetClientRect(wiimote_initialize->hWnd, &Rect); - // Width and height is the size of the rendering window - win_width = Rect.right - Rect.left; - win_height = Rect.bottom - Rect.top; - -#elif defined(HAVE_X11) && HAVE_X11 + unsigned int win_width = 2, win_height = 2; int root_x, root_y; struct { @@ -344,15 +342,13 @@ void GetMousePos(float& x, float& y, const SWiimoteInitialize* const wiimote_ini Window root_dummy, child_win; unsigned int mask; XQueryPointer(wm_display, glwin, &root_dummy, &child_win, &root_x, &root_y, &point.x, &point.y, &mask); -#endif -#if ( defined(_WIN32) || (defined(HAVE_X11) && HAVE_X11)) // Return the mouse position as a range from -1 to 1 x = (float)point.x / (float)win_width * 2 - 1; y = (float)point.y / (float)win_height * 2 - 1; #else + x = 0; y = 0; #endif - } -- cgit v1.2.3