summary refs log tree commit diff
path: root/lib/state.fnl
diff options
Diffstat (limited to 'lib/state.fnl')
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/state.fnl b/lib/state.fnl
new file mode 100644
index 0000000..d98b94e
--- /dev/null
+++ b/lib/state.fnl
@@ -0,0 +1,19 @@
+;; later if it becomes a hassle we can convert this into a separate
+;; file that we can reload or something
+(local proto (require :lib.proto))
+ :init (proto.table-method :state.init)
+ ;; update is a bit special; it can either return nothing (the state continues
+ ;; as is, and mutated somehow (sorry we're doing things non-purely; i'd like
+ ;; to do them purely but creating tables is slow as heck that'd be ridiculous))
+ ;; or it can return a state that it transitions to automatically
+ ;; game pausing basically works like that: it returns a pause structure with the
+ ;; regular state within its object, and then the pause structure uses that state
+ ;; object to return back to it later. pretty cool!
+ :update (proto.meta-method-opt :state.update)
+ ;; all of the next functions are just. regular love functions, exactly the same
+ ;; i hope
+ :draw (proto.meta-method-opt :state.draw)
+ }