resolution and scaling gui graphics

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
TomB
Posts: 12
Joined: Wed Jan 25, 2006 11:52 pm
Location: Melbourne
Contact:

resolution and scaling gui graphics

Post by TomB »

I am worried about allowing different screen resolutions. I am going to have a gui that I would need to scale depending on the different sizes. If i dont do it somehow, I will have funny looking interface. Will I have to have a different size font and HUD image for each size resolution? or could I somwhow scale the different items?

Many helps would be of goodness,
TomB
Ismarc
Posts: 6
Joined: Sun Apr 02, 2006 8:40 pm

Post by Ismarc »

This might be wrong, and I hope it is, but here we go anyways. I've been actually looking at this exact thing. If you use Irrlicht's built in gui objects (buttons, windows, text boxes) you can scale them when they are created (easily done if you use variables to hold the values rather than specifying them). The problem, it looks like, is if you're using your own images. I haven't been able to find (yet) a method to scale the image once it's loaded in. Something I'm going to have to look at when I get home is honestly something I just thought of. When I use an image in the gui, it's loaded as a texture. There might be a way to scale the image once you have it loaded, but before you add it to the gui environment.

If I find it, I will definately post the solution to it here.
The Lord
Posts: 1
Joined: Tue Apr 25, 2006 8:18 pm

Post by The Lord »

Any success until now?

Just tripped over the same problem.
I have a freely scalable guy by specifying all my element coordinates as products of their parents' dimensions (so x=0.5f,y=0.5f means that my elements left corner is at the center of its parent).

The only problem is, that any images used by my gui don't bother about scaling, so nothing fits.
Same problem goes for static texts. On a 1280/1024 resolution the built-in font is almost unreadable because it's so tiny.

Any suggestions? plz plz plz
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

There has been a really large thread with much code on this topic some weeks ago. Either projects or FAQ forum I think. Try to search :idea:
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post by TheRLG »

Gatekeeper
Posts: 31
Joined: Fri Apr 21, 2006 12:00 am
Location: Australia

Post by Gatekeeper »

While the above proportions tip fixes this problem for buttons, windows etc, it still doesn't help when you add images or static text.

So far I've only been able to get it to display images and text on a pixel-by-pixel basis, because I haven't found how to scale a 2d image (via the gui or just normal drawing routines).
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Fonts are not scalable in Irrlicht such that you have to provide different font sizes based on typical resolutions. then, choose the righ font from your set of sizes.
Images should probably not be scaled because you'll easily loose important details. Otherwise use the IImage constructor which uses an existing image and provides a target rectangle to specify destination size. This is slow, but scales to the correct size.
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post by TheRLG »

If you can recompile Irrlicht and really want to scale IGUIImages, I can easily tell you how to do that.

You can also do it via draw2dImage, which is all that IGUIImages do in their drawing function. Draw to a certain rectangle, not just a position.
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post by TheRLG »

Post Reply