0
\$\begingroup\$

Recently, I was going to implement and options menu into my game, but I haven't been able to figure out how changing resolution, conceptually, would work. Do I have multiple versions of the same texture at different resolutions, do I just change the area of which the texture would render, or some other option?

\$\endgroup\$
3
  • \$\begingroup\$ What kind of game is this and what engine are you using, if one at all? \$\endgroup\$
    – JPtheK9
    May 23, 2015 at 20:48
  • \$\begingroup\$ I am using the SFML game library, and it is a 2D game. @JPtheK9 \$\endgroup\$
    – Charsmud
    May 23, 2015 at 21:59
  • \$\begingroup\$ maybe this answer gives you some idea. \$\endgroup\$
    – Emadpres
    May 24, 2015 at 5:25

1 Answer 1

0
\$\begingroup\$

Conceptually, games can adjust to screen resolutions by scaling UI elements. If you want to take the easy route and use Unity's UI, this can be done pretty easily with a Canvas Scaler.

I don't think that SFML has a canvas scaler and a well-made one can get pretty involved. A simpler canvas scaler has a reference resolution which is used to build your UI on. Then the UI elements are simply resized to the new resolution based on the one they were designed with. For example, if the reference resolution is 800x600 and the device's screen resolution is 1000x1000, elements' height would be multiplied by 1.25 and width by 1.66.

Keep in mind that pivot points matter when resizing elements.

Alternatively, you could use a GUI library mentioned here: http://en.sfml-dev.org/forums/index.php?topic=13590.0.

\$\endgroup\$
2
  • \$\begingroup\$ Ok, that makes sense. How would I store these resolution multipliers, in a global variable or as a namespace? \$\endgroup\$
    – Charsmud
    May 23, 2015 at 22:49
  • \$\begingroup\$ That's a questions specific to your uses. Unity has the potential for several canvases so the variable is that of an instance. If you only have 1 canvas that needs to be resized, static variables will be faster and easier to code. \$\endgroup\$
    – JPtheK9
    May 24, 2015 at 5:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .