Fraser Waters
52043d5f74
Xcursor types.
2014-04-27 10:53:33 +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
f545bd512b
[SDL2] Implemented cursor APIs
...
Affects issue #9
2014-04-27 10:52:53 +02:00
Olle Håkansson
160e6ecb31
Added Quit menu item + shortcut (Cmd+Q).
2014-04-27 10:52:28 +02:00
Olle Håkansson
a24ce9ba11
Fixed creating contexts without native windows.
...
To create a context for the GTK GLWidget, you need to be able to
specify the exact NSView you want the OpenGL context to apply to. Also,
you don’t want to initialise the NSApplication in this situation, which
the CocoaContext did before (unintentionally).
2014-04-27 09:58:05 +02:00
thefiddler
a79086bb20
[X11] Set WM_CLASS property
...
This allows Ubuntu Unity and Gnome Shell to detect and display
the correct application name.
2014-04-26 20:27:00 +02:00
thefiddler
78a6993cec
[GL] Only print debug info in debug mode
2014-04-26 19:13:03 +02:00
thefiddler
95f73310d8
[X11] Implemented new-style bindings for GLX
...
Replaced delegates with call instructions and completely removed the
old extension loading code.
2014-04-26 18:24:13 +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
b732e377c9
[Mac] Sped up extension loading
...
From ~200ms down to ~65ms on a rMBP with Nvidia 650M and Mac OS X
10.9.2.
2014-04-26 14:21:26 +02:00
thefiddler
433fa35f7e
[Graphics] GetAddress(string) is no longer needed
2014-04-26 14:20:17 +02:00
thefiddler
9605940661
[X11] Optimized XKey translation
2014-04-25 21:55:00 +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
e433aad4b4
[ES] ES10 does not require initialization
...
It consists solely of DllImports that will be initialized on first use,
regardless of the existence of an OpenGL context.
2014-04-25 14:50:55 +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
thefiddler
e36a0d0fbc
[OpenTK] Rebased on develop
2014-04-25 13:38:53 +02:00
thefiddler
03a8a6da0e
[SDL2] Optimized Sdl2KeyCode translation
...
Also fixed Key.WinLeft, WinRight and Menu translation.
2014-04-25 12:14:27 +02:00
thefiddler
9f39aa1b88
[Mac] Optimized MacOSKeyCode translation
...
This also reduces memory allocations on startup by ~10K.
2014-04-25 12:14:26 +02:00
thefiddler
824f238973
[Mac] Removed most legacy Carbon code
2014-04-24 13:48:26 +02:00
thefiddler
5f44f3d491
[Mac] Removed unused Carbon APIs
2014-04-24 13:48:26 +02:00
thefiddler
cdd88e6f7e
[Mac] Migrated AglContext to OpenTK.GLControl
2014-04-24 13:48:26 +02:00
thefiddler
3475582c30
[Mac] Mouse coordinates are reported in pixels
2014-04-24 13:47:30 +02:00
thefiddler
e0848f9d6d
[Mac] SendFloat should use _fpret on i386
2014-04-24 13:47:30 +02:00
thefiddler
3250cbbc91
[Mac] Use scrollFactor variable
2014-04-24 13:47:30 +02:00
thefiddler
a2212f0184
[Mac] Fixed a warning related to volatile UniqueId
...
Also changed the class name to OpenTK_GameWindow
2014-04-24 13:47:30 +02:00
thefiddler
acb7dd27a7
[Mac] Window should be invisible on startup
...
Also fixes the initial position of the window.
2014-04-24 13:47:30 +02:00
Olle Håkansson
64fb043b77
Licensed files under MIT/X11.
2014-04-24 13:45:06 +02:00
thefiddler
b0eedc122d
[Mac] Avoid class conflicts for multiple windows
...
When creating multiple windows, their classes must have different class
names or they will fail to construct.
This commit ensures their names are unique. It also fixes a potential
memory leak in the Icon setter.
2014-04-24 13:45:06 +02:00
thefiddler
287c2b3415
[Mac] Add CocoaContext.GetGraphicsMode via CGL
...
Once the context is constructed, we use GetGraphicsMode to retrieve the
exact GraphicsMode that was selected by CocoaContext.
2014-04-24 13:45:06 +02:00
Olle Håkansson
2943bdfecb
Fixed too high mouse scrolling speed.
2014-04-24 13:45:06 +02:00
Olle Håkansson
4573db2ceb
Much improved handling of window/border states.
2014-04-24 13:45:06 +02:00
Olle Håkansson
df6caa3cbb
Fixed missing Mode value in CocoaContext.
...
Crashed E.g. GameWindow States example.
2014-04-24 13:45:06 +02:00
Olle Håkansson
374ce26186
Added a helper for creating cocoa window infos.
2014-04-24 13:45:05 +02:00
Olle Håkansson
86a5399534
Register mouse drag as well as move.
2014-04-24 13:45:05 +02:00
Olle Håkansson
46856dc21d
Closing should occur in ProcessEvents.
2014-04-24 13:45:05 +02:00
Olle Håkansson
ed87814a7f
Cleanups.
2014-04-24 13:45:05 +02:00
Olle Håkansson
3798d268dc
Fixed mouse position not being received.
2014-04-24 13:45:05 +02:00
Olle Håkansson
9183e3ae0d
Fixed crashes from callbacks.
2014-04-24 13:45:05 +02:00
Olle Håkansson
d1fb2597bb
Better handling of maximized window.
...
Used the “zoom” command before, but it has some limitations (e.g. no
event when zoom is done).
2014-04-24 13:45:05 +02:00
Olle Håkansson
7c3872531e
Disabled capturing when changing resolution.
...
Might be off here, but without capturing it seems like we get a
behaviour closer to that of the PC.
2014-04-24 13:45:05 +02:00
Olle Håkansson
50ed0ee9da
Bug fixes.
2014-04-24 13:45:05 +02:00
Olle Håkansson
63d0d057c5
Better fullscreen handling.
2014-04-24 13:45:05 +02:00
Olle Håkansson
59d7889ce0
Restored most window functionality.
2014-04-24 13:45:05 +02:00
Olle Håkansson
5457651676
Fixed swap interval.
2014-04-24 13:45:04 +02:00
Olle Håkansson
6c6beae4fc
Setup listening for window events.
2014-04-24 13:45:04 +02:00
Olle Håkansson
5e1b7c82ab
Cocoa bindings through libobjc.dylib
2014-04-24 13:45:04 +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
csantos
c48f6399e4
Centering the cursor at (width/2, height/2), effectively fixing
...
the issue described in https://github.com/mono/MonoGame/issues/2283
2014-03-18 01:44:52 -03: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
cae62151b8
[Input] LegacyJoystickDriver now reports hat pos
2014-03-17 00:30:19 +01:00
thefiddler
05bbc0b3f4
[Win] Joystick driver now reports hat positions
2014-03-17 00:29:12 +01:00
thefiddler
f23b93b839
[SDL2] On Mac, OpenGL 3.0 or 3.1 should create 3.2 context
...
SDL2/Mac fails to create a 3.0 or 3.1 OpenGL context. We implicitly
bump version to 3.2, otherwise 3.0 or 3.1 would give a 2.1 context.
2014-03-16 22:50:12 +01:00
thefiddler
3f8a62eaf7
Merge remote-tracking branch 'frassle/warnings' into develop
2014-03-11 14:57:36 +01:00
Paul Kratt
d9a7821319
Call the new code instead of leaving the old version untouched
2014-02-25 18:52:34 -06:00
Paul Kratt
0df7c55609
Update spacing and formatting to match existing style
2014-02-25 18:46:07 -06:00
Paul Kratt
794d45fdeb
Make GLControl work on OS X
...
This isn’t the greatest solution, but at least it doesn’t require us to
reference WinForms in OpenTK and it works perfectly for what I’m using.
2014-02-25 18:46:06 -06: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
2f4161108d
[X11] Fixed KeyUp event arguments
...
KeyUp event was incorrectly fired with KeyDownEventArgs instead of KeyUpEventArgs. This is now fixed.
2014-02-25 01:13:46 +01:00
thefiddler
ee1fb2a917
[X11] Implemented modifier keys
2014-02-25 01:13:46 +01:00
thefiddler
9ba21d6017
[Win] Implemented modifier keys
2014-02-25 01:13:45 +01:00
thefiddler
09f9bb3a17
[SDL2] Implemented modifier keys
...
Additionally, removed event watch callback in favor of calling
PollEvent() directly in ProcessEvents, which should be more efficient.
2014-02-25 01:13:45 +01:00
thefiddler
0c262cd5b2
[SDL2] Added PeepEvents/PollEvent functions
2014-02-25 01:13:45 +01:00
thefiddler
14d53010b0
[SDL2] Corrected win/alt key mapping (was swapped previously)
2014-02-25 01:13:45 +01:00
thefiddler
56e4b3cc85
[Mac] Implemented modifier keys
2014-02-25 01:13:45 +01:00
thefiddler
925abfdb10
[EGL] Removed unnecessary OpenTK.Platform.Windows reference
2014-02-21 14:04:33 +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
5145ebceb7
[Mac] Implemented JoystickHat support
2014-01-31 16:17:04 +01:00
thefiddler
a7228274aa
[Input] Added JoystickCapabilities.HatCount
2014-01-31 15:40:07 +01:00
thefiddler
168c45f0e2
[SDL2] Implemented support for hat state
2014-01-31 15:03:51 +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
eeaa3276f1
[Input] Implemented axis-button mappings
2014-01-29 10:39:18 +01:00
thefiddler
c73e4785cd
Merge remote-tracking branch 'cwassall/develop' into develop
2014-01-26 12:19:51 +01:00
Stefanos A.
06a3d7e1a7
[OpenTK] Don't skip AA modes in RelaxGraphicsMode
...
Previously, specifying an odd AA mode (e.g. 5x) would have been relaxed
to 0x. Now, it will be correctly relaxed to 4x.
2014-01-22 23:25:11 +01:00
thefiddler
417a6bedc1
[SDL2] Use RelaxGraphicsMode to find optimal mode
...
For SDL2, RelaxGraphicsMode requires us to clear context attributes
between consecutive attempts. This is implemented by calling
ClearGLAttributes().
2014-01-22 11:37:37 +01:00
thefiddler
0575e63a27
[Max] Use RelaxGraphicsMode to find optimal mode
2014-01-22 11:03:40 +01:00
thefiddler
6ba475e23f
[Win] Use RelaxGraphicsMode to find optimal mode
2014-01-22 10:49:55 +01:00
thefiddler
615df9201b
[OpenTK] Moved RelaxGraphicsMode to Utilities
...
This functionality is useful for all platform backends and is not
specific to the X11 backend.
2014-01-22 10:49:27 +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
cwassall
7b591962e8
Change original_resolution field to a property
...
As the original_resolution field needs to be accessed from outside the
module, it should be an internal property as opposed to an internal
field
2014-01-20 12:51:55 +00:00
cwassall
5f6c8e654c
Remember DisplayDevice original resolutions
...
When refreshing the AvailableDevices list, it is important to set the
original resolution on any DisplayDevices that were previously available
to allow the RestoreResolution() method to work correctly.
2014-01-19 19:44:12 +00:00
Stefanos A.
b87b9e0a27
[Win] Fix X1/X2 mouse buttons (fixes issue #27 )
2014-01-16 17:16:03 +01:00
thefiddler
e6a9adf494
[OpenTK] Fixed polling
2014-01-15 01:19:45 +01:00
thefiddler
e7f037b0a2
[OpenTK] Fixed legacy joystick hotplugging & events
2014-01-15 01:13:39 +01:00
thefiddler
df7d7ae8eb
[Linux] Implemented joystick guid detection
2014-01-15 00:57:28 +01:00
thefiddler
fb917a6d89
[Linux] Implemented joystick hotplugging
2014-01-14 23:51:31 +01:00
Stefanos A.
4473c8373e
[X11] Implemented joystick hotplugging
...
This is a work in progress.
2014-01-14 18:37:16 +01:00
Stefanos A.
4203c14b22
[X11] Removed IJoystickDriver from X11Joystick
...
Legacy IJoystickDriver support is now implemented through a
LegacyJoystickDriver instance.
2014-01-14 18:36:19 +01:00
Stefanos A
f3036e5f10
Merge branch 'develop' into linux_joystick
2014-01-14 18:26:05 +01:00
Stefanos A
cb4e4d5e72
Merge branch 'legacy_joystick' into linux_joystick
2014-01-14 18:17:05 +01:00
Stefanos A.
d467629ad8
[Linux] Added INotify bindings
...
These are not currently used.
2014-01-14 18:15:53 +01:00
Stefanos A.
19eb72b3a9
[OpenTK] Fixed Utilities.CreateSdl2WindowInfo
...
Utilities.CreateSdl2WindowInfo should store the specified windowHandle
directly instead of trying to call SDL.SDL.CreateWindowFrom.
2014-01-10 16:56:26 +01:00
Stefanos A.
aff9719872
[SDL2] Implemented GetWindowWMInfo
2014-01-10 16:55:20 +01:00
Stefanos A.
bdfcf43e0b
[Win] More robust pixel format selection
...
This patch adds more robust checks for WGL_ARB_pixel_format and
WGL_ARB_multisample before using the relevant extensions, and adds
checks whether Wgl.Arb.ChoosePixelFormat() returns a valid pixel format
before trying to use it (thanks to Repetier for catching this edge
case.)
Additionally, the ChoosePixelFormatPFD code-path now heavily penalizes
single-buffered modes when the user requests a double-buffered mode.
Affects issues #42 and #45
2014-01-10 15:41:57 +01:00
Stefanos A.
ef5aedba6f
[Win] More robust WGL extension detection
...
Affects issue #42 and issue #45
2014-01-10 09:24:59 +01:00
thefiddler
a4d2a31386
[Mac] OpenGL 3.x/4.x require core profile flag
...
SDL will fail to construct an OpenGL 3.x/4.x context on Mac OS X,
unless ContextProfileFlags.CORE is specified.
Fixes issue #44
Upstream enhancement request at
https://bugzilla.libsdl.org/show_bug.cgi?id=2342
2014-01-09 23:36:28 +01:00
Stefanos A.
28ac3cec0b
[Win] Fix issue #35 (OpenTK over Remote Desktop)
...
When running over remote desktop without hardware acceleration, there
are no GraphicsModes that support desktop composition. This patch adds
logic to avoid requesting composition-capable modes when running over
RDP.
Additionally, it changes the mode selection logic to consider modes that
support features partially (e.g. 16bpp color instead of 32bpp), albeit
with a heavy penalty over fully supported modes.
2014-01-09 00:14:25 +01:00
Stefanos A.
1b3b510376
[Win] Check registry keys before accessing
...
Fixes crashes when using OpenTK over the Remote Desktop Client for Mac
(version 2010).
2014-01-09 00:10:41 +01:00
Stefanos A.
4af9d30ccb
[Win] Fix issue #33 ; fix issue #34
...
This patch adds a workaround for WM_STYLECHANGED messages that are not
delivered when running on Mono/Windows. If we detect Mono, then we call
HandleStyleChanged() directly in order to update the internal state of
our WinGLNative instance.
2014-01-08 22:29:22 +01:00
Stefanos A.
51ad513dbb
[Win] Do not overload internal SetWindowLong
...
The internal function is now appended with "Internal".
2014-01-08 19:22:03 +01:00
Stefanos A.
7363cfee7b
[Win] Do not unregister class twice
...
Only the parent window would register a class, but both the parent and
the child window would unregister it. This is now fixed.
2014-01-08 19:21:29 +01:00
Stefanos A.
51baed7286
[Win] Remove unnecessary #if clauses
2014-01-08 00:45:42 +01:00
Stefanos A.
e260a42954
[Win] Refactor huge wndproc into functions
2014-01-08 00:02:27 +01:00
thefiddler
94c3c24bfb
[OpenTK] Platform backends should inherit from PlatformFactoryBase
...
This reduces code duplication wrt deprecated interfaces and common
support code between backends.
2014-01-06 14:49:05 +01:00
thefiddler
d84be0d594
[OpenTK] Added base IPlatformFactory implementation
...
PlatformFactoryBase provides a common base interface for platform
backends. Platform backends should inherit from PlatformFactoryBase in
order to reduce code duplication.
2014-01-06 14:47:58 +01:00
thefiddler
a94a293732
[Platform] Implemented legacy IJoystickDriver
...
LegacyJoystickDriver implements the legacy IJoystickDriver interface
(GameWindow.Joysticks) in terms of the new IJoystickDriver2 interface
(OpenTK.Input.Joystick).
This removes a large chunk of code from each platform backend, as they
no longer need to implement IJoystickDriver themselves. Additionally,
it adds support for device hot plugging which was previously missing.
2014-01-06 14:25:05 +01:00
thefiddler
a9ab3650da
[Mac] Do not store *State structs directly
...
Storing Mouse/KeyboardState structs directly makes updates more
difficult than they should be. It is simpler to create simple classes
instead.
2014-01-05 23:58:05 +01:00
thefiddler
fda2d32d2d
[Mac] Map GamePads, MultiAxisControllers and Wheels to joysticks
2014-01-05 22:44:58 +01:00
thefiddler
a1123834a0
[Mac] Call DeviceRemoved() in Dispose() event
...
The necessary cleanup code already exists in DeviceRemoved(). No need
to duplicate this in the Dispose() event.
2014-01-05 22:38:26 +01:00
thefiddler
ab85afd5ba
[Mac] Avoid IOHIDDeviceConformsTo call in DeviceRemoved handler
...
DeviceAdded already checks that devices conform to the desired usage
pages. Checking again in DeviceRemoved is unnecessary - if a device
exists, then it has already passed muster.
2014-01-05 22:36:01 +01:00
thefiddler
9e223486f6
[Mac] Implement Joystick.GetGuid()
2014-01-05 22:15:55 +01:00
thefiddler
5c5afb3ea3
[Mac] Calculate joystick Guid for USB devices
2014-01-05 22:06:19 +01:00
thefiddler
b458b40683
[Mac] Use out/ref parameters instead of unsafe pointers in bindings
2014-01-05 22:05:54 +01:00
thefiddler
fa386dc991
[Mac] Connect devices to first available index
2014-01-05 21:53:28 +01:00
thefiddler
05af21e61b
[Mac] Do not call CFRelease on HID properties
...
HID properties are callee-owned and should not be released by the
caller. Fixes crash (memory corruption) on device hot plugging.
2014-01-05 21:27:34 +01:00
thefiddler
02c9f471ea
[Mac] DllImport must be marked as extern
2014-01-05 21:18:20 +01:00
thefiddler
7388bd935d
[Mac] Correctly unschedule HIDManager from run loop
2014-01-05 20:17:03 +01:00
thefiddler
4c7f6a92a7
[Mac] Don't let exceptions escape to unmanaged code
2014-01-05 04:20:51 +01:00
thefiddler
892d129e54
[Mac] Fixed DllEntryPointNotFound crash on device unplugging
2014-01-05 04:15:30 +01:00
thefiddler
2ee24efb2f
[Mac] Implemented joystick buttons
2014-01-05 04:11:11 +01:00
thefiddler
fad42994e1
[Mac] Implemented joystick axis movement
2014-01-05 03:54:53 +01:00
thefiddler
59249c2624
[Mac] Implemented joystick device detection
2014-01-05 03:03:46 +01:00
thefiddler
07bcda0f57
[Mac] Retrieve HID joystick name
2014-01-05 02:42:47 +01:00
thefiddler
6dadbd3570
[Mac] Implemented necessary CFString methods
2014-01-05 02:42:33 +01:00
thefiddler
32653d2c64
[Mac] Construct JoystickDevice when joysticks are connected
2014-01-05 00:47:40 +01:00
thefiddler
bf8efea121
[Mac] Only add callbacks for recognized USB HID devices
2014-01-05 00:00:49 +01:00
thefiddler
c44b477388
[Mac] Implement device added/removed events for joysticks
2014-01-04 23:58:59 +01:00
thefiddler
9659a1d786
[Mac] Add skeleton HID input implementation for joysticks
2014-01-04 23:55:38 +01:00
thefiddler
3a63496b6d
Merge branch 'gamepad' into develop
...
Conflicts:
Source/OpenTK/OpenTK.csproj
2014-01-03 02:23:02 +01:00
thefiddler
53552b0070
[Input] Corrected malformed documentation comments
2014-01-03 02:17:42 +01:00
thefiddler
8649e4a044
[Input] Added SetVibration() API skeleton
2014-01-02 19:52:00 +01:00
thefiddler
b513e35ea8
[SDL2] Implemented PacketNumber property
2014-01-02 19:24:38 +01:00
thefiddler
1ccf7e5ad2
[Input] Added PacketNumber property
2014-01-02 19:24:15 +01:00
thefiddler
b5d42b7992
[Input] Implemented GetState() and simplified GetCapabilities()
2014-01-02 18:37:53 +01:00
thefiddler
bf5d2a738d
[Input] Made configuration database non-static
2014-01-02 02:42:51 +01:00
thefiddler
9e4827bf67
[SDL2] Fixed SDL_JoystickGetGUID capitalization
2014-01-02 02:20:51 +01:00
thefiddler
fb57a9062d
[Input] Renamed GamePadMap to GamePadConfiguration
2014-01-02 01:38:12 +01:00
thefiddler
dc1ffab78d
[Input] Implemented IGamePadDriver.GetName()
2014-01-02 01:34:21 +01:00
thefiddler
a0dad7f698
[Input] Implemented MappedGamePadDriver.GetCapabilities()
2014-01-02 01:13:20 +01:00
thefiddler
b9a8e365de
[Input] Added IJoystickDriver2.GetGuid() API
2013-12-31 14:09:17 +01:00
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
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
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
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
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
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
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
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
1eb807bb64
Use IGamePadDriver through MappedGamePadDriver
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
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
2839db587e
Implemented thumbsticks and trigger caps
2013-12-24 17:18:04 +01:00
Stefanos A
7e5307bd4a
Added IJoystickDevice2 interface
2013-12-24 17:18:03 +01:00
Stefanos A
e2d86fdf52
Implemented initial XInput IGamePadDriver
2013-12-24 17:18:03 +01:00
thefiddler
8f7eebb58d
Enabled HIDInput IGamePadDriver implementation
2013-12-24 17:18:02 +01:00
Stefanos A
5d88a8daf4
Implemented GamePad API (WIP)
2013-12-24 17:18:02 +01:00
Stefanos A
44351a03c4
More robust handling of device add/remove events
2013-12-24 17:18:02 +01:00
Stefanos A
31ce400a7e
Fixed expansion of joysticks collection
2013-12-24 17:18:02 +01:00
Stefanos A
2f1a81da2c
Log errors in subsystem initialization
2013-12-24 17:18:02 +01:00
Stefanos A
1d61bd9dd2
Reuse Sdl2Factory.InputDriver in Sdl2NativeWindow
2013-12-24 17:18:01 +01:00
Stefanos A
a72d70c3d0
Delay joystick initialization until necessary
2013-12-24 17:18:01 +01:00
Stefanos A
3660509dee
Added SDL_InitSubSystem method
2013-12-24 17:18:01 +01:00
thefiddler
484af18673
Updated internal IGamePadDriver interface
2013-12-24 17:18:00 +01:00
thefiddler
ee65f81f56
Implemented GameController API bindings
2013-12-24 17:18:00 +01:00
thefiddler
d9985fc571
Use SDL2 event API for joystick devices
2013-12-24 17:18:00 +01:00
thefiddler
022e5c845c
Implemented SDL2 Joystick and GameController events
2013-12-24 17:17:59 +01:00
thefiddler
d7fefe495e
Removed unused constructors
2013-12-23 21:43:17 +01:00
thefiddler
95270c877d
Added Compositing and FrameworkScaled flags
2013-12-23 21:42:16 +01:00
thefiddler
1189b33ed5
Fixed OpenTK/Carbon key repeat behavior to match the other backends
2013-12-23 20:40:27 +01:00
thefiddler
c13d80d6d8
Fixed GameWindow.{Bounds, Location, Size, X, Y} setters on OpenTK/Carbon
2013-12-23 20:21:02 +01:00
thefiddler
c6a21a2239
Implemented KeyDown & KeyUp events on OpenTK/Carbon
2013-12-23 19:32:16 +01:00
Stefanos A.
30cd9cb7f8
Fixed crash in MakeCurrent(null)
...
MakeCurrent(null) should set the bound device context to zero.
2013-12-22 11:10:05 +01:00
Stefanos A.
0a46e20029
Added WGL_DRAW_TO_WINDOW_ARB flag
...
Without this flag, OpenGL rendering does not work as expected.
Additionally, all WGL_ARB_pixel_format attributes are expected to be
specified in key-value pairs. Fixed double-buffering and stereoscoping
rendering attributes.
2013-12-22 10:35:05 +01:00
Stefanos A.
a2744719d5
Improved WGL mode selection
...
Fixed WGL_ARB_pixel_format attribute selection for doublebuffering,
stereoscopic rendering and hardware acceleration. Implemented
minimization strategy to select the optimal PixelFormatDescriptor in the
fallback path.
2013-12-22 09:20:40 +01:00
Stefanos A.
956bbe6491
Fixed DescribePixelFormatPFD
...
When using the PFD codepath, we now call DescribePixelFormat to retrieve
an exact interpretation of the pixel format selected by the driver.
2013-12-21 23:35:55 +01:00
Stefanos A.
1723be8a8b
Prioritize accelerated formats first
...
Instead of creating a list of all available formats and iterating
through that, we let the driver decide which is the best accelerated
format to use for the user parameters. If no such format exists, we fall
back to generic acceleration or software acceleration, in turn.
This affects issue #21
2013-12-21 22:43:35 +01:00
Stefanos A.
a7ae4bb038
Turn 1-element array to ref/out param
2013-12-21 22:41:35 +01:00
Stefanos A.
0c990583a3
Implemented KeyDown and KeyUp messages
2013-12-21 00:50:25 +01:00
Stefanos A.
42ce028bbf
Clean fix issue #19
...
Isolate and commit fix for issue #19 without potential for regressions.
2013-12-21 00:43:05 +01:00
Stefanos A
e1619a8ad3
Revert "Fix issue #19 "
...
This reverts commit 2c14ec5f80
.
2013-12-21 00:41:55 +01:00
Stefanos A.
2c14ec5f80
Fix issue #19
...
Don't filter window messages passed to our window (see
http://blogs.msdn.com/b/oldnewthing/archive/2005/02/09/369804.aspx ).
Additionally, return the correct values for all messages we are actually
handling and clean up unmanaged memory after we are done with the
window.
2013-12-20 23:31:42 +01:00
Stefanos A.
b941a8f06b
Explicitly set WindowProcedure calling convention
2013-12-20 23:29:47 +01:00
Stefanos A.
2ddd555aaf
Simplify ProcessEvents implementation
...
Instead of combining PeekMessage+GetMessage, we can simply call
PeekMessage(Remove) to achieve the same effect. This also allows us to
remove the IsIdle property, which is no longer used anywhere.
2013-12-20 08:42:36 +01:00
Stefanos A.
a251617e9b
Threads with message pump require STA comparment
...
May affect issue #19
2013-12-19 10:39:36 +01:00
Stefanos A.
93e7b896c2
Replace Wgl.GetCurrentDC with cached dc
...
with
2013-12-18 14:51:00 +01:00
Stefanos A.
d8a4ca1162
Cleaned up temporary context construction
...
The temporary context is now retained until the actual context has been
constructed. If we don't do this, then WGL_ARB_create_context may fail
to work correctly on specific GPUs (e.g. Intel). This may affect issue
#19 .
2013-12-18 14:29:06 +01:00
Stefanos A.
a57b4c4270
Fixed GetModesARB implementation
...
The correct way to query number of available pixel formats is to use
Wgl.Arb.GetPixelFormatAttrib(NumberPixelFormatsArb), not
Wgl.Arb.ChoosePixelFormats. This fixes an issue where Intel drivers
would fail to report any pixel formats in GetModesARB, even when
WGL_ARB_pixel_format is supported.
2013-12-18 14:16:49 +01:00
Stefanos A.
fb93f2af93
Minor code cleanup
2013-12-17 23:31:04 +01:00
Stefanos A.
44b8a9dbdc
Use gdi32 implementations of functions
...
Several functions are defined in both gdi32 and opengl32. Using the
opengl32/wgl versions did not appear to help with issue #19 . Let's use
the gdi32 version instead, as suggested here:
https://www.opengl.org/wiki/Platform_specifics:_Windows#The_WGL_functions
2013-12-17 22:35:30 +01:00
Stefanos A.
dd31b41f08
Load opengl32.dll before gdi32.dll
...
According to
http://stackoverflow.com/questions/199016/wglcreatecontext-in-c-sharp-failing-but-not-in-managed-c ,
opengl32.dll must be loaded before gdi32.dll. Affect issue #19 .
2013-12-17 21:24:25 +01:00
Stefanos A.
f4f793a5d3
Minor code cleanup
...
No need to wrap Wgl.DescribePixelFormat, just call it directly.
2013-12-17 16:40:15 +01:00
Stefanos A.
9129e62343
Use opengl32 instead of gdi32 throughout
...
Since we are dynamically loading opengl32.dll, we are supposed to use
the wgl version of functions that exist in both opengl32 and gdi32 dlls.
2013-12-17 16:39:45 +01:00
Stefanos A.
9c2db338e9
Corrected the entrypoint for wglChoosePixelFormat
2013-12-17 16:38:56 +01:00
Stefanos A.
498f16c2bd
Improved diagnostics
...
This helps when tracking down GraphicsContext-related issues in SDL2.
2013-12-16 10:39:54 +01:00
Stefanos A.
6ad91dcc5b
Added hack for MonoGame compatibility
...
MonoGame uses reflection to access internal APIs. We need to keep these
available until this is fixed downstream.
2013-12-16 10:39:11 +01:00
Stefanos A.
1392d48ec0
Protect against recursion in Closing event
...
Misbehaving clients that shall not be named here may call
GameWindow.Close() inside the GameWindow.Closing event. This causes
recursion in SDL2, crashing the application.
This patch adds a guard to protect against recursion when calling
GameWindow.Close().
2013-12-16 10:37:59 +01:00
Stefanos A
e9f54dc61e
Fixed memory corruption on string return type marshaling
2013-12-15 20:57:25 +01:00
Stefanos A
dfd683ef49
Merge master into no-reflect
2013-12-15 16:36:37 +01:00
Stefanos A
0bdb871e90
Merge remote-tracking branch 'origin/master' into no-reflect
2013-12-05 14:53:37 +01:00
Stefanos A
ca5a5b4d16
Reduce temporary string allocations
...
Instead of modifying the name of an OpenGL symbol on the managed side,
before copying it to the unmanaged side, we perform the modification
directly on the unmanaged side. This reduces the total amount of
allocations in OpenTK by ~30% (673496 bytes in 10750 objects compared
to 930272 bytes in 15243 objects before this modification.)
2013-12-05 11:20:58 +01:00
Stefanos A.
58ab194ba8
Fixed centering for non DPI-aware applications
2013-12-02 23:37:22 +01:00
Stefanos A.
c480911843
DPI-scaling should affect resolution
...
The correct resolution will now be reported depending on whether the
application is DPI-aware.
2013-12-02 23:37:00 +01:00
Stefanos A.
1475b3d427
Made DPI-awareness configurable (issue #6 )
...
It is now possible to indicate that an application is not DPI-aware. In
that case, OpenTK will let the operating system handle DPI scaling. This
results in worse visuals (pixel doubling) but allows non DPI-aware
applications to continue working.
2013-12-02 22:18:16 +01:00
Stefanos A.
0a39143b3e
Removed unused WGL methods
...
WGL was autogenerated a few years ago but never touched after that.
Since we use a tiny fraction of all available methods, it makes sense to
remove the unused ones. This reduces dll size and improves startup
times.
2013-11-28 23:22:35 +01:00
Stefanos A.
c53c0bc66f
Added GetProcAddress(IntPtr) overloads
...
This might allow us to improve startup performance, by avoiding string
marshaling during extension loading.
2013-11-28 23:21:19 +01:00
Stefanos A.
8b8ea714ee
Fixed wglGetProcAddress entry point
...
A typo would cause extension loading to fail. This is now fixed.
2013-11-28 09:04:08 +01:00
Stefanos A.
7775fa64aa
Removed unused WGL bindings
...
Our WGL bindings contained dozens of methods that OpenTK did not use.
Removing these reduces the dll size and improves startup times.
2013-11-27 19:37:59 +01:00
Stefanos A.
9c7e5201db
Fixed entry point validity check
2013-11-27 19:36:42 +01:00
Stefanos A.
e65f206554
Fixed core loading on Windows
...
On Windows, entry points for OpenGL 1.0 and 1.1 are not exposed by
wglGetProcAddress. We fall back to LoadLibrary+GetProcAddress when
wglProcAddress fails.
2013-11-25 00:26:20 +01:00
Stefanos A.
657c447737
Hooked up new loading mechanism
2013-11-24 13:58:12 +01:00
Elias Holzer
6ee04b2ff9
Implemented KeyPress event for Sdl2NativeWindow.
2013-11-22 18:05:11 +01:00
Elias Holzer
f851d8887c
Implemented KeyDown and KeyUp events for Sdl2NativeWindow.
2013-11-22 18:04:53 +01:00
Stefanos A
2ace001203
Implemented direct binding loading
...
OpenTK normally uses reflection to load bindings, instead of generating
huge constructors. Although reflection is faster on first load (thanks
to reduced JIT overhead), it fails to work correctly with monolinker.
This branch explores the performance of a direct binding.
2013-11-22 17:32:17 +01:00
Stefanos A.
e2404d2cfc
Fix "CursorVisible bugs"
...
When we enter the modal resize loop on Windows with ClipCursor set, we
cause a feedback loop where every resize causes the cursor to move and
every move causes a new resize. To fix this, we need to ungrab the
cursor when we are enter the modal loop.
2013-11-22 14:10:21 +01:00
Stefanos A.
08701d318c
Destroy SDL window when finalized
...
SDL_DestroyWindow must be called on the main thread. If the window is
finalized, the finalizer will push a CLOSE event to the event loop
(thread-safe) and the window will be destroyed on the main thread.
2013-11-21 09:31:32 +01:00
Stefanos A.
75d4f3d07c
Fixed #5
...
We need to release the cursor before closing a GameWindow, otherwise
subsequent GameWindows may fail to receive mouse events.
2013-11-20 18:05:45 +01:00
Stefanos A.
1d19a80b53
Removed incorrect comment
2013-11-20 13:05:49 +01:00