tank-dev / tank

A 2D C++ game engine taking inspiration from FlashPunk
Boost Software License 1.0
12 stars 3 forks source link

Common Graphical Translation #57

Open qualiaa opened 10 years ago

qualiaa commented 10 years ago

Graphics classes show a lot of repetition from my rather hacky approach to getting them to actually work with SFML. This is leading to errors and a lot more effort than necessary.

qualiaa commented 10 years ago

Finished to some extent when fixing #62. Going to keep it open, because ultimately a full transformation class would be nice for #63.

Anstow commented 10 years ago

I have written a common graphical translation class (or two) see coord_systems. I'm not going to merge this immediately because it is a rather huge change and I'd like some input.

qualiaa commented 10 years ago

@Anstow I wasn't a fan of your coordinate systems approach - maybe next time we meet you can convince me. I ripped your transform class out, made a Transformable class which essentially aggregates a transform, and has a pointer to a parent - so is in many ways similar.

This all seems to work nicely, and so I'm closing this as an issue.

qualiaa commented 10 years ago

Okay, I spoke too soon. What I've done has reintroduced bugs relating to camera movement. I'd really appreciate it if @Anstow could take a look and fix what I'm doing wrong.

I'm testing this in http://github.com/tank-dev/demos/tree/Camera

Relevant functions are Transform::operator(Transform const&), Transformable::getWorldTransform() and Graphic::transform.

Edit: I've reverted my changes @Anstow: your mission, if you choose to accept it, is to make Transformable store a single parent and compose transformations sensibly, with Camera parent of Entities, and Entities parent of Graphics.

Anstow commented 9 years ago

So this is pretty much what the coordinate systems does anyway just with slightly different names. The only difference is there is a separate transformation class as a transform shouldn't really know anything about what its transforming.

Also sorry it took me such a long time to reply to this I've been busy.

Edit: The rest of the bloat is to make it do sensible things when you remove the parent and the like.