Browse Source

Allow customizing the framebuffer FPS.

pull/6652/head
Steven Kirk 5 years ago
parent
commit
23dcab47d4
  1. 6
      src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs
  2. 14
      src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs

6
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs

@ -37,15 +37,17 @@ namespace Avalonia.LinuxFramebuffer
Threading = new InternalPlatformThreadingInterface();
if (_fb is IGlOutputBackend gl)
AvaloniaLocator.CurrentMutable.Bind<IPlatformOpenGlInterface>().ToConstant(gl.PlatformOpenGlInterface);
var opts = AvaloniaLocator.Current.GetService<LinuxFramebufferPlatformOptions>();
AvaloniaLocator.CurrentMutable
.Bind<IPlatformThreadingInterface>().ToConstant(Threading)
.Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(60))
.Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(opts?.Fps ?? 60))
.Bind<IRenderLoop>().ToConstant(new RenderLoop())
.Bind<ICursorFactory>().ToTransient<CursorFactoryStub>()
.Bind<IKeyboardDevice>().ToConstant(new KeyboardDevice())
.Bind<IPlatformSettings>().ToSingleton<PlatformSettings>()
.Bind<PlatformHotkeyConfiguration>().ToSingleton<PlatformHotkeyConfiguration>();
}

14
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs

@ -0,0 +1,14 @@
namespace Avalonia.LinuxFramebuffer
{
/// <summary>
/// Platform-specific options which apply to the Linux framebuffer.
/// </summary>
public class LinuxFramebufferPlatformOptions
{
/// <summary>
/// Gets or sets the number of frames per second at which the renderer should run.
/// Default 60.
/// </summary>
public int Fps { get; set; } = 60;
}
}
Loading…
Cancel
Save