committed by
GitHub
13 changed files with 228 additions and 39 deletions
@ -0,0 +1,18 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Avalonia.OpenGL |
|||
{ |
|||
public class AngleOptions |
|||
{ |
|||
public enum PlatformApi |
|||
{ |
|||
DirectX9, |
|||
DirectX11 |
|||
} |
|||
|
|||
public List<PlatformApi> AllowedPlatformApis = new List<PlatformApi> |
|||
{ |
|||
PlatformApi.DirectX9 |
|||
}; |
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.Reactive.Disposables; |
|||
using Avalonia.Threading; |
|||
|
|||
namespace Avalonia.Rendering |
|||
{ |
|||
/// <summary>
|
|||
/// Render timer that ticks on UI thread. Useful for debugging or bootstrapping on new platforms
|
|||
/// </summary>
|
|||
|
|||
public class UiThreadRenderTimer : DefaultRenderTimer |
|||
{ |
|||
public UiThreadRenderTimer(int framesPerSecond) : base(framesPerSecond) |
|||
{ |
|||
} |
|||
|
|||
protected override IDisposable StartCore(Action<TimeSpan> tick) |
|||
{ |
|||
bool cancelled = false; |
|||
var st = Stopwatch.StartNew(); |
|||
DispatcherTimer.Run(() => |
|||
{ |
|||
if (cancelled) |
|||
return false; |
|||
tick(st.Elapsed); |
|||
return !cancelled; |
|||
}, TimeSpan.FromSeconds(1.0 / FramesPerSecond), DispatcherPriority.Render); |
|||
return Disposable.Create(() => cancelled = true); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue