Skip to content

Commit

Permalink
Updated component creation with new cross platform component creation
Browse files Browse the repository at this point in the history
  • Loading branch information
NogginBops committed Jan 16, 2023
1 parent 846ad11 commit 30dd3ff
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions learn/pal2/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ PAL2 exposes platform APIs through a number of interfaces used to abstract away
The first of these interfaces we are going to see is `IWindowComponent` and `IOpenGLComponent` which allows the user to
create and interact with windows as well as initialize an OpenGL context and draw graphics to the window.

> [!NOTE]
> Currently there is no way for OpenTK to automatically initialize these interfaces to the correct platform implementations, this capability will be available in the future.
The following code initializes these interfaces with a windows implementation.
The following code initializes these interfaces with a platform dependent implementation (or throws `NotSupportedException` for not yet supported OSes).
```cs
IWindowComponent windowComp = new OpenTK.Platform.Native.Windows.WindowComponent();
IOpenGLComponent openglComp = new OpenTK.Platform.Native.Windows.OpenGLComponent();
IWindowComponent windowComp = new OpenTK.Platform.Native.PlatformComponents.CreateWindowComponent();
IOpenGLComponent openglComp = new OpenTK.Platform.Native.PlatformComponents.CreateOpenGLComponent();

windowComp.Initialize(PalComponents.Window);
openglComp.Initialize(PalComponents.OpenGL);
Expand Down

0 comments on commit 30dd3ff

Please sign in to comment.