Commit graph

461 commits

Author SHA1 Message Date
Stefanos A 06e63946cc [Win] Separate keyboard/mouse & joystick drivers
Keyboard/mouse support comes through WinRawInput; joystick support
through CombinedJoystickDriver. These drivers are now instantiated
separately.
2014-09-11 12:51:45 +02:00
Stefanos A 5cfde8ff0f [Win] Added combined XInput+WinMM joystick driver
Joystick devices will be queried through XInput first, with a fallback
to WinMM in case they are not recognized by the newer API.
2014-09-11 12:51:45 +02:00
Stefanos A 765ad9e05b [Win] WinRawInput is IKeyboard/MouseDriver2
Since we do not use Raw Input for joystick devices, it does not make
sense to expose the IJoystickDriver2 interface through WinRawInput. This
keeps allows joystick and keyboard/mouse implementations to reside in
distinct, modular classes, instantiated separately through WinFactory.
2014-09-11 12:51:45 +02:00
Stefanos A 8968f7ff38 [Win] XInputJoystick is now IJoystickDriver2
The IGamePadDriver interface is now implemented using
MappedGamePadDriver on all platforms. This minimizes code duplication
and simplifies all input driver implementations, since we only need
backends for IJoystickDriver2.
2014-09-11 12:51:45 +02:00
thefiddler e81d8da068 [OpenTK] Reduce duplication in GraphicsContextBase
Inheritors now take advantage of base class functionality to avoid
duplicating finalizers and warning messages.
2014-07-23 10:08:57 +02:00
thefiddler 00b531fdef Fixed compilation warnings on Mono 3.4.0 2014-07-21 17:46:39 +02:00
thefiddler e0a3b73130 Cleaned up the remaining obsolete warnings 2014-07-21 16:49:24 +02:00
thefiddler 461fbce45f Cleaned up a number of obsolete warnings 2014-07-21 16:39:58 +02:00
thefiddler ead151ea4f Fixed a large number of warnings 2014-07-21 16:03:37 +02:00
thefiddler ec34d17b21 Fixed a large number of build warnings 2014-07-21 15:03:24 +02:00
thefiddler bb8dfe4304 [Input] Improve SDL2 and Windows GetCursorState 2014-05-12 02:20:52 +02:00
thefiddler f4a3cab0e0 [Input] Added Mouse.GetCursorPos() (WIP) 2014-05-12 02:20:52 +02:00
thefiddler d7e0373852 [Platform] Fixed keys getting stuck on focus loss
NativeWindowBase will now clear all keyboard keys when losing focus.
This prevents keys from getting stuck when refocusing the window.

