Commit graph

5647 commits

Author SHA1 Message Date
thefiddler cd143af60a [SDL2] Added JoystickGetGUID method 2013-12-31 14:08:28 +01:00
thefiddler 1687518ef5 [SDL2] Add compile-time check for SDL2 GameController vs MappedGamePadDriver 2013-12-31 11:46:40 +01:00
thefiddler ef7f31099d [Input] Removed unnecessary #region 2013-12-31 01:02:07 +01:00
thefiddler 7d4d116ce9 [Input] Renamed GamePadMapping to GamePadMap 2013-12-31 01:01:52 +01:00
thefiddler d4348c5083 [SDL2] Fixed joystick/controller hotplugging support 2013-12-30 17:22:45 +01:00
thefiddler 9c8a5f5028 [SDL2] Fixed GameControllerButton to Buttons translation 2013-12-30 17:15:49 +01:00
thefiddler 43ef78f222 [SDL2] Fix issue where changes to mutable struct were lost 2013-12-30 17:09:20 +01:00
thefiddler 9beb396c9e [SDL2] Explicitly enable joystick and gamepad events 2013-12-30 17:08:42 +01:00
thefiddler 2d303a6884 [Input] Buttons should have [Flags] attribute 2013-12-30 16:07:06 +01:00
Stefanos A. 6faa58aac3 [SDL2] Fixed joystick hotplugging
SDL2 uses a weird system of device ids and instance ids to report
joystick events, where the ADDED event uses a device id and the rest use
instance ids.

The SDL2 joystick driver is now fixed to correctly distinguish between
the two, which fixes hotplugging support for joystick devices.
2013-12-30 15:24:48 +01:00
thefiddler 52b8762593 [SDL2] Fixed mapping of instance ids to device ids 2013-12-30 14:57:28 +01:00
thefiddler a4366e52f5 [Input] Added missing closing brace in ToString() message 2013-12-30 14:56:22 +01:00
thefiddler 064a45e4a7 [Input] Fixed incorrect variable name 2013-12-30 13:49:26 +01:00
thefiddler 1b0a72472e [SDL] Use TranslateAxis() to decode ControllerAxisEvent
SDL GameControllerAxis and GamePadAxes are not interchangeable. The
driver will now correctly interpret incoming SDL messages and update
the GamePadState for the relevant axis.
2013-12-30 13:42:37 +01:00
thefiddler e997ddf9c6 [Input] Fixed GamePadState.SetAxis() implementation
GamePadState.SetAxis() receives a GamePadAxes enumeration, which is a
bitmask of the axes we wish to set. SetAxis now correctly decodes the
bitmask to apply the values we are interested in.
2013-12-30 13:39:43 +01:00
thefiddler 0b8db7c40b [X11] Removed unused variable 2013-12-30 10:25:17 +01:00
thefiddler 4005710b99 [X11] Fixed current resolution detection. 2013-12-30 09:23:33 +01:00
thefiddler dc12128679 Merge branch 'external' into develop 2013-12-28 01:27:49 +01:00
thefiddler 3dbf575765 [Build] Added new files to the relevant csproj scripts 2013-12-28 01:23:39 +01:00
thefiddler 3bad2eefdc [Examples] Added ExternalContext test
This test uses SDL2 to create a window and an OpenGL context. It then
uses OpenTK to render into the external SDL2 context. If everything is
working correctly, a black window should appear and gradually turn
white before disappearing.
2013-12-28 01:17:56 +01:00
thefiddler 04e6d9335a [Graphics] Improved support for external OpenGL contexts
When combining OpenTK with a third-party OpenGL toolkit, it is now
possible to implement a suitable GetAddress() and GetCurrentContext()
implementation in terms of the third-party toolkit. If no
implementation is specified, then OpenTK will try to guess the most
suitable implementation within its own platform backends.

If no custom implementation is defined, and if no suitable
implementation can be found, then OpenTK will throw a
PlatformNotSupportedException. If a suitable implementation is found or
defined, then OpenTK will attempt to load OpenGL entry points using
that implementation.

