forked from space-wizards/RobustToolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to GLFW for windowing (space-wizards#914)
* Use GLFW instead of OpenTK windows * Seems to work pretty well now. * Fix stackalloc issue on Framework. * Add GLFW project to sln. * Fix package downgrade. * Fix SLN more. * Please work. * Fix C# version error.
- Loading branch information
Showing
82 changed files
with
9,108 additions
and
931 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Cursor.cs | ||
// | ||
// Copyright (C) 2019 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// Opaque handle to a GLFW cursor. | ||
/// </summary> | ||
public struct Cursor | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// ClientApi.cs | ||
// | ||
// Copyright (C) 2019 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// The context client APIs. | ||
/// </summary> | ||
/// <seealso cref="GLFW.WindowHint(WindowHintClientApi,ClientApi)"/> | ||
public enum ClientApi | ||
{ | ||
/// <summary> | ||
/// No context API is created. | ||
/// </summary> | ||
NoApi = 0, | ||
|
||
/// <summary> | ||
/// OpenGL context is created. | ||
/// </summary> | ||
OpenGlApi = 0x00030001, | ||
|
||
/// <summary> | ||
/// OpenGL ES context is created. | ||
/// </summary> | ||
OpenGlEsApi = 0x00030002 | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
OpenToolkit.GraphicsLibraryFramework/Enums/ConnectedState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// ConnectedState.cs | ||
// | ||
// Copyright (C) 2019 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// Specifies connected state of devices. | ||
/// </summary> | ||
public enum ConnectedState | ||
{ | ||
/// <summary> | ||
/// Indicates that a device is connected. | ||
/// </summary> | ||
Connected = 0x00040001, | ||
|
||
/// <summary> | ||
/// Indicates that a device is disconnected. | ||
/// </summary> | ||
Disconnected = 0x00040002 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// ContextApi.cs | ||
// | ||
// Copyright (C) 2019 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// The context API used to create the window context. | ||
/// </summary> | ||
public enum ContextApi | ||
{ | ||
/// <summary> | ||
/// Uses the native context API to create the window context. | ||
/// </summary> | ||
NativeContextApi = 0x00036001, | ||
|
||
/// <summary> | ||
/// Uses Egl to create the window context. | ||
/// </summary> | ||
EglContextApi = 0x00036002 | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
OpenToolkit.GraphicsLibraryFramework/Enums/CursorModeValue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// CursorModeValue.cs | ||
// | ||
// Copyright (C) 2018 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// The GLFW cursor modes. | ||
/// See <a href="https://www.glfw.org/docs/latest/input_guide.html#cursor_mode">cursor modes</a>. | ||
/// </summary> | ||
public enum CursorModeValue | ||
{ | ||
/// <summary> | ||
/// The regular arrow cursor (or another cursor set with <see cref="GLFW.SetCursor"/>) is used | ||
/// and cursor motion is not limited. | ||
/// </summary> | ||
CursorNormal = 0x00034001, | ||
|
||
/// <summary> | ||
/// Hides the arrow cursor when over a window. | ||
/// </summary> | ||
CursorHidden = 0x00034002, | ||
|
||
/// <summary> | ||
/// Will hide the cursor and lock it to the specified window. | ||
/// GLFW will then take care of all the details of cursor re-centering and offset calculation | ||
/// and providing the application with a virtual cursor position. | ||
/// This virtual position is provided normally via both the cursor position callback and through polling. | ||
/// </summary> | ||
CursorDisabled = 0x00034003 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// CursorShape.cs | ||
// | ||
// Copyright (C) 2019 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// Standard cursor shapes. | ||
/// </summary> | ||
public enum CursorShape | ||
{ | ||
/// <summary> | ||
/// The standard arrow shape. Used in almost all situations. | ||
/// </summary> | ||
Arrow = 0x00036001, | ||
|
||
/// <summary> | ||
/// The I-Beam shape. Used when mousing over a place where text can be entered. | ||
/// </summary> | ||
IBeam = 0x00036002, | ||
|
||
/// <summary> | ||
/// The crosshair shape. Used when dragging and dropping. | ||
/// </summary> | ||
Crosshair = 0x00036003, | ||
|
||
/// <summary> | ||
/// The hand shape. Used when mousing over something that can be dragged around. | ||
/// </summary> | ||
Hand = 0x00036004, | ||
|
||
/// <summary> | ||
/// The horizontal resize shape. Used when mousing over something that can be horizontally resized. | ||
/// </summary> | ||
HResize = 0x00036005, | ||
|
||
/// <summary> | ||
/// The vertical resize shape. Used when mousing over something that can be vertically resized. | ||
/// </summary> | ||
VResize = 0x00036006 | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
OpenToolkit.GraphicsLibraryFramework/Enums/CursorStateAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// CursorStateAttribute.cs | ||
// | ||
// Copyright (C) 2018 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// Attribute for setting <see cref="CursorModeValue"/> of the cursor. | ||
/// </summary> | ||
/// <seealso cref="GLFW.SetInputMode(Window*,CursorStateAttribute,CursorModeValue)"/> | ||
/// <seealso cref="GLFW.GetInputMode(Window*,CursorStateAttribute)"/> | ||
public enum CursorStateAttribute | ||
{ | ||
/// <summary> | ||
/// Attribute for setting <see cref="CursorModeValue"/> of the cursor. | ||
/// </summary> | ||
Cursor = 0x00033001, | ||
} | ||
} |
103 changes: 103 additions & 0 deletions
103
OpenToolkit.GraphicsLibraryFramework/Enums/ErrorCode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// | ||
// ErrorCode.cs | ||
// | ||
// Copyright (C) 2019 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// Error codes, used in the error callback. | ||
/// </summary> | ||
public enum ErrorCode | ||
{ | ||
/// <summary> | ||
/// Everything is running as intended. Yay! | ||
/// </summary> | ||
NoError = 0, | ||
|
||
/// <summary> | ||
/// Called a function before calling <see cref="GLFW.Init"/>. Initialize GLFW and then try again. | ||
/// </summary> | ||
NotInitialized = 0x00010001, | ||
|
||
/// <summary> | ||
/// No OpenGL/OpenGL ES context on this thread. | ||
/// </summary> | ||
NoContext = 0x00010002, | ||
|
||
/// <summary> | ||
/// Used an invalid enum value on a function. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// This should hopefully never happen in the bindings, due to the added type safety of C# enums VS. GLFW's native #defines | ||
/// </para> | ||
/// </remarks> | ||
InvalidEnum = 0x00010003, | ||
|
||
/// <summary> | ||
/// Called a function with an invalid argument. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// This can happen if you request an OpenGL version that doesn't exist, like 2.7. | ||
/// </para> | ||
/// <para> | ||
/// If you request a version of OpenGL that exists, but isn't supported by this graphics card, it will return VersionUnavailable instead. | ||
/// </para> | ||
/// </remarks> | ||
InvalidValue = 0x00010004, | ||
|
||
/// <summary> | ||
/// A memory allocation failed on GLFW's end. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// Report this to the GLFW issue tracker if encountered. | ||
/// </para> | ||
/// </remarks> | ||
OutOfMemory = 0x00010005, | ||
|
||
/// <summary> | ||
/// The requested API is not available on the system. | ||
/// </summary> | ||
ApiUnavailable = 0x00010006, | ||
|
||
/// <summary> | ||
/// The requested OpenGL version is not available on the system. | ||
/// </summary> | ||
VersionUnavailable = 0x00010007, | ||
|
||
/// <summary> | ||
/// A platform-specific error occurred that doesn't fit into any more specific category. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// Report this to the GLFW issue tracker if encountered. | ||
/// </para> | ||
/// </remarks> | ||
PlatformError = 0x00010008, | ||
|
||
/// <summary> | ||
/// The requested format is unavailable. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// If emitted during window creation, the requested pixel format isn't available. | ||
/// </para> | ||
/// <para> | ||
/// If emitted when using the clipboard, the contents of the clipboard couldn't be converted to the requested format. | ||
/// </para> | ||
/// </remarks> | ||
FormatUnavailable = 0x00010009, | ||
|
||
/// <summary> | ||
/// There is no OpenGL/OpenGL ES context attached to this window. | ||
/// </summary> | ||
NoWindowContext = 0x0001000A | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
OpenToolkit.GraphicsLibraryFramework/Enums/InitHintBool.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// InitHint.cs | ||
// | ||
// Copyright (C) 2019 OpenTK | ||
// | ||
// This software may be modified and distributed under the terms | ||
// of the MIT license. See the LICENSE file for details. | ||
// | ||
|
||
namespace OpenToolkit.GraphicsLibraryFramework | ||
{ | ||
/// <summary> | ||
/// Initialization hints are set before <see cref="GLFW.Init"/> and affect how the library behaves until termination. | ||
/// Hints are set with <see cref="GLFW.InitHint(InitHintBool, bool)"/>. | ||
/// </summary> | ||
public enum InitHintBool | ||
{ | ||
/// <summary> | ||
/// Used to specify whether to also expose joystick hats as buttons, | ||
/// for compatibility with earlier versions of GLFW that did not have | ||
/// <see cref="GLFW.GetJoystickHats"/>. | ||
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>. | ||
/// </summary> | ||
JoystickHatButtons = 0x00050001, | ||
|
||
/// <summary> | ||
/// Used to specify whether to set the current directory to the application to the Contents/Resources | ||
/// subdirectory of the application's bundle, if present. | ||
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>. | ||
/// </summary> | ||
/// <remarks> | ||
/// Only affects macOS; no effect on other platforms. | ||
/// </remarks> | ||
CocoaChdirResources = 0x00051001, | ||
|
||
/// <summary> | ||
/// Used to specify whether to create a basic menu bar, either from a nib or manually, | ||
/// when the first window is created, which is when AppKit is initialized. | ||
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>. | ||
/// </summary> | ||
/// <remarks> | ||
/// Only affects macOS; no effect on other platforms. | ||
/// </remarks> | ||
CocoaMenubar = 0x00051002 | ||
} | ||
} |
Oops, something went wrong.