oakes / play-clj

A Clojure game library
The Unlicense
939 stars 73 forks source link

actors are not drawn in entity order #80

Closed floybix closed 9 years ago

floybix commented 9 years ago

Hi

I've run into a problem in the latest version: I have a Shape (a speech bubble) which is supposed to have a Label drawn on top of it - since the label appears later in the entity vector. But now it is drawn behind. I've traced this to the commit 2461718 "don't draw actors twice", which uses the Stage draw function for all entities -- before any other entities are drawn -- rather than draw!ing each entity in the vector.

Doesn't seem to be any way around it. Can we skip the Stage .draw and use the Entity draw! instead?

Or is there another way? perhaps turning the Shape into an Actor and setting the z-index?

oakes commented 9 years ago

Yeah I knew this might be an issue, but I was hoping it wasn't a common thing. The workaround is to use (render! screen) (draw! screen entities) separately instead of (render! screen entities). I will try to find a better solution in the next version, so the second method works as well.

I tried skipping Stage's .draw but found that it causes problems. You can see this by making that change and testing the ui-gallery example app.

floybix commented 9 years ago

I see, thanks.

oakes commented 9 years ago

I have released 0.4.6 which reverts the change in question.