Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Upside Down World  (Read 15236 times)

0 Members and 1 Guest are viewing this topic.

Caspin

  • Newbie
  • *
  • Posts: 10
    • MSN Messenger - j_nick_terry@hotmail.com
    • View Profile
Upside Down World
« on: October 05, 2007, 07:21:58 am »
I think that SFML should provide an option that will map the 0,0 to the bottom left hand corner of the screen instead of the top left.  The change is not that major.  It would essentially be a conditional around the few places where the world is specified upside down.

I understand there is a lot of history here with old dos games editing the frame buffer directly.  I however don't think that emulating this is good idea in a modern 2d engine.  We are not using a frame buffer so don't pretend we are.  OpenGL maps the 0,0 to the bottom left corner, and that is our rendering engine.

Ideally, a 2d engine should let the user specify their world and viewport into that world.  Most 2d engines don't do this (they're still hung up on the emulating a frame buffer).  I was very excited to see that someone finally realized a 2d engine would do well to use this concept.  I can pan the camera around instead of moving the world.  However, SFML requires the world to have the y axis upside down.  It's like it kinda stuck half way between the 3d vewport method and the 2d framebuffer method.

I would personally like to have the 0,0 mapped the bottom left always.  I mean OpenGL made the decision to map it there, and I generally view OpenGL as one of the best designed API's.  There are many reason to put it there.  That said it is very common for 2d programmer to expect the 0,0 to be in the top right that it wouldn't make sense to make it hard for them to use the library either.  So I propose a boolean value to tell the underlying system to not flip the y axis.

-caspin

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Upside Down World
« Reply #1 on: October 05, 2007, 08:48:00 am »
That makes sense, I'll see if I can add it easily (should be ok).

Thanks for the suggestion.
Laurent Gomila - SFML developer

Aszarsha

  • Full Member
  • ***
  • Posts: 200
    • MSN Messenger - aszarsha@gmail.com
    • View Profile
Upside Down World
« Reply #2 on: October 06, 2007, 04:26:13 am »
If it can be done w/o lot of changes (not propable), it should be there as a compile time macro constant ! Or through templates... :lol:

This is exactly the kind of features a programmer can easily do, but that would impact every programmers (a comparison for every draw) if directly in the lib.
For a so small advantage, if it's not a compile time option, it's not worth...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Upside Down World
« Reply #3 on: October 22, 2007, 03:48:35 pm »
I'm trying to add this feature, and actually I don't think it can be implemented without a lot of changes in the code.

Having a view starting at the bottom-left corner is easy, but then everything would be flipped. This means the all the sf::Drawable classes would need to be adjusted to take this into account. Not to mention that the SetTop function and a few others would become inappropriate, because we'd rather need SetBottom in this case.

I added the ability to define the origin at any location on screen with sf::View, but the whole scene will be mirrored / flipped accordingly.
Laurent Gomila - SFML developer

 

anything