From 3a8ad733a4564167716a65cca56e8ec3ce832747 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Mon, 11 May 2020 01:20:23 +0200 Subject: [PATCH] Enabled VSync & added setting. --- cmd/tins2020/tins2020.go | 7 +++++++ settings.go | 1 + 2 files changed, 8 insertions(+) diff --git a/cmd/tins2020/tins2020.go b/cmd/tins2020/tins2020.go index 602d830..71de9b8 100644 --- a/cmd/tins2020/tins2020.go +++ b/cmd/tins2020/tins2020.go @@ -47,7 +47,14 @@ func run() error { if ctx.Settings.Window.Size == nil { ctx.Settings.Window.Size = tins2020.PtPtr(800, 600) } + if ctx.Settings.Window.VSync == nil { + vsync := true + ctx.Settings.Window.VSync = &vsync + } + if *ctx.Settings.Window.VSync { + sdl.SetHint(sdl.HINT_RENDER_VSYNC, "1") + } sdl.SetHint(sdl.HINT_RENDER_SCALE_QUALITY, "1") window, err := sdl.CreateWindow("TINS 2020", ctx.Settings.Window.Location.X, ctx.Settings.Window.Location.Y, diff --git a/settings.go b/settings.go index 2b58fff..5223811 100644 --- a/settings.go +++ b/settings.go @@ -32,4 +32,5 @@ func (s *Settings) Store() error { type WindowSettings struct { Location *Point Size *Point + VSync *bool }