Class Utils
A collection of utility functions exposed by OpenTK.
Assembly: OpenTK.Core.dll
Syntax
public static class Utils
Methods
AccurateSleep(double, int)
A method for accurate sleep times.
This function will favour accuracy over efficiency and spin wait if it's unsure a sleep will wake in time.
This is useful when implementing a run-loop with accurate timings.
Declaration
public static void AccurateSleep(double seconds, int expectedSchedulerPeriod)
Parameters
Type |
Name |
Description |
double |
seconds |
The number of seconds to sleep for.
|
int |
expectedSchedulerPeriod |
The expected scheduler period in milliseconds. Can also be seen as the expected sleep time of Thread.Sleep(1) .
Set on windows using timeBeginPeriod() .
|
AsPtr(ReadOnlySpan<byte>)
Declaration
public static byte* AsPtr(ReadOnlySpan<byte> span)
Parameters
Returns
FromTszString(char*, int)
Declaration
public static string FromTszString(char* ptr, int max_length)
Parameters
Type |
Name |
Description |
char* |
ptr |
|
int |
max_length |
|
Returns
ToSpan(byte*)
Declaration
public static ReadOnlySpan<byte> ToSpan(byte* str)
Parameters
Type |
Name |
Description |
byte* |
str |
|
Returns