use output width/height instead of hardcoding

main
Daniel Barlow 2022-07-01 22:08:15 +00:00
parent 69753c2345
commit 1875b87592
1 changed files with 8 additions and 7 deletions

15
rc.fnl
View File

@ -18,30 +18,31 @@
"output" "output"
(fn [output] (fn [output]
(output:set_mode 360 720 0) (output:set_mode 360 720 0)
(let [r (output:renderer) (let [[width height] (output:size)
r (output:renderer)
kill (texture.from-file r "close-window.png") kill (texture.from-file r "close-window.png")
launch (texture.from-file r "launcher.png") launch (texture.from-file r "launcher.png")
spinner (texture.from-file r "carousel.png")] spinner (texture.from-file r "carousel.png")]
(output:on "render" (output:on "render"
(fn [{: output : renderer}] (fn [{: output : renderer}]
(let [bar-height 40] (let [bar-height (/ height 15)]
(renderer:draw_rect :#00000077 (renderer:draw_rect :#00000077
0 (- 720 bar-height) 0 (- height bar-height)
690 360 bar-height) width bar-height)
(renderer:draw_texture (renderer:draw_texture
kill kill
matrix.identity matrix.identity
30 (- 720 bar-height) 30 (- height bar-height)
0.7) 0.7)
(renderer:draw_texture (renderer:draw_texture
launch launch
matrix.identity matrix.identity
(- 180 (/ bar-height 2)) (- 720 bar-height) (- (/ width 2) (/ bar-height 2)) (- height bar-height)
0.7) 0.7)
(renderer:draw_texture (renderer:draw_texture
spinner spinner
matrix.identity matrix.identity
(- 360 30 bar-height) (- 720 bar-height) (- width 30 bar-height) (- height bar-height)
0.7))))))) 0.7)))))))
(fn kill-window [] (fn kill-window []