[Win] Also fixed WindowState.Maximized when WindowBorder is Hidden and
the window is minimized.
2014-05-09 16:45:45 +02:00
thefiddler 4556e54405 [Win] Fixed infinite recursion 2014-05-09 16:14:13 +02:00
thefiddler 8eae337d93 [Win] Cleaned up window size/pos properties 2014-05-09 15:22:33 +02:00
thefiddler 8b7d5bc7e4 [Input] Implement key repeat 2014-05-05 00:43:45 +02:00
thefiddler d968281a1b [OpenTK] Refactor keyboard and mouse handling
A lot of duplicated code is now moved to NativeWindowBase and
LegacyInputDriver.
2014-05-04 17:05:08 +02:00
thefiddler 94fdf1881c [Platform] Improved mouse interface
- The complete mouse state is now available in mouse events
- Horizontal wheels are now supported
- MouseState now takes up less memory and has a simpler internal
implementation.
2014-05-04 01:29:55 +02:00
thefiddler e85377c350 [Platform] Added support for horizontal wheel 2014-05-03 16:47:03 +02:00
thefiddler 3e33ac9280 [Platform] Refactored INativeWindow backends
All INativeWindow implementations are now derived from
NativeWindowBase. They no longer implement legacy IInputDriver
themselves, but rather rely on LegacyInputDriver provided by
NativeWindowBase for compatibility. They also implement the new Mouse*
events.
2014-05-02 16:52:11 +02:00
thefiddler 612652910f [Platform] Inherit NativeWindowBase 2014-05-02 14:18:40 +02:00
thefiddler 9ee728d4fc [Win] Only set MouseCursor in client area
This is required according to the windows documentation.
2014-05-01 16:49:23 +02:00
thefiddler 9988a2ba9c [SDL][Win] Destroy custom cursor on Close()
X11 destroys the cursor after setting it and Cocoa uses an autorelease
pool, so that should not be necessary there.
2014-05-01 14:27:20 +02:00
thefiddler c8c0d32fcc [OpenTK] Rearranged MouseCursor parameters
MouseCursor and WindowIcon now match GL.TexImage2D in the way they
arrange their parameters. The expected values of each parameter are now
documented.
2014-04-30 20:04:31 +02:00
thefiddler 890805f2ae [Platform] Renamed MouseCursor.Rgba to Argb
This matches the default format of System.Drawing.Bitmap.
2014-04-30 08:38:57 +02:00
thefiddler 0ed1e8b6d8 [Win] Log wglSwapIntervalEXT errors
Note that we cannot use Marshal.GetLastWin32Error because we are not
using regular DllImports for WGL extensions.
2014-04-29 08:48:49 +02:00
thefiddler 3da459b316 [All] Fixed checks for EXT_swap_control_tear
EGL and NSOpenGL do not offer an EXT_swap_control_tear equivalent so
use regular vsync for now. The relevant extension string is now
correctly checked on WGL and GLX.
2014-04-29 08:10:18 +02:00
thefiddler 509f356ed4 [Win] Fixed MouseCursor.Default
It is now possible to switch from a custom cursor back to
MouseCursor.Default.
2014-04-28 09:37:16 +02:00
Fraser Waters 9ed32e4445 Change bool to IntPtr.
WindowProc returns an IntPtr not a bool, so let Handle* functions return
IntPtr?. If they return a value we return that, if they return null we
call DefWindowProc and return the result from that.
2014-04-27 10:53:34 +02:00
Fraser 10112da976 Respond to WM_SETCURSOR messages.
Calling SetCursor on mouse moves is not enough, we need to respond to
SETCURSOR messages. If we have a custom cursor we need to call SetCursor
and then NOT call DefWindowProc, otherwise we just call DefWindowProc
for the forms default cursor.
2014-04-27 10:53:33 +02:00
Fraser 8f9311ec8d Partial implementation of Windows MouseCursor.
Very buggy, but starting to show results.
2014-04-27 10:53:32 +02:00
Fraser b005b6e542 DestroyIcon function. 2014-04-27 10:53:32 +02:00
Fraser 4fb7a2d5c2 GetCursor function. 2014-04-27 10:53:32 +02:00
Fraser acf47f1ff4 SetCursor function. 2014-04-27 10:53:32 +02:00
Fraser dd75466239 GetIconInfo function. 2014-04-27 10:52:53 +02:00
Fraser f10d8568cb CreateIconIndirect function. 2014-04-27 10:52:53 +02:00
Fraser 6c65e2cdd3 IconInfo structure. 2014-04-27 10:52:53 +02:00
thefiddler dd55cea489 [All] Initial implementation of INativeWindow.Cursor property
Affects issue #9
2014-04-27 10:52:53 +02:00
thefiddler 44526229be [Win] Fixed warnings
Protected object in static class and wrong parameter names in
documentation
2014-04-26 18:22:50 +02:00
thefiddler 433fa35f7e [Graphics] GetAddress(string) is no longer needed 2014-04-26 14:20:17 +02:00
thefiddler c1f284f101 [Win] Wgl no longer inherits GraphicsBindingsBase
This is a necessary step for the next commit.
2014-04-25 17:23:06 +02:00
thefiddler 58e41a2b97 [Win] Replaced KeyMap dictionary with switch
This reduces the amount of allocations on the startup path.
2014-04-25 14:13:55 +02:00
Fraser Waters fbe6cc0a31 Use Marshal.GetLastWin32Error instead of GetLastError.
Also removes magic number 1171 and replaces with constant.
2014-03-23 22:31:32 +00:00
Fraser Waters 095d3f26c0 Use GetMouseMovePointsEx to smooth mouse input.
Uses GetMouseMovePointsEx to get mouse move history so mouse events aren't dropped even with low framerates.

Fixes #76.
2014-03-23 16:26:24 +00:00
thefiddler ccb5408258 [Win] Invert vertical axes to match 1.0 API
The 1.0 API defines +y as up and -y as down. This matches XInput but
disagrees with WinMM, where we have to invert the vertical axes.
2014-03-17 00:43:36 +01:00
thefiddler 05bbc0b3f4 [Win] Joystick driver now reports hat positions 2014-03-17 00:29:12 +01:00
Fraser Waters b80bb86c5b Remove unused fields and variables. 2014-02-25 10:31:17 +00:00
Fraser Waters ab0751e7ec ModalLoopCallback is never assigned.
ModalLoopCallback is never assigned, so always has it's default value
null. Replace all uses of ModalLoopCallback with null.
2014-02-25 10:31:17 +00:00
thefiddler 9ba21d6017 [Win] Implemented modifier keys 2014-02-25 01:13:45 +01:00
Stefanos A. 0052ff435e [Win] Do not raise KeyPress for control chars
This matches the documented behavior of the GameWindow.KeyPress event.
2014-02-13 14:01:35 +01:00