Enabled VSync & added setting.

This commit is contained in:
Sander Schobers 2020-05-11 01:20:23 +02:00
parent a07d3c1c82
commit 3a8ad733a4
2 changed files with 8 additions and 0 deletions

View File

@ -47,7 +47,14 @@ func run() error {
if ctx.Settings.Window.Size == nil { if ctx.Settings.Window.Size == nil {
ctx.Settings.Window.Size = tins2020.PtPtr(800, 600) 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") sdl.SetHint(sdl.HINT_RENDER_SCALE_QUALITY, "1")
window, err := sdl.CreateWindow("TINS 2020", window, err := sdl.CreateWindow("TINS 2020",
ctx.Settings.Window.Location.X, ctx.Settings.Window.Location.Y, ctx.Settings.Window.Location.X, ctx.Settings.Window.Location.Y,

View File

@ -32,4 +32,5 @@ func (s *Settings) Store() error {
type WindowSettings struct { type WindowSettings struct {
Location *Point Location *Point
Size *Point Size *Point
VSync *bool
} }