Add VSync setting.

This commit is contained in:
Paul Chote
2019-12-08 20:47:08 +00:00
committed by teinarss
parent 959c750851
commit 656a260171
9 changed files with 56 additions and 8 deletions

View File

@@ -49,6 +49,7 @@ namespace OpenRA.Platforms.Default
Action<object> doDrawPrimitives;
Action<object> doEnableScissor;
Action<object> doSetBlendMode;
Action<object> doSetVSync;
public ThreadedGraphicsContext(Sdl2GraphicsContext context, int batchSize)
{
@@ -107,6 +108,7 @@ namespace OpenRA.Platforms.Default
context.EnableScissor(t.Item1, t.Item2, t.Item3, t.Item4);
};
doSetBlendMode = mode => { context.SetBlendMode((BlendMode)mode); };
doSetVSync = enabled => { context.SetVSyncEnabled((bool)enabled); };
Monitor.Pulse(syncObject);
}
@@ -445,6 +447,11 @@ namespace OpenRA.Platforms.Default
{
Post(doSetBlendMode, mode);
}
public void SetVSyncEnabled(bool enabled)
{
Post(doSetVSync, enabled);
}
}
class ThreadedFrameBuffer : IFrameBuffer