Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

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

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
Ok, that makes sense. How would I store these resolution multipliers, in a global variable or as a namespace? –  Charsmud May 23 at 22:49
    
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. –  JPtheK9 May 24 at 5:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.