Jump to content
  • Advertisement
Sign in to follow this  
schupf

Scalable UI

This topic is 2270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I have made a very basic UI system for my game. I basically just render textured quads and replace the textures for effects like "button hovering", "button pressing" etc.
The problem is: I design my button textures for a certain resolution. Lets say my game window is 1000x600 and a button has a size of 200x30. Now I create my button textures with a size of 200x30 and everything looks fine at resolution 1000x600. But when I increase the resolution (i.e. 1920x1200), the UI elements look too tiny. And when I scale the elements up, the elements look blurry.

Is there a common way to fix this? Right now the only simple solution I can think of is creating UI element sizes and textures for 2 resolutions and switch depending on window size (if < 1200x1000, use small elements, else big elements).

Thanks for any hints and ideas!

Share this post


Link to post
Share on other sites
Advertisement
Creating multiple sets of assets at differing resolutions seems to be a fairly popular solution to the problem - I can't remember the game right now, but I know one popular (although fairly old) RTS did that.

The other thing you can try is to break your UI elements up into corner, edge and center pieces that you manipulate in different ways. This is often referred to as scale 9 (see here: http://jessewarden.c...ilverlight.html). It adds some complexity to things but is used in Flash regularly.

Depending on your UI style, you could create the entire thing from geometry and avoid bitmaps entirely. :)

T

Share this post


Link to post
Share on other sites
Generate fonts at the screen res you want at load time, if you are using bitmap fonts.
Personally i'm using DirectWrite/Direct2D, and so i'm using actual truetype files - so any resolution at any time is quite good.

For images, proceedural tricks work nice. Use of signed distance fields to preserve silhouettes while stretching images works well, check out this whitepaper: http://developer.amd.com/documentation/presentations/legacy/Chapter2-Green-Vector_Textures.pdf

If you create your images for the higher screen resolution though, when maintaining screen-size the texture will just by default fall back to lower mip levels. You dont even need to manually switch between textures for this.

Share this post


Link to post
Share on other sites
Could you create your UI textures catered for the maximum resolution you intend to support and then just scale the quads?

So instead of making your quad <200,300> make it <0.1*width,0.2*height>, which will keep every UI element the same size relative to the screen.

I suppose this could cause some distortion when it comes to text though, so be careful. It would certainly work for non-text situations.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!