Hud lines and shapes at different resolutions

Hello,



what is the best way to render a hud with jme without having to create assets for different screen resolutions?


  • i thought about using svg, but don’t know any lib that glue jme and svg graphics
  • i thought about eexporting 2d meshes from blender, but i don’t know it it is feasible

    if yes, how to have antialiazing on lines, so i can create nice smooth lines for windows borders
  • is the resize parameter of the image tag in the nifty screen xml file, worging like a level of detail ?



    thx

Use Nifty and design your layout accordingly. Use % for things you want to remain proportional, use fixed sizes for other things.



For example you can size a panel to a fixed size - and then position it proportionally on the screen. It’s similar to laying out a HTML website.



The Nifty resize is used to create panels etc and can help with this. Read the manual (Nifty Bible link to the right) and it explains it.

@zarch said:
Use Nifty and design your layout accordingly. Use % for things you want to remain proportional, use fixed sizes for other things.

For example you can size a panel to a fixed size - and then position it proportionally on the screen. It's similar to laying out a HTML website.

The Nifty resize is used to create panels etc and can help with this. Read the manual (Nifty Bible link to the right) and it explains it.

thx,

but shrinking images might not give the best results
i can't know what default image size i should use, might be to big or too small

Nifty has a handy

[java]

nifty.enableAutoScaling(nativeX, nativeY);

[/java]

You feed this method with the resolution in which you designed your screens and Nifty handles the scaling for you.

I was actually surprised how well it works. Shrinking or scaling, the result really worth the line of code p:.

1 Like
@nehon said:
Nifty has a handy
[java]
nifty.enableAutoScaling(nativeX, nativeY);
[/java]
You feed this method with the resolution in which you designed your screens and Nifty handles the scaling for you.
I was actually surprised how well it works. Shrinking or scaling, the result really worth the line of code p:.


well, let's say i have a 1680x1050 hud.png with represents stuff that don't move on the screen and always appear
if i build this to android platform (and all other platfoorms too), i am gonna end up with a severals mb of image file that is a lot for a small device screen

besides, if the image is composed of thin lines(like windows or components borders), these are going to be blured on expension and disapear on shrinking

so i what questioning myself, i guess there are some scenarios where i would have to make different images

wich lead me to that level of details about textures for the hud :)

thx anyways :)

Yeah i guess that if you target resolution from 1680x1050 to 800x480 you 'll have to do something.

But you can have like 3 sets of images high def medium def and low def and then let Nifty do the scaling