summary refs log tree commit diff
path: root/lib/state.fnl
blob: a0ddd11792799de5d83348c065f8c1d13a714b7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;; 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)
 :keypressed (proto.meta-method-opt :state.keypressed)
 :mousepressed (proto.meta-method-opt :state.mousepressed)
 }