Browse Source
* I had to make changes to remove unnecessary global includes, which caused command changes on files across projects * Added Math.cake, which revealed a problem in macro evaluation (delimiters need to be part of the context when evaluating macros after the first evaluation)pitch-detection
6 changed files with 36 additions and 6 deletions
@ -1 +1 @@ |
|||
Subproject commit 56869ad3d6d7bf315e493b897cd1687947e1aad1 |
|||
Subproject commit 9f0a8965b9777b353c22f7c118526fb6df50909f |
@ -0,0 +1,28 @@ |
|||
;; Math.cake: Common game math |
|||
(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src") |
|||
|
|||
(c-import "<stdio.h>") |
|||
|
|||
(defstruct vec3 |
|||
x float |
|||
y float |
|||
z float) |
|||
|
|||
;; Expand vector to each of its components |
|||
(defmacro vec3-expand (vec symbol) |
|||
(tokenize-push output |
|||
(field (token-splice vec) x) |
|||
(field (token-splice vec) y) |
|||
(field (token-splice vec) z)) |
|||
(return true)) |
|||
|
|||
(defun test--math (&return int) |
|||
(var my-vec vec3 (array 1.f 2.f 3.f)) |
|||
;; TODO: ExpressionList delimiter is lost because macro expansion uses different evaluate all |
|||
;; (printf "%f %f %f\n" (vec3-expand my-vec)) |
|||
(printf "%f %f %f\n" (field my-vec x) |
|||
(field my-vec y) |
|||
(field my-vec z)) |
|||
(return 0)) |
|||
|
|||
(add-build-config-label "Math") |
Loading…
Reference in new issue