View rand.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
private static volatile int RandomSeed = 1; | |
private static int FastRand() | |
{ | |
retry: | |
int oldSeed = RandomSeed; | |
int newSeed = unchecked(oldSeed * 1103515245 + 12345); | |
if (Interlocked.CompareExchange(ref RandomSeed, newSeed, oldSeed) != oldSeed) | |
goto retry; |
View TimedGameWindow.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
using System; | |
using System.Runtime.InteropServices; | |
using System.Threading; | |
using OpenTK.Windowing.Common; | |
using OpenTK.Windowing.Desktop; | |
// Define this if you're running on Microsoft Windows, which supports | |
// high-precision sleep timers. Enabling this can result in better CPU usage | |
// and power usage if your program doesn't need the CPU fully in every frame. | |
#define HIGH_PRECISION_SLEEP |
View HighPrecisionSleep.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
using System; | |
using System.Runtime.InteropServices; | |
public class HighPrecisionSleep : IDisposable | |
{ | |
private IntPtr _waitableTimerHandle; | |
public HighPrecisionSleep() | |
{ | |
_waitableTimerHandle = Win32.CreateWaitableTimer(IntPtr.Zero, true, null); |
View . OpenTK.Mathematics.csproj.diff
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
diff --git a/src/OpenTK.Mathematics/OpenTK.Mathematics.csproj b/src/OpenTK.Mathematics/OpenTK.Mathematics.csproj | |
index b2f0466db..704323b26 100644 | |
--- a/src/OpenTK.Mathematics/OpenTK.Mathematics.csproj | |
+++ b/src/OpenTK.Mathematics/OpenTK.Mathematics.csproj | |
@@ -1,13 +1,21 @@ | |
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
- <TargetFrameworks>netstandard2.1;netcoreapp3.1</TargetFrameworks> | |
+ <TargetFrameworks>netstandard2.1;netcoreapp3.1;netstandard2.0</TargetFrameworks> | |
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |