mirror of
https://github.com/tsoding/boomer
synced 2024-11-16 12:12:47 +00:00
(#39) Unhardcode refresh rate
This commit is contained in:
parent
de52f98371
commit
f0ea6a8fec
@ -286,6 +286,7 @@ proc main() =
|
||||
isEnabled: false,
|
||||
radius: 200.0)
|
||||
|
||||
let dt = 1.0 / rate.float
|
||||
while not quitting:
|
||||
var wa: TXWindowAttributes
|
||||
discard XGetWindowAttributes(display, win, addr wa)
|
||||
@ -308,7 +309,7 @@ proc main() =
|
||||
# delta is the distance the mouse traveled in a single
|
||||
# frame. To turn the velocity into units/second we need to
|
||||
# multiple it by FPS.
|
||||
camera.velocity = delta * config.fps.float
|
||||
camera.velocity = delta * rate.float
|
||||
|
||||
mouse.prev = mouse.curr
|
||||
|
||||
@ -383,7 +384,6 @@ proc main() =
|
||||
else:
|
||||
discard
|
||||
|
||||
let dt = 1.0 / config.fps.float
|
||||
camera.update(config, dt, mouse, screenshot,
|
||||
vec2(wa.width.float32, wa.height.float32))
|
||||
flashlight.update(dt)
|
||||
@ -393,5 +393,6 @@ proc main() =
|
||||
mouse, flashlight)
|
||||
|
||||
glXSwapBuffers(display, win)
|
||||
glFinish()
|
||||
|
||||
main()
|
||||
|
@ -4,13 +4,11 @@ type Config* = object
|
||||
scrollSpeed*: float
|
||||
dragFriction*: float
|
||||
scaleFriction*: float
|
||||
fps*: int
|
||||
|
||||
const defaultConfig* = Config(
|
||||
scrollSpeed: 1.5,
|
||||
dragFriction: 6.0,
|
||||
scaleFriction: 4.0,
|
||||
fps: 60
|
||||
)
|
||||
|
||||
macro parseObject(obj: typed, key, val: string) =
|
||||
|
@ -1,4 +1,3 @@
|
||||
import math
|
||||
import config
|
||||
import la
|
||||
import image
|
||||
|
Loading…
Reference in New Issue
Block a user