target FPS

This commit is contained in:
BirDt_ 2026-04-04 14:36:40 +08:00
parent 1ce9c49086
commit 6f9e0a934f
2 changed files with 11 additions and 1 deletions

View file

@ -111,6 +111,7 @@
(hash-table-ref world id))
;; Create an entity in the world and return it's ID
;; TODO: consider whether we want to use a hash-table for the entity list. I'm not sure yet how punishing O(n) lookup will be here, so it might be sometihng to look at once we start handling entity execution
(define (create-named-entity id . components)
(assert (symbol? id))
(assert (every record? components))
@ -443,8 +444,14 @@
(define *window-title* (guarded-parameter "imugi"
string?))
;; Desired FPS count
(define *target-fps* (guarded-parameter 60
integer?))
;; Make a window with the above parameters and default processing and predicate
(define (create-window #!key (process next-frame) (close-predicate window-should-close?))
(init-window (car (*window-size*)) (cdr (*window-size*)) (*window-title*))
(set-target-fps (*target-fps*))
(let loop ()
(process)
(unless (close-predicate)