In this case third-party toolkit remains solely responsible for
managing its context via its MakeCurrent(), SwapBuffers(), etc
implementations.
2013-12-28 01:14:59 +01:00
thefiddler 5cebaccfca [Dummy] Improved thread-safety; added entry-point loader
DummyGLContext will now attempt to load OpenGL and OpenGL ES entry
points when a suitable OpenGL context is current on the calling thread.
This allows OpenTK to be used on contexts created through third-party
toolkits.
2013-12-28 01:09:59 +01:00
thefiddler 8bcbb06f8e [Platform] Added internal CreateGetAddress() function
CreateGetAddress() constructs a GraphicsContext.GetAddressDelegate that
is suitable for the current platform. This can be used when combining
OpenTK with an OpenGL context created through a third-party toolkit.
2013-12-28 01:08:24 +01:00
thefiddler cf76aa6085 [Mac] Moved GetAddress implementation to its own class
The functions defined in libdl.dylib are useful in more places than
just AglContext. Moving them to their own class ensures we can access
these from wherever we might need them.
2013-12-28 01:06:33 +01:00
thefiddler 9171977079 [SDL2] Added missing [SuppressUnamangedCodeSecurity] attribute 2013-12-28 01:04:46 +01:00
thefiddler b79d951e62 [Mac] Use Cgl.GetCurrentContext instead of Agl
CGL appears to work with both AGL and NSOpenGL contexts, whereas AGL is
limited to AGL contexts. This allows us to be more flexible in terms of
implementation (i.e. we can use Cgl.GetCurrentContext to retrieve a
handle to a context created through SDL, which uses NSOpenGL
internally.)
2013-12-28 01:04:22 +01:00
thefiddler 0d1df41393 [X11] Improve GraphicsMode fallback (fixes issue #23)
When the user requests a GraphicsMode that is not directly supported
by the GPU/drivers, we should relax the requested parameters until
we find a supported mode. An exception should only be thrown when
there is no usable mode.

This makes the X11 backend match the behavior of Windows. The SDL/X11
backend works a little bit differently, in that it falls back to the
a default mode directly if the requested mode is not available. There
is nothing we can do about that.
2013-12-27 14:01:21 +02:00
thefiddler 88f7cd68f5 [X11] Fixed border size on Gnome 3
The _NET_FRAME_EXTENTS atom is implemented differently by
different window managers, when window decorations are hidden
with Motif. Unity returns a 0 size, while Gnome 3 returns the
previous size.

This patch removes that ambiguity: when decorations are hidden,
border size becomes zero. This should work everywhere, unless
some window manager decides to troll us by decorating the window
when we explicitly request no decorations. Sigh...
2013-12-27 13:31:51 +02:00
thefiddler ab8796c942 [Input] Do not crash with scancodes > 255 2013-12-27 11:10:41 +01:00
thefiddler 6c6e09aae6 [X11] Allow resizing with fixed borders
Windows can now be resized programmatically, even when they have
WindowBorder.Fixed. All resizing logic is now consolidated in the
Bounds property, and ConfigureNotify messages are now handled
correctly depending on their source (StructureNotify or
SubStructureNotify.)
2013-12-27 11:07:38 +01:00
thefiddler 4d27b6ee55 Implemented X11 KeyDown/KeyUp events and reduced code duplication 2013-12-25 11:46:02 +01:00
thefiddler ffdf881cea Do not raise KeyPress for control characters 2013-12-25 11:14:30 +01:00
parallels 83039f8740 Ignore *.pidb files from MonoDevelop 2.x 2013-12-25 11:11:29 +01:00
thefiddler f7fbf38c43 IsButtonBind should check for buttons, not axes 2013-12-25 01:47:27 +01:00
thefiddler b4b8bc1665 Implemented SDL IJoystickDriver2 and IGamePadDriver 2013-12-24 19:15:23 +01:00
thefiddler c51c4934df Added GameControllerGetBind APIs 2013-12-24 19:14:54 +01:00
thefiddler 6fc679c4ba Removed duplicate button types 2013-12-24 19:14:35 +01:00
thefiddler 016b91142b Merge branch 'gamepad' of https://github.com/opentk/opentk into gamepad 2013-12-24 17:18:20 +01:00
thefiddler 1eb807bb64 Use IGamePadDriver through MappedGamePadDriver 2013-12-24 17:18:05 +01:00
Stefanos A 7fd7b8c7a2 Improved ToString implementation 2013-12-24 17:18:05 +01:00
Stefanos A 9a90772cef Fixed WinMM offsets for IJoystickDevice2 2013-12-24 17:18:05 +01:00
Stefanos A f3cb578587 Improved WinMMJoystickDriver hotplugging behavior 2013-12-24 17:18:05 +01:00
Stefanos A d33d0c7387 Added state output for OpenTK.Input.Joystick 2013-12-24 17:18:05 +01:00
Stefanos A 82a2c9113c Implemented structural equality 2013-12-24 17:18:04 +01:00
Stefanos A 890d56ae63 Connected XInput driver 2013-12-24 17:18:04 +01:00
Stefanos A 15c01d0d5c WinMMJoystick implements IJoystickDriver2
WinMM is optimized for general joystick use, not for the canonical
GamePad layout. Instead of exposing IGamePadDriver directly, it should
expose IJoystickDriver2 and use a mapping driver to get GamePad support.
2013-12-24 17:18:04 +01:00
Stefanos A 165aa5bde6 Added MappedGamePadDriver skeleton implementation 2013-12-24 17:18:04 +01:00
Stefanos A 02fb6bf2f9 Implements JoystickState and Capabilities setters 2013-12-24 17:18:04 +01:00
Stefanos A 91b54cfbf3 No reason to comment out #region License 2013-12-24 17:18:04 +01:00
Stefanos A 52daef4b0d Added internal GamePadMapping class 2013-12-24 17:18:04 +01:00