Commit graph

3737 commits

Author SHA1 Message Date
thefiddler
86146f54d5 [X11] Fixed key repeat 2014-05-09 00:26:51 +02:00
thefiddler
8195800ee7 [X11] Improved vsync support
OpenTK will now check for GLX_EXT_swap_control, GLX_MESA_swap_control
and GLX_SGI_swap_control. This allows us to control vsync on more
systems.
2014-05-09 00:13:23 +02:00
thefiddler
d430b462fe [X11] Corrected size events 2014-05-08 20:58:11 +02:00
Dave Leaver
81bf3e6f7f Correct spelling in INativeWindow 2014-05-08 10:21:27 +12:00
thefiddler
bfaff0bd66 [GL] Added generic RenderbufferStorage depth-stencil formats
According to the OpenGL 4.4 specification, RenderbufferStorage accepts
both generic and sized depth-stencil formats (DepthComponent and
DepthStencil). See sections 9.2.4, 9.2.5 and 9.4.
2014-05-07 23:21:24 +02:00
thefiddler
e3fd9e1374 [SDL] Avoid CursorVisible = true cursor jump 2014-05-06 09:36:30 +02:00
thefiddler
a270b9328e [SDL] Report mouse in client coordinates 2014-05-06 09:31:35 +02:00
thefiddler
b1f627893b [Mac] Fixed PointTo* calculations
On HiDPI displays, the client rectangle is using a pixel-based
coordinate system, while the screen is using a point-based coordinate
system. PointToClient/PointToScreen now correctly accounts for that.
2014-05-06 09:03:13 +02:00
thefiddler
cd315a3bd6 [Platform] Forward PointToScreen to backend 2014-05-06 09:02:09 +02:00
thefiddler
637a8bee66 [Platform] More selective mouse events
We should not raise mouse events when the cursor state hasn’t changed.
2014-05-06 09:01:23 +02:00
thefiddler
52efa3b629 [SDL] Improved documentation of Event size hack 2014-05-05 15:11:01 +02:00
Stefanos A
dffabcb94a [SDL] Fixed a stack corruption issue on win32 2014-05-05 12:46:48 +02:00
thefiddler
41276361fb [Mac] Report KeyDown/Up events for modifier flags 2014-05-05 09:14:14 +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
e155d647de [X11] Added X11KeyMap.TranslateButton()
This code was duplicated on four different places before.
2014-05-04 17:04:03 +02:00
thefiddler
28a1849a72 [Mac] Moved MacOSKeys to MacOS namespace
They are used by both Carbon and Cocoa, so there is little reason to
keep them in MacOS.Carbon
2014-05-04 17:02:37 +02:00
thefiddler
2d5afcf0e8 [Input] Update state through HandleKey* events 2014-05-04 17:02:00 +02:00
thefiddler
268e8fccde [Input] Removed pointless unsafe region 2014-05-04 17:01:34 +02:00
thefiddler
1096a8802a [Input] Removed pointless ValuePrecise setter 2014-05-04 16:58:59 +02:00
thefiddler
7af710f4dd [Input] Removed pointless MouseDevice.SetState
MouseDevice state should only be modified through its HandleMouse*
methods, not directly.
2014-05-04 16:58:24 +02:00
thefiddler
4b115c443b [Mac] Add horizontal scrolling 2014-05-04 15:24:02 +02:00
thefiddler
30c73e8ead [OpenTK] Raise NativeWindow.Mouse* events 2014-05-04 15:23:40 +02:00
thefiddler
9dab96c5c1 [Mac] Disable momentum scrolling and key pop-ups
We might wish to add an option to re-enable momentum scrolling, as this
might be useful to some applications for a more native feel.
2014-05-04 15:23:24 +02:00
thefiddler
15f5abe1e1 [Platform] Remove lambdas 2014-05-04 08:34:13 +02:00
thefiddler
67359a5d90 [Input] MouseDevice is now based on MouseState
This way we have a single state representation (MouseState), shared by
all mouse APIs and events.
2014-05-04 08:33:20 +02:00
thefiddler
e093fd23f6 [Mac] Avoid calling into LegacyInputDriver 2014-05-04 08:32:26 +02:00
thefiddler
ff46455e56 [X11] Removed legacy X11Input driver
Its functionality has been moved directly into X11GLNative and
X11KeyMap.
2014-05-04 08:32:08 +02:00
thefiddler
39eb3b1892 [Input] Improved MouseState.ToString() 2014-05-04 08:31:11 +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
842c0499b9 [SDL] Corrected SDL_Mouse* event structs 2014-05-02 17:39:00 +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
674cd54c29 [Mac] Fixed initial window position
Cocoa sets the desktop origin at the bottom-left of the main screen,
with +y going up. OpenTK is setting the origin at the top-left of the
main screen, so we need to invert the y-axis.
2014-05-02 15:13:38 +02:00
thefiddler
3824f55f18 [Mac] Fixed cursor coords when CursorVisible=false 2014-05-02 14:21:32 +02:00
thefiddler
89fc36bde1 [Platform] Added INativeWindow.Mouse* events 2014-05-02 14:18:52 +02:00
thefiddler
612652910f [Platform] Inherit NativeWindowBase 2014-05-02 14:18:40 +02:00
thefiddler
300203f73b [Mac] Use On* methods from base class 2014-05-02 09:41:27 +02:00
thefiddler
10939fcaec [OpenTK] Add On* methods to raise events 2014-05-02 09:37:25 +02:00
thefiddler
24b19d2487 [Input] Added internal MouseDevice.Position getter 2014-05-02 09:37:25 +02:00
thefiddler
f2eca2924f [Mac] Inherit from NativeWindowBase
This reduces code duplication significantly.
2014-05-02 09:37:25 +02:00
thefiddler
5ba1bf89f1 [OpenTK] Added NativeWindowBase
This acts as a common base class to INativeWindow implementations and
can be used to reduce code duplication.
2014-05-02 09:34:14 +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
8568e6dc70 [SDL] Fixed MouseCursor getting stuck after multiple changes 2014-04-30 13:46:44 +02:00
thefiddler
a5ddc530c2 [SDL] Fixed custom MouseCursor 2014-04-30 13:36:16 +02:00
thefiddler
e63970e2be [Mac] Fixed cursor byte order 2014-04-30 09:06:18 +02:00
thefiddler
2632661d8a [OpenTK] Fixed compilation error 2014-04-30 08:45:27 +02:00
thefiddler
965c8baa7f [OpenTK] Renamed x/y to hotx/hoty
The new name matches their functionality closer.
2014-04-30 08:44:48 +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
7d8f14baa7 [Mac] Implement NSCursor rectangles 2014-04-30 08:38:19 +02:00
thefiddler
d013ef1868 [Platform] Make MouseCursor actor public 2014-04-30 08:37:34 +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
f2dc40abdd [OpenTK] Query the driver for VSyncMode getter
Otherwise, the user could call Context.SwapInterval directly, causing
the vsync property to fall out of sync.
2014-04-29 08:31:47 +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
ab6b3c211c [Mac] Removed unused CarbonGLNative.cs 2014-04-28 17:17:34 +02:00
thefiddler
88a60b14c5 [Mac] Remove call to NewEventHandlerUPP
NewEventHandlerUPP fails to load when running through MonoKickstart. It
appears that this function is only used for old PPC systems that had
trouble with function pointers - sample code online indicates that we
do not need to call this.
2014-04-28 16:25:23 +02:00
thefiddler
cf3a30d024 [Mac] CGDisplayBounds signature now matches Mac ABI
This resolves a crash in CGDisplayBounds when running through monokick.
2014-04-28 16:25:10 +02:00
thefiddler
ffb7bd8a4c Merge branch 'pr/105' into develop 2014-04-28 16:19:17 +02:00
thefiddler
53d2c8d1e8 [Mac] Cmd-Q should raise Closing events
It should also be cancelable.
2014-04-28 16:19:04 +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
thefiddler
4f9a2f78d6 Merge branch 'cursor' of https://github.com/thefiddler/opentk into thefiddler-cursor 2014-04-28 07:07:47 +02:00
thefiddler
0f920fb205 [X11] Fixed SGI_swap_control query
GLX can return valid function pointer to unsupported functions.
We need to check for extension support in addition to the
function pointer.

