summary refs log tree commit diff
path: root/lib/main.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/main.fnl')
-rw-r--r--lib/main.fnl9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/main.fnl b/lib/main.fnl
index 4a4de12..e88f704 100644
--- a/lib/main.fnl
+++ b/lib/main.fnl
@@ -2,6 +2,7 @@
 (local proto (require :lib.proto))
 (local state (require :lib.state))
 (local game (require :lib.game))
+(local music (require :lib.music))
 (local font (require :lib.font))
 (local profi (require :vendor.ProFi))
 (local profi? false)
@@ -12,6 +13,7 @@
 ;; TODO: ^
 (local hotswap-modules
   [:lib.player
+   :lib.music
    :lib.translation
    :lib.bullet
    :lib.cells
@@ -23,6 +25,7 @@
 ;; oh thats why it doesnt work lmao
 
 (fn love.load []
+  (music.load)
   (when profi?
     (profi:start)
     (set love.frame 0))
@@ -39,7 +42,7 @@
                 (love.graphics.print (.. "draw: \n" x))))
   (love.graphics.reset)
   ;; (love.graphics.setFont font.small)
-  (love.graphics.print (love.timer.getFPS))
+  ;; (love.graphics.print (love.timer.getFPS))
   ;; (love.graphics.print :soko font.big 100 100)
   (when true ;; debug stuff
     (love.graphics.print (table.concat
@@ -53,6 +56,7 @@
           (set v.ticks (- v.ticks 1))))))
 
 (fn love.update []
+  (music.pre-update)
   (when profi?
     (profi:startHooks)
     (set love.frame (+ love.frame 1))
@@ -69,10 +73,13 @@
                 (table.insert messages
                               {:ticks 1
                                :msg (.. "update: \n" x)})))
+  (music.update)
   (when profi?
     (profi:stopHooks)))
 
 (fn love.keypressed [key scancode repeat]
+  (when (and (= key "f") (not repeat))
+    (love.window.setFullscreen (not (love.window.getFullscreen))))
   (match (pcall #(state.keypressed the-state key scancode repeat))
     (true x) nil
     (false x) (do