markmandel / brute

A simple and lightweight Entity Component System library for writing games with Clojure and ClojureScript.
Eclipse Public License 1.0
181 stars 6 forks source link

added update component function #2

Closed icm-yairiny closed 10 years ago

icm-yairiny commented 10 years ago

this way, the components themselves can be immutable.

markmandel commented 10 years ago

Although you can change out components just be reusing add-component as you have done, this gives you a nice functional alternative. I like it.

Before I can merge this in, I need a test for it please :smile:

icm-yairiny commented 10 years ago

Now with unit test :)

markmandel commented 10 years ago

Awesome! Looks great. I'll pull it down shortly, test it out and merge it in. Thanks!

markmandel commented 10 years ago

This has been merged into the develop branch, and will go out in the next release (which I'm thinking I may do soon).

I'm debating the pros of having the option of returning nil from the fn to skip changing the component. In theory, you could just return the component instance without any changes, but this way, you could avoid some unneeded processing. What do you think of that idea?

icm-yairiny commented 10 years ago

Yeah, that sounds like a good idea. Otherwise, in my original implementation, returning nil would possibly break the data.

markmandel commented 10 years ago

Fix for nil is in develop now.