Jump to content
Sign in to follow this  
leob

rscTitle & cutRsc - dynamic scaling

Recommended Posts

Hi guys,

I'm doing a singleplayer campaign and want to show the campaign logo at mission start.

For that I'm using rscTitles in the description.ext and the cutRsc command in the init.sqf.

To support all screen sizes I'm storing a picture with pretty high resolution and calculate it's final dimensions

depending on the player's screen resolution and ratio.

So my question is if there is any useful variables/parameters in the rscTitles classes that let me simply align/center the picture without calculating the correct safezoneX/safezoneY values for every possible resolution?

Additionally I want to align two headlines (also pictures) beneath the logo. So is there maybe a simple offset parameter to easily position title objects relative to each other?

Of course there's always the possibility to let my script calculate the exact safezoneX and safeZoneY values for every title object but if there's a simpler way to do it let me know.

Cheers

Share this post


Link to post
Share on other sites

I am not sure I understand your question right. The images are auto resized to the rectangle you define as their holder.

The class below will draw an image 80% width and 80% height of any screens, to the middle.

The ratio will be probalby distorted (according to the user's screen ratio) So you need to add it into the calculation if you'd like to use a square logo.

(getresolution select 4) is the command you need to divide your width with to get a square instead of a rectangle following the user's screen ratio.

(The x/100 down here are just for easier readability)

[color=#FF8040]class Logo
[color=#8B3E2F][b]{[/b][/color]
   [color=#191970][b]type[/b][/color] [color=#8B3E2F][b]=[/b][/color] CT_STATIC[color=#8B3E2F][b];[/b][/color]
   style [color=#8B3E2F][b]=[/b][/color] ST_PICTURE[color=#8B3E2F][b];[/b][/color]
   colorBackground[color=#8B3E2F][b][[/b][/color][color=#8B3E2F][b]][/b][/color] [color=#8B3E2F][b]=[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color][color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color][color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color][color=#FF0000]0[/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]
   colorText[color=#8B3E2F][b][[/b][/color][color=#8B3E2F][b]][/b][/color] [color=#8B3E2F][b]=[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#FF0000]1[/color][color=#8B3E2F][b],[/b][/color][color=#FF0000]1[/color][color=#8B3E2F][b],[/b][/color][color=#FF0000]1[/color][color=#8B3E2F][b],[/b][/color][color=#FF0000]1[/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]
   [color=#191970][b]text[/b][/color] [color=#8B3E2F][b]=[/b][/color] [color=#7A7A7A]"myLogo.paa"[/color][color=#8B3E2F][b];[/b][/color]
   x [color=#8B3E2F][b]=[/b][/color] [color=#FF0000]10[/color] [color=#8B3E2F][b]/[/b][/color][color=#FF0000]100[/color] [color=#8B3E2F][b]*[/b][/color] [color=#191970][b]safeZoneW[/b][/color] [color=#8B3E2F][b]+[/b][/color] [color=#191970][b]safeZoneX[/b][/color][color=#8B3E2F][b];[/b][/color]
   y [color=#8B3E2F][b]=[/b][/color] [color=#FF0000]10[/color] [color=#8B3E2F][b]/[/b][/color][color=#FF0000]100[/color] [color=#8B3E2F][b]*[/b][/color] [color=#191970][b]safeZoneH[/b][/color] [color=#8B3E2F][b]+[/b][/color] [color=#191970][b]safeZoneY[/b][/color][color=#8B3E2F][b];[/b][/color]
   w [color=#8B3E2F][b]=[/b][/color] [color=#FF0000]80[/color] [color=#8B3E2F][b]/[/b][/color][color=#FF0000]100[/color] [color=#8B3E2F][b]*[/b][/color] [color=#191970][b]safeZoneW[/b][/color][color=#8B3E2F][b];[/b][/color]
   h [color=#8B3E2F][b]=[/b][/color] [color=#FF0000]80[/color] [color=#8B3E2F][b]/[/b][/color][color=#FF0000]100[/color] [color=#8B3E2F][b]*[/b][/color] [color=#191970][b]safeZoneH[/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color][/color]

Made with KK's SQF to BBCode Converter

Edited by zapat

Share this post


Link to post
Share on other sites

Hi,

so yes the above example scales the image according to the player's screen size and then I have to invole the aspect ratio so the image won't be stretched/distorted.

But still you have to calculate the safezoneX and safeZoneY values so you can actually position the image on the screen (in this case center it). So i was wondering if there is a parameter like "align = "center" or something so the image is automatically centered (instead of writing a formula yourself).

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×