4

I'm working on my first LibGdx (Scene2d + Box2d) game, it's quite new field for me and still feel a bit confused about couple things, especially about units. Already seen few different approaches how to deal with it, but still not sure for what's best go for me.

Wondering if there is any drawback of using stage viewport size eg: 16x9 (rather than commonly used: 800x480) in order to avoid conversions box2d => stage coordinates, use same sizes/positions for Box2d objects as well as for stage actors (sprites etc)?

majuszt
  • 75
  • 5

1 Answers1

4

Wondering if there is any drawback of using stage viewport size eg: 16x9 (rather than commonly used: 800x480) in order to avoid conversions box2d => stage coordinates, use same sizes/positions for Box2d objects as well as for stage actors (sprites etc)?

This is exactly what I do. It is a much better approach. You don't have to make all those convertions.

Probably the first libgdx box2d adopters didn't think of that and everyone else just followed them :p

Daahrien
  • 10,190
  • 6
  • 39
  • 71
  • 1
    How do you maintain aspect ratio then? Do you keep aspect with gutters or draw full screen without keeping aspect? If you go with gutters there are two options (described at the bottom of: https://code.google.com/p/libgdx/wiki/scene2d#Viewport), you can draw over them or not, if I go second one (which seemed to me better) have problems with BitmapFonts, they get shrink. Any similar issues? – majuszt Feb 13 '14 at 14:25
  • @majuszt did you have any luck by setting the viewport to 16x9? Do you still think it is the better approach to avoid box2d conversions? – Devester Aug 05 '14 at 18:36
  • Yes, I kept 16x9 just to have 1 to 1 with my box2d world size. I've also used second stage with native device resolution for HUD. – majuszt Aug 08 '14 at 12:44