Fixes crash on OpenSUSE 13.1 in VirtualBox.
2014-04-28 01:29:34 +02:00
thefiddler
168713aecf [GL] Added GetPName.Max*ImageUniforms
These tokens were introduced in OpenGL 4.2 and 4.3.
2014-04-27 22:47:04 +02:00
thefiddler
c40115e223 [OpenTK] Only init X11 if SDL2 is not used 2014-04-27 22:41:24 +02:00
thefiddler
96b7419d83 [X11] Fixed INativeWindow.Cursor getter 2014-04-27 22:28:10 +02:00
thefiddler
d03e9d82dc [Input] Fixed key modifiers in KeyboardDevice events 2014-04-27 22:27:18 +02:00
thefiddler
d787656328 [SDL] Fixed cursor support
SDL.CreateColorCursor takes 3 arguments, not 5.
2014-04-27 21:09:51 +02:00
thefiddler
48e21328c5 [Mac] Implement INativeWindow.Cursor 2014-04-27 19:45:20 +02:00
thefiddler
283a785703 [OpenTK] Treat null as MouseCursor.Empty 2014-04-27 19:45:08 +02:00
thefiddler
1d8ef7165f [OpenTK] Disable custom MouseCursors
They require further development, due to byte-order differences between
platforms.

MouseCursor is now derived from WindowIcon, which we will use for
INativeWindow.Icon support in the future, in order to remove the
dependency to System.Drawing.
2014-04-27 19:44:45 +02:00
thefiddler
a61d20d2eb [Mac] Stubbed INativeWindow.Cursor 2014-04-27 10:56:08 +02:00
Fraser Waters
2207144aec Fix a bug in X11 CursorVisble with custom cursors.
CursorVisible reset to the default cursor when showing the cursor, it
should instead show the custom cursor if it's defined (else the default
cursor).
2014-04-27 10:53:34 +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 Waters
9239fd08e3 Custom cursors on X11. 2014-04-27 10:53:33 +02:00
Fraser Waters
6e23a55f35 Add XcursorImageLoadCursor function. 2014-04-27 10:53:33 +02:00
Fraser Waters
4f2658ab79 Make xcursor fields public. 2014-04-27 10:53:33 +02:00
Fraser Waters
cb5f354ddc Change xcursor library name. 2014-04-27 10:53:33 +02:00
Fraser Waters
cf43b6003c Create and Destroy functions for XcursorImage. 2014-04-27 10:53:33 +02:00
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
thefiddler
a6f610dd0c [Core] Added MouseCursor class
This branch marks the beginning of hardware cursor support (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
6186373df1 [ES][GL] Synced with April Khronos specification 2014-04-27 09:53:22 +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
7c4bdab110 [GL] Removed unused code 2014-04-26 19:12:49 +02:00
thefiddler
cd25d5f307 [OpenTK] Removed reflection binding loading
This code is no longer in use.
2014-04-26 18:28:51 +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
8558509379 [GL][ES] Regenerated bindings 2014-04-26 14:23:52 +02:00
thefiddler
1666eb670c [GL][ES] Do not break public API
Even if that API is not meant to be used by applications.
2014-04-26 14:23:29 +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
fbeac9c323 [Graphics] Redirect GetAddress(string)
GetAddress(string) now calls GetAddress(IntPtr) internally. This
reduces the number of APIs that must be implemented for each platform.
2014-04-26 14:19:19 +02:00
thefiddler
9605940661 [X11] Optimized XKey translation 2014-04-25 21:55:00 +02:00
thefiddler
6257858d54 [Bind][ES][GL] Output entry points as byte[]
Moving from string[] to byte[] reduces startup memory allocations
tremendously (up to 70% lower memory use on Windows!)
2014-04-25 17:25:20 +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
3658fac263 [Input] Use Key.LastKey instead of Enum.GetValues
This avoids unnecessary memory allocations in the KeyboardDevice
constructor.
2014-04-25 14:15: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
thefiddler
e36a0d0fbc [OpenTK] Rebased on develop 2014-04-25 13:38:53 +02:00
thefiddler
6994a13770 [OpenTK] Fixed DllImport library for OpenGL on Mac OS X 2014-04-25 12:14:28 +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
4ae65c86ff [GL] Added missing GetPName.MaxPatchVertices 2014-04-25 11:11:42 +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
thefiddler
74cff79d64 Merge remote-tracking branch 'frassle/issue76' into develop 2014-04-01 09:39:48 +02:00
thefiddler
d292d44b90 [Math] Replaced tab characters with spaces 2014-03-31 18:20:08 +02:00
thefiddler
e4fd62c0ff Merge branch 'pr/84' into develop 2014-03-31 18:19:18 +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
db913ca3f4 [GL] Added missing [Rgba]16Snorm texture formats
See https://www.opengl.org/sdk/docs/man4/html/glTexImage2D.xhtml or the
4.4 spec, section 8.5, table "Sized internal color formats".
2014-03-18 12:08:02 +01: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
Phyyl
617131066a Added multiplication operator to all vectors 2014-03-17 16:59:09 -04: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
f93d464f62 [Input] JoystickHatState is now IEquatable 2014-03-17 00:30:04 +01:00
thefiddler
01c3b51be6 [Input] JoystickState.ToString now prints hat pos 2014-03-17 00:29:45 +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
02bf55ad7e [ES] Fixed loading of OpenGL ES core API
eglGetProcAddress cannot be used to retrieve
entry points of core functions. Instead, we
use [DllImport] for core functions and function
pointers for extension functions.

Squashed commit of the following:

commit 0b84aa6ef78dfa3600b81fc412eb192f2a87e40c
Author: thefiddler <stapostol@gmail.com>
Date:   Sat Mar 15 02:24:58 2014 +0100

    [Examples] Rolled back changes to Example browser

commit 1acfbaac3d17184debdbbe872c58ac07d1b37c0a
Author: thefiddler <stapostol@gmail.com>
Date:   Sat Mar 15 02:20:57 2014 +0100

    [Examples] Rolled back WinForms example

commit 835d9d6035a890bd3426566929fbfd25c493eca0
Author: thefiddler <stapostol@gmail.com>
Date:   Sat Mar 15 01:15:01 2014 +0100

    [Examples] Rolled back erroneous GLControl mods

commit 056418014f0e835e83fb85b54b8749519a555364
Author: thefiddler <stapostol@gmail.com>
Date:   Fri Mar 14 23:11:11 2014 +0100

    [Rewrite] Remove calli prototypes

    When a function is called indirectly via a function pointer, its
    prototype is not required (the prototype is added as a callsite at the
    calli invocation.) Removing these prototypes reduces binary size by
    roughly 400KB.

commit 353a16ec2836c597150d2fab28581e7c264b2b39
Author: thefiddler <stapostol@gmail.com>
Date:   Fri Mar 14 22:31:25 2014 +0100

    [Rewrite] Call DllImports directly

    When a function does not have an allocated slot (i.e. slot = -1), then
    we will call its DllImport signature directly.

commit 9a5313e4b7afb10b698d255e4b5637887bf71cf3
Author: thefiddler <stapostol@gmail.com>
Date:   Fri Mar 14 22:30:04 2014 +0100

    [Bind] Do not allocate slots for DllImports

commit 6ac5342409363cac0e59f9dc669948b319bd20a9
Author: thefiddler <stapostol@gmail.com>
Date:   Fri Mar 14 22:29:07 2014 +0100

    [Bind] Added option to use DllImports

    This is necessary for the core functionality of OpenGL ES, where
    eglGetProcAddress returns null or garbage (the latter on Android.)
2014-03-16 19:40:49 +01:00
thefiddler
242b8bbe6c [Graphics] Init OpenTK when creating external context
Fixes issue #52
2014-03-13 19:51:29 +01:00
thefiddler
625ba5dcda [Graphics] Regenerated with newest generator 2014-03-13 19:44:33 +01:00
thefiddler
d12bd18158 Merge branch 'gl_Mar2014' into develop 2014-03-13 19:39:37 +01:00
thefiddler
51c173e935 [Graphics] Documented parameter length
Fixes issue #15
2014-03-13 19:38:12 +01:00
thefiddler
b3fac68b37 [Graphics] Synced with Khronos repository
Adds:
- INTEL_performance_query extension
- “count” attribute fixes for multiple functions
2014-03-13 18:46:01 +01:00
thefiddler
cf728a631e [Bind] Added overloads for backwards compatibility 2014-03-13 18:42:37 +01:00
thefiddler
6a3838757c Fixed NRE when calling Toolkit.Dispose() more than once. 2014-03-11 16:00:25 +01:00
thefiddler
f5a4a4bd96 Merge branch 'issue69' into develop 2014-03-11 15:01:09 +01:00
thefiddler
3f8a62eaf7 Merge remote-tracking branch 'frassle/warnings' into develop 2014-03-11 14:57:36 +01:00
thefiddler
40a8a6d915 [GameWindow] Do not override Target*Frequency in GameWindow.Run()
This patch makes the following code work as expected:
```csharp
var gw = new GameWindow();
gw.TargetRenderFrequency = 60;
gw.Run();
```
Fixes issue #69
2014-03-06 14:16:30 +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
Fraser Waters
95bd094404 Disable Obsolete warning.
IGraphicsContext.VSync property is obsolete, but we have to call it in
the GraphicsContext.VSync implementation, so disable the obsolete
warning for this one use.
2014-02-25 10:31:17 +00:00
Fraser Waters
b89f79266b Fix XML documentation. 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
c92aabd807 [Input] Implemented GetModifiers() method 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
221d4661d4 [Input] Added modifier keys to KeyboardKeyEventArgs 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
4066ba8355 [Input] Added KeyModifiers enumeration
KeyModifiers are represented as a bitwise combination of the Alt,
Control and Shift keys.
2014-02-25 01:13:45 +01:00
Fraser
10ca14ac6d Add ErrorHelper to bindings.
Wrap new generated binding calls with using ErrorHelper. Sets up a try
to call the method in and a finally block to call Dispose on the
ErrorHelper. Currently hardcoded to only work for the graphics modules.
2014-02-25 01:08:53 +01:00
thefiddler
925abfdb10 [EGL] Removed unnecessary OpenTK.Platform.Windows reference 2014-02-21 14:04:33 +01:00
thefiddler
ae3f8cff55 [Doc] Fixed doxygen latex-to-pdf conversion
pdflatex will fail when a <seealso> elements is placed within a
<summary> element. This is now fixed.
2014-02-16 15:30:22 +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.
1c1607da56 [OpenTK] Make VB.Net overload resolution happy
GLHelper.cs contains a number of overloads that cannot be resolved by
VB.Net. We cannot remove them, as that will break
backward-compatibility, but we can hide them by moving them after the
autogenerated overloads in GL.cs.

Terrible hack, but it appears to work.

Issue originally reported at http://www.opentk.com/node/3554 as "OpenTK
1.1, VB.net and ambiguous functions."
2014-02-12 16:14:00 +01:00
Stefanos A
61f0ca89b4 Merge branch 'joyhat' into develop 2014-02-10 10:54:22 +01:00
thefiddler
ccd1ad0fd7 [GL] Do not limit strings to StringBuilder.Capacity. Fixes issue #57
We let StringBuilder grow to fit the unmanaged string. This appears to
match the default CLR marshaling behavior, which was used in OpenTK 1.0.
2014-02-07 15:57:36 +01:00
thefiddler
63dd4597c7 [GL][ES] Mark DebugProc* delegates as unmanaged function pointers
Calling convention is platform-dependent: stdcall on Windows, cdecl
elsewhere. This maps to CallingConvention.Winapi in .Net parlance.
2014-02-06 15:01:22 +01:00
thefiddler
bb741579c6 Merge pull request #56 from l3m/matrix4d-axis-angle
Updated Matrix4d.FromAxisAngle to mirror the Matrix4 version.
2014-02-06 10:33:09 +01:00
thefiddler
d8eda71a2c [GL] Added missing ActiveUniformType.FloatMat3x2 token 2014-02-04 14:26:52 +01:00
Jonas Boesch
e2ecba7274 Updated Matrix4d.FromAxisAngle to mirror the Matrix4 version. 2014-02-04 14:03:59 +01:00
thefiddler
6856fe5e71 Merged remote-tracking branch 'l3m/matrix4d-quat-fix' into develop
Updated the Matrix4d CreateFromQuaternion methods to actually create
Matrix4d. They now mirror the Matrix4 CreateFromQuaternion methods,
just using doubles and the -d classes.

Previously, Matrix4d.CreateFromQuaterion actually created a Matrix4
from a single-precision Quaterion.
2014-02-03 11:11:36 +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
Stefanos A.
2dee96d918 [Input] Fixed SetButton index check 2014-01-31 16:40:57 +01:00
Stefanos A.
4fceca2f80 [Input] Fixed compilation error 2014-01-31 16:37:36 +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
801d6ead04 [Input] Added hat state to JoystickState 2014-01-31 15:03:30 +01:00
thefiddler
0cacdf6ae4 [Input] Do not use a bitfield for hat position
Using a bitfield does not save storage space in this case, and also
stops pattern matching from working (switch() statement in C# or match
… with expressions in F#.)
2014-01-31 15:03:19 +01:00
thefiddler
a4ce2182d2 [Input] Added JoystickHatState structure 2014-01-31 15:01:35 +01:00
thefiddler
5fe2d60857 [Input] Added structures for joystick hat input 2014-01-30 17:40:26 +01:00
thefiddler
41a23ca371 [Input] Fixed off-by-one error in internal max axes/buttons 2014-01-30 17:36:59 +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
ef429aff01 [Input] Added support for JoystickButtons 16-31 2014-01-29 10:28:06 +01:00
thefiddler
c73e4785cd Merge remote-tracking branch 'cwassall/develop' into develop 2014-01-26 12:19:51 +01:00
thefiddler
cd42f92c12 [Input] Corrected GamePadState range to byte [0,255] 2014-01-25 17:05:06 +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
thefiddler
6f3951e825 [OpenTK] Allow a GraphicsMode.Buffers value of 0
0 in this case means “don’t care”.
2014-01-22 10:48:40 +01:00
thefiddler
ff36f0f35a [OpenTK] Clamp max AA level to 64x
This protects against a potential denial-of-service issue during mode
selection, where the platform backend will try to reduce AA level until
a supported mode is found.
2014-01-22 10:35:08 +01:00
thefiddler
2b6aec3b23 [OpenTK] Removed unused GraphicsMode field 2014-01-22 10:31:01 +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
Stefanos A.
b9f57ba4d2 [OpenTK] Use ASCII encoding
Most OpenGL versions work with single-byte ASCII strings exclusively.
OpenGL 4.2 adds UTF8 encoded comments to GLSL shaders. Unfortunately,
UTF16 (.Net) to UTF8 conversions will usually modify the length of the
resulting byte array.

This is not currently possible to implement inside OpenTK, since the
binding generator does not know which length parameter corresponds to a
string parameter.

For this reason, and to maintain compatibility with older OpenGL
versions, we perform a destructive UTF16-to-ASCII encoding, which
replaces unsupported characters by '?'. This allows multi-byte post-4.2.
GLSL shaders to work as expected.

If non-destructive round-tripping of strings is required, the user will
have to use the IntPtr overload for string parameters and perform the
UTF16-to-UTF8 encoding/decoding manually. This need is very unlikely to
arise in practice.
2014-01-16 14:32:11 +01:00
Stefanos A
606b4ddcd1 Merge branch 'develop' of https://github.com/opentk/opentk into utf8 2014-01-16 11:44:34 +01:00
Stefanos A
9268b5ed7f Merge branch 'develop' into utf8 2014-01-16 11:39:22 +01:00
thefiddler
44e2576c86 [OpenTK] Protect against invalid axis/button ids 2014-01-15 01:24:20 +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
73e3b66038 [OpenTK] Use LegacyJoystickDriver for IJoystickDriver implementation 2014-01-14 23:53:24 +01:00
thefiddler
fb917a6d89 [Linux] Implemented joystick hotplugging 2014-01-14 23:51:31 +01:00
thefiddler
4ca8c78764 [OpenTK] Suggest alternative to obsolete INativeWindow.InputDriver property 2014-01-14 23:40:23 +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.
b004dc7a0a [X11] Added INotify.cs to project files 2014-01-14 18:36:36 +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
962a9f7733 Merge branch 'issue43_unstablefps' into develop 2014-01-14 14:21:19 +01:00
Stefanos A.
0c9b612bff [OpenTK] Increase max Update/RenderFrame rates
Given the new 144Hz monitors on the market today, it makes sense to
increase the Update/RenderFrame limit from 200Hz to 500Hz.
2014-01-14 14:20:38 +01:00
Stefanos A.
1f44cf27a1 [OpenTK] Do not hang when update rate too high
OpenTK will now detect when an UpdateFrame handler is consistently
taking too long to finish, and stop raising UpdateFrame events. This
gives ProcessEvents() a chance to execute and will protect the
application from hanging up.
2014-01-14 13:55:24 +01:00