supporting multiple coordinate systems

Started by
-1 comments, last by jwezorek 7 years ago
I'm working on a 2D game framework that is currently on top of SFML. I want to add a feature to my framework in which the user can select at start-up between what the framework will refer to as "coordinate systems": (1) TopLeftOriginDescendingY, (2) BottomLeftOriginAscendingY, or (3) CenterOriginAscendingY.
The idea being that SFML uses (1), all flavors of cocos2d-x use (2) and I personally think (3) makes a lot of sense because of philosophic alignment with mathematics and makes sense practically for handling multiple screen size and aspect ratios.
I figured this would be an easy thing to do because I could just roll into my "coordinate mapping matrix, which transforms "logical coordinates" into screen coordinates another transformation that handles the 3 systems above in cases (2) and (3) doing a scale by (1.0, -1.0) to flip the vertical axis because SFML uses (1) by default. The problem with this, I realize now, is that scaling by (1.0, -1.0) will cause all of my sprites to be upside down. I could handle that by flipping the textures in memory if in inverted-y modes but it seems kind of inelegant. I am planning to eventually break my dependency on SFML and re-implement the part of SFML I am using directly on top of OpenGL so am now leaning towards not doing "coordinate systems" right now but implementing it when I remove the SFML dependency.
My question is basically is there a more elegant way to do what I want to do in SFML that I am not seeing? Perhaps using the sf::view class which I havent touched before? If not am I right in assuming that allowing this feature in a direct OpenGL implementation will admit a solution that does not involve me flipping texture raster lines?

This topic is closed to new replies.

Advertisement