diff options
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerEmu.cpp')
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerEmu.cpp | 38 |
1 files changed, 17 insertions, 21 deletions
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 - } |
