samedi 30 juillet 2016

Resolution independence in LWJGL

So I started programming a game with LWJGL again and have a design question for you:

Where to position elements with absolute coordinates when resolution is dynamic.

I did it in the past like this:

  public static final float dX = SCREEN_WIDTH/1920f;
  public static final float dY = SCREEN_HEIGHT/1080f;

enter image description here

So when I wanted to add an image I tried it on FullHD on which coordinates it looked good and multiplied with dX/dY.

In my opinion I think there could be a better approach to achieve this in LWJGL but I am to inexperienced to find one.

Aucun commentaire:

Enregistrer un commentaire