As posted in #announcements I've cut a first release of cljbox2d. This is a library I put a bunch of work in a bit over a year ago, but haven't really touched since then. The story is: my nephew wanted to make a game, so I started teaching him some Clojure and Quil, and started looking into how to add some more game-enginy capabilities to Quil. That's how cljbox2d came about. Then it turned out it had (for reasons) be a browser based game, so I made cljbox2d cljc compatible. In the end we ended up making a point-and-click adventure game, for which you really don't need any physics, and I went with Pixi.js instead, which became another wrapper libary (lambdaisland/puck). But I'm still really happy with cljbox2d, and the API is infintely nicer to deal with than the original (j)box2d.
The point-and-click game became https://invasie-van-de-robots.rocks/
Nice game :-). I dont speak the language unfortunately. Btw. It may be good to move items to the top so it doesnt block right movement when playing on small mobile screen.
@plexus this is great and works (using clojure2d as a renderer, instead of quil)! One minor request: is to possible to make Vec2 also Seqable (to be able to call seq, first, second on it) not only Indexed?
probably, see https://github.com/lambdaisland/jbox2d . I had to fork jbox2d in order to implement these clojure interfaces, and I don't remember how I did the deploy the clojars 🙈
seems very little has changed upstream at first glance, so that's good
But I can figure that out again, I guess I just used maven directly. PR welcome! see https://github.com/lambdaisland/jbox2d/commit/267c0ea5fe49c78e71735f5be57c34aecbc39c32
Good!
very cool that you got it working with clojure2D as well! if you have a sample (maybe a gist?) it would be great to link to in the README
ok, made it, source code is here: https://github.com/Clojure2D/clojure2d-examples/tree/master/src/box2d
I've added a line in README too
results: https://github.com/Clojure2D/clojure2d-examples/tree/master/results/box2d
if you want me to add something specific (about the licence, better description, etc.) please let me know. Source code includes a link to the original code.
And thanks for making that! This is so helpful library.
cc @plexus
This is great! Thanks a lot! How would you feel about contributing the box2d.common code to cljbox2d?
so turn it into lambdaisland.cljbox2d.clojure2d
Sure, why not! As I understand, dependency to clojure2d should be as an alias in deps.edn, right?
yes, and then add it to bin/proj to :alias-as-optional-dependency
do you want me to include also demos (maybe in lambdaisland/cljbox2d/demo/clojure2d/)?
Sure! They would be most welcome!
Perfect, I'll prepare first approach this weekend 🙂
🙏
Sure! I'll push it in 30 minutes (working on pyramid example, just got hit by non seqable vector). It will be a part of clojure2d-examples repo.