oakes / play-clj

A Clojure game library
The Unlicense
940 stars 72 forks source link

(color :white) works but (color arg) where arg is passed in from function doesnt #93

Closed renl closed 7 years ago

renl commented 8 years ago

Seem like by defining color as a macro, it does not allow the argument of color to be passed in from another function as you check it as keyword.

so (def white-color :white) (color white-color) does not work. Not sure if there a better way.

oakes commented 8 years ago

Correct, it requires compile-time manipulation to turn it into the right static field. Could you do something like (def white-color (color :white)) instead?

renl commented 8 years ago

i suppose, I intended to have a create entity helper function where i can specific the color, so in this case the argument for the color in the helper function is kinda a function instead of a keyword.

boogie666 commented 7 years ago

quick (slightly late) question. Does color have to be a macro? why not just a function?

oakes commented 7 years ago

It may be possible to do what we did with key-code and turn it into a function by using eval. I'll look into it when I have the time.

oakes commented 7 years ago

Color is now a function: d4ff20ef086e4533d1d147fba885cf448bc3c1fa

boogie666 commented 7 years ago

Yey :) much nicer. Thx