Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/boomer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,14 @@ proc main() =
case key
of XK_EQUAL: scrollUp()
of XK_MINUS: scrollDown()
of XK_h, XK_Left:
camera.position.x = camera.position.x - config.camera_speed
of XK_j, XK_Down:
camera.position.y = camera.position.y + config.camera_speed
of XK_k, XK_Up:
camera.position.y = camera.position.y - config.camera_speed
of XK_l, XK_Right:
camera.position.x = camera.position.x + config.camera_speed
of XK_0:
camera.scale = 1.0
camera.deltaScale = 0.0
Expand Down
5 changes: 5 additions & 0 deletions src/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ type Config* = object
scroll_speed*: float
drag_friction*: float
scale_friction*: float
camera_speed*: float

const defaultConfig* = Config(
min_scale: 0.01,
scroll_speed: 1.5,
drag_friction: 6.0,
scale_friction: 4.0,
camera_speed: 20.0,
)

proc loadConfig*(filePath: string): Config =
Expand All @@ -31,6 +33,8 @@ proc loadConfig*(filePath: string): Config =
result.drag_friction = parseFloat(value)
of "scale_friction":
result.scale_friction = parseFloat(value)
of "camera_speed":
result.camera_speed = parseFloat(value)
else:
quit "Unknown config key `$#`" % [key]

Expand All @@ -41,3 +45,4 @@ proc generateDefaultConfig*(filePath: string) =
f.write("scroll_speed = ", defaultConfig.scroll_speed, "\n")
f.write("drag_friction = ", defaultConfig.drag_friction, "\n")
f.write("scale_friction = ", defaultConfig.scale_friction, "\n")
f.write("camera_speed = ", defaultConfig.camera_speed, "\n")