I'm currently doing a menu-system in Java2D, and I need to accommodate several resolutions, including 4:3, 16:9 and 16:10 resolutions. So, which is the best way to go?- A background for each resolution? (many files; brute solution)- Scaled instances of a background created for the maximum resolution of that ratio? (spacesaver, simpler, but maybe ugly)- Try to compile each menu-background dynamically from several images (text, image of player or monster, whatever), making adjustments for each resolution- Make a menu for each ratio at a fixed resolution, then change to the selected resolution when the player enters a level

Recently I had the same dilemma. I'm not an expert (yet) but this is what I came up with.... matches closely to your second option.

I used a starting resolution of 1024x768, that's the size of the background images and the default window size. I allow the user to change window size, but not ratio. So if the users drags their window to a new size or maximize the window, I only allow the height to change then set the width accordingly, this ensures the same ratio. Basically I did not want the user to warp the game. If the user has a real wide screen and they maximize, the window width would not make it across their whole screen. I did not have to do it this way and could have let them change the width independently of the height (and still might depending on what kind of feedback i get).

Will follow this thread closely to see what other, and yourself, have done.

Thanks. Those are some good pointers, all of you. You've helped me get a good idea about how I'm to approach this.I had only considered this a full-screen project. Never thought about the possibility of windowed mode, actually.I have some thinking to do.

Almost all bigger games require you do go through some menu to change resolution. It could be a loader/launcher or in game. They also have the most typical resolution/aspect ratio settings but not all. (no resizing the windows with mouse)

This makes it much, much easier to manager different resolutions. I would go with a few of the more mainstream resolutions with all the different aspect ratios. Do NOT try to make something that will let you resize the window to any resolution or aspect ratio.

As far as techniques to doing this goes, I got nothing. The layout manager seems good but DO NOT have multiple images at different resolutions that you load. This would be unnecessary bloat. Even in java2D scaling is very inexpensive.

Thanks. Those are some good pointers, all of you. You've helped me get a good idea about how I'm to approach this.I had only considered this a full-screen project. Never thought about the possibility of windowed mode, actually.I have some thinking to do.

Well, I will in the scope that StumpyStrust described. A set variety of resolutions to choose from. Backgrounds in the maximum resolution for each ratio, then I'll do that scaling-method The Cure has linked to. Seems very promising; thank you so much for that! A single call to scale all things drawn with the Graphics2D. That's very clever I'll see how that'll pan out.

Am I correct in saying that this method Eli posted will work for any resolution and any ratio, as long as you have a standard resolution set for each ratio? Considering I've had my poor artists design things for a screen-size of 1366x768, anyone on a lower resolution in this ratio will have everything scaled down, and everyone in a higher resolution of the same ratio will have everything scaled up, so they'll all have the same size on-screen? Will this make it look muddy in higher resolutions? I'm gonna test it, but I have a good way to go at implementing this, so if anyone can stop me in my tracks, and say "No, you have to design everything to fit in the highest resolution you want to run, and only scale down", I'd love to hear it.

Too much scaling can result in poor quality but I would suggest to use better filtering. Bilinear is it? That has very little performance drop and can greatly improve quality. I would not be too worried. If you want to support 1680-1050 and higher, you will probably start getting muddiness.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org