Jump to content

Hud Scaling


gordonramp
 Share

Recommended Posts

You need calc scale coef. for base screen resolution, then draw all HUD items multiplied by new scale (position and size).

[HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64

[sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx

 

76561197970156808.pngAndyGFX.png

Link to comment
Share on other sites

Isn't comlicated. :)

 

Example

 

Base screen resolution = 1024x768 (HUD is designed for this res.)

 

User defined resolution after start is now: 1280x1024

 

Math (new_res/base_res):

 

hud_x_scale = 1280/1024

hud_y_scale = 1024/768

 

and for all HUD elements you need calc new position:

 

new_x = hud_x_scale * item_x

new_y = hud_y_scale * item_y

 

and size:

 

new_w = hud_x_scale * item_w

new_h = hud_y_scale * item_h

 

and draw it.

 

Note: You don't need create different images when are designed for max resolution.

[HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64

[sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx

 

76561197970156808.pngAndyGFX.png

Link to comment
Share on other sites

Hi Andy, That sounds mathematically complicated. :) How about having a different image for each resolution?

 

This is completely zero.

 

The HUD images have the same width and height on any resolution. You only need the position on screen. AndyGFX solution should be perfect for what you want.

i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64

rvlgames.com - my games

RVL Games Facebook Page, YouTube Channel

 

Blitzmax :)

Link to comment
Share on other sites

  • 2 months later...

ill post a small example tis is how i did it in lua

 

DrawImage(Button,GraphicsWidth()/1.8,GraphicsHeight()/1.35,GraphicsWidth()/2.5,GraphicsHeight()/2.8)

 

hope this helps. :blink:

Tools:

AC3D | 3D Canvas(pro) | Texture Maker(pro) | Genetica(basic) | 3D World Studio | Fragmotion |Leadwerks 2 | XNA 4 | Visual Studio 2010 Professional | XCode 5.x |UU3D Pro

 

Programing & Scripting Languages:

C |C++ | C# | Obj-C | LUA | Javascript | PHP | Ruby

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...