Closed fokoenecke closed 7 years ago
Interesting. :) I think a good solution here might be to offer an entity.SetCanvas(*Canvas)
method - would that fit your needs? You'd then just swap in the canvas you wanted when the orientation changed, instead over overwriting.
Yeah, sounds great. Didn't think about that. Since that wouldn't be much of a change, I could do that on my own and create a pull request.
Hi! I am trying to learn some Go and love your terminal libraries for starting some fun projects. Thank You!
I am creating an entity that has different orientations depending on which direction it is facing. That entity has some transparent pixels on it. On loading the entity, I create a new canvas for every orientation and keep a pointer to them. If the orientation of my entity changes, I use
ApplyCanvas()
to apply the according canvas to the underlying entity's canvas. Unfortunately, when the orientation changes, the transparent pixel won't apply, if there is already a color defined (renderCell()
in screen.go). So the previous color for that pixel shows up, where a transparent one should be.I understand why it's necessary to do this when drawing on a background, but would it be possible to use another function, that applies all pixels (including transparent) when not rendering to the screen, but on an internal(~sprite) canvas? What I did as a workaround, is using a special "Sprite" render Method and use this in
ApplyCanvas()
.In a real solution you wold need to use that in all relevant functions, I guess. Unfortunately I don't understand the implications of such change and don't feel confident in supplying a pull request.
Greetings!