Jump to content
  • Advertisement
Sign in to follow this  
jwezorek

supporting multiple coordinate systems

This topic is 615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?
Edited by jwezorek

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!