Commit graph

5540 commits

Author SHA1 Message Date
thefiddler c6a21a2239 Implemented KeyDown & KeyUp events on OpenTK/Carbon 2013-12-23 19:32:16 +01:00
thefiddler d880366208 Enabled HIDInput IGamePadDriver implementation 2013-12-23 19:19:41 +01:00
Stefanos A. a7db0d76db Implemented GamePad API (WIP) 2013-12-23 01:50:25 +01:00
Stefanos A. f9394b9ba6 Removed unnecessary IsButtonValid method 2013-12-23 01:50:13 +01:00
Stefanos A. c89ddaa225 Display start button in ToString() 2013-12-23 01:49:49 +01:00
Stefanos A. 61f0918544 Fixed rendering of joysticks and gamepads
Joysticks and gamepad states would overlap, causing some lines to be
unreadable. This is now fixed.
2013-12-23 01:29:12 +01:00
Stefanos A. 8350e8e2ce More robust handling of device add/remove events 2013-12-23 00:17:13 +01:00
Stefanos A. 033ba43b70 Fixed expansion of joysticks collection 2013-12-22 23:55:46 +01:00
Stefanos A. 9936fa4cc5 Log errors in subsystem initialization 2013-12-22 23:55:28 +01:00
Stefanos A. c1783c9f26 Reuse Sdl2Factory.InputDriver in Sdl2NativeWindow 2013-12-22 23:54:55 +01:00
Stefanos A. 5958db383d Delay joystick initialization until necessary 2013-12-22 23:13:21 +01:00
Stefanos A. 6d0427b928 Added SDL_InitSubSystem method 2013-12-22 23:12:53 +01:00
Stefanos A. 98b4883efd Fixed x/y axis mixup. 2013-12-22 22:47:50 +01:00
Stefanos A. 16d5055cb1 Cleaned up using directives 2013-12-22 22:34:34 +01:00
Stefanos A. 7016ad3312 Added missing newline 2013-12-22 22:32:24 +01:00
Stefanos A. 1e62821bf1 Implemented GamePadThumbSticks 2013-12-22 22:32:18 +01:00
Stefanos A. 487e67473f Added state information for GamePads 2013-12-22 22:07:40 +01:00
Stefanos A. ef580daf75 More compact string representation 2013-12-22 22:07:30 +01:00
Stefanos A. cbc39f922d Implemented IEquatable<> interface 2013-12-22 22:01:04 +01:00
Stefanos A 7692243cd2 Remove bogus GraphicsMode.Index check. Fixes #22
GraphicsMode.Index is set by the platform-specific context constructor,
which is invoked after the X11GLControl constructor. It does not make
sense to check GraphicsMode.Index in the X11GLControl constructor, as it
is never set at that point.
2013-12-22 20:55:59 +01:00
Stefanos A. 2d7734c915 Remove bogus GraphicsMode.Index check. Fixes #22
GraphicsMode.Index is set by the platform-specific context constructor,
which is invoked after the X11GLControl constructor. It does not make
sense to check GraphicsMode.Index in the X11GLControl constructor, as it
is never set at that point.
2013-12-22 15:40:01 +01:00
Stefanos A 12cceacf60 Fixed crash in MakeCurrent(null)
MakeCurrent(null) should set the bound device context to zero.
2013-12-22 14:15:53 +01:00
Stefanos A dbabb6c838 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 14:15:52 +01:00
Stefanos A dec02d5534 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 14:15:52 +01:00
Stefanos A dfd90c8a43 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-22 14:15:52 +01:00
Stefanos A 0ad87bec3d 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-22 14:15:51 +01:00
Stefanos A 030cf937a0 Turn 1-element array to ref/out param 2013-12-22 14:15:51 +01:00
Stefanos A 98600b0008 Display renderer information 2013-12-22 14:15:50 +01:00
Stefanos A 8b1566b244 Implemented KeyDown and KeyUp messages 2013-12-22 14:15:50 +01:00
Stefanos A 6dc474f595 Clean fix issue #19
Isolate and commit fix for issue #19 without potential for regressions.
2013-12-22 14:15:50 +01:00
Stefanos A 1e4228456f Revert "Fix issue #19"
This reverts commit 2c14ec5f80.
2013-12-22 14:15:49 +01:00
Stefanos A d877061d6a 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-22 14:15:49 +01:00
Stefanos A 6696bef3eb Explicitly set WindowProcedure calling convention 2013-12-22 14:15:48 +01:00
Stefanos A 1edfa8f3de 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-22 14:15:48 +01:00
Stefanos A 6493ab0188 Threads with message pump require STA comparment
May affect issue #19
2013-12-22 14:15:47 +01:00
Stefanos A ecd7db99c1 Replace Wgl.GetCurrentDC with cached dc
with
2013-12-22 14:15:47 +01:00
Stefanos A b81aaf9a12 No point in using 16bpp color 2013-12-22 14:15:47 +01:00
Stefanos A c42090835f 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-22 14:15:46 +01:00
Stefanos A 146e8f3fb1 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-22 14:15:46 +01:00
Stefanos A 4ced172bdc Minor code cleanup 2013-12-22 14:15:45 +01:00
Stefanos A 613ca93d89 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-22 14:15:45 +01:00
Stefanos A 3413271d8a 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-22 14:15:45 +01:00
Stefanos A 954b1e98b6 Minor code cleanup
No need to wrap Wgl.DescribePixelFormat, just call it directly.
2013-12-22 14:15:44 +01:00
Stefanos A 1c8e7bc993 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-22 14:15:44 +01:00
Stefanos A 234c15e9c9 Corrected the entrypoint for wglChoosePixelFormat 2013-12-22 14:15:43 +01:00
Stefanos A 838adc0afc Merge branch 'wgl_issue21'. Fixes issue #21 2013-12-22 11:16:10 +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