Commit graph

451 commits

Author SHA1 Message Date
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
Stefanos A.
d0522f1073 [Win] Do not create second WinMMJoystick instance 2014-02-01 16:03:07 +01:00
Stefanos A.
45df508f8f [Win] Query WinMM joysticks on devicechange event 2014-02-01 16:02:02 +01:00
Stefanos A.
2d110728aa [Win] Cache WinMM joystick capabilities 2014-02-01 16:01:33 +01:00
thefiddler
a7228274aa [Input] Added JoystickCapabilities.HatCount 2014-01-31 15:40:07 +01:00
thefiddler
71d6da80de [Win] Faster WinMM GetCapabilities() and GetState()
joyGetDevCaps() is an extremely slow call that allocates memory.
WinMMJoystick is now caching its results for a significant speedup in
Joystick.GetCapabilities() and GetState().

The cache is updated whenever a joystick device is removed. WIP to
handle device added notifications.
2014-01-30 10:18:11 +01:00
thefiddler
c73e4785cd Merge remote-tracking branch 'cwassall/develop' into develop 2014-01-26 12:19:51 +01:00
thefiddler
6ba475e23f [Win] Use RelaxGraphicsMode to find optimal mode 2014-01-22 10:49:55 +01:00
Stefanos A.
770b697583 [Win] Clear extension list on reload 2014-01-21 09:04:27 +01:00
Stefanos A.
88ae446781 [Win] Removed WGL delegates in favor of calli 2014-01-21 09:00:57 +01:00
Stefanos A.
5379deaf63 [Win] Implemented calli-based interop for WGL 2014-01-21 09:00:25 +01:00