target FPS
This commit is contained in:
parent
1ce9c49086
commit
6f9e0a934f
2 changed files with 11 additions and 1 deletions
|
|
@ -172,15 +172,18 @@ Functions for evaluating the render queues. ~evaluate-render-queue~ evaluates a
|
||||||
#+begin_src
|
#+begin_src
|
||||||
*window-size*
|
*window-size*
|
||||||
*window-title*
|
*window-title*
|
||||||
|
*target-fps*
|
||||||
#+end_src
|
#+end_src
|
||||||
~*window-size*~ is a parameter that expects a cons pair of two integers, where the first integer is the window width, and the second is the window height.
|
~*window-size*~ is a parameter that expects a cons pair of two integers, where the first integer is the window width, and the second is the window height.
|
||||||
|
|
||||||
~*window-title*~ is a parameter that expects a string, which is used for the window title.
|
~*window-title*~ is a parameter that expects a string, which is used for the window title.
|
||||||
|
|
||||||
|
~*target-fps*~ is a parameter that expects an integer, which specifies the desired frames per second to run at.
|
||||||
|
|
||||||
#+begin_src scheme
|
#+begin_src scheme
|
||||||
(create-window process: (next-frame) close-predicate: (window-should-close?))
|
(create-window process: (next-frame) close-predicate: (window-should-close?))
|
||||||
#+end_src
|
#+end_src
|
||||||
~create-window~ creates a window using the window parameters described above, then enters a loop which runs the ~process:~ function (~next-frame~ by default) on each frame, unless ~close-predicate:~ (Raylib's ~window-should-close~ function by default) returns true, in which case the window is closed.
|
~create-window~ creates a window using the window parameters described above, sets the target frames per second, then enters a loop which runs the ~process:~ function (~next-frame~ by default) on each frame, unless ~close-predicate:~ (Raylib's ~window-should-close~ function by default) returns true, in which case the window is closed.
|
||||||
|
|
||||||
* Dependencies
|
* Dependencies
|
||||||
The following Chicken dependencies are required:
|
The following Chicken dependencies are required:
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@
|
||||||
(hash-table-ref world id))
|
(hash-table-ref world id))
|
||||||
|
|
||||||
;; Create an entity in the world and return it's 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)
|
(define (create-named-entity id . components)
|
||||||
(assert (symbol? id))
|
(assert (symbol? id))
|
||||||
(assert (every record? components))
|
(assert (every record? components))
|
||||||
|
|
@ -443,8 +444,14 @@
|
||||||
(define *window-title* (guarded-parameter "imugi"
|
(define *window-title* (guarded-parameter "imugi"
|
||||||
string?))
|
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?))
|
(define (create-window #!key (process next-frame) (close-predicate window-should-close?))
|
||||||
(init-window (car (*window-size*)) (cdr (*window-size*)) (*window-title*))
|
(init-window (car (*window-size*)) (cdr (*window-size*)) (*window-title*))
|
||||||
|
(set-target-fps (*target-fps*))
|
||||||
(let loop ()
|
(let loop ()
|
||||||
(process)
|
(process)
|
||||||
(unless (close-predicate)
|
(unless (close-predicate)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue