Jump to content
Sign in to follow this  
VictorFarbau

How to maintain picture proportions?

Recommended Posts

Hello,

while I was messing around with my VFAI Control Panel I noticed that it is rather difficult to forsee what a paa picture file will look like in a dialog.

Meaning, you have to specify width and height of the picture object from 0..1. Depending on actual game window width and height this might very well distort the picture and cause some ugly effects.

I set my picture to 256x512 pixels, does anybody know a way how to force it to exactly this format? Haven't found anything on this so far...

Thanks,

VictorFarbau

Share this post


Link to post
Share on other sites

One thing I sometimes do to make positioning/sizing easier, is to come up with a target resolution for the screen; eg, 1280x1024.

Then in image coordinates, I say

x=512/1280 eg: ((1280-256)/2)

y=256/1024 eg: ((1024-512)/2)

w=256/1280

h=512/1024

That will give you a centered picture in the proper pixel ratio for a 1280x1024 screen, but I think people with slightly different aspects are ok, as long as you select the right aspect ratio in options for your resolution. (EG, if you have 1280x1024 and you select 5:4, your images will be as clear as someone with 1024x768 and 4:3 aspect).

Share this post


Link to post
Share on other sites

Well well biggrin_o.gif If I'd knew the x and y resolution of the current display then I won't have a problem of course.

Problem is, we have many different display types out there currently (17,19,22,30 inch, wide and 4:3) so I can never garantuee whether pictures look distorted. I will probably have to build a dialog out of lines and boxes to avoid strechted and distorted picture backgrounds confused_o.gif

Cheers,

VictorFarbau

Share this post


Link to post
Share on other sites
Quote[/b] ]If I'd knew the x and y resolution of the current display then I won't have a problem of course.

You can get the dimensions using this method:

Dialogs & wide screen monitors

Share this post


Link to post
Share on other sites

ok guys sorry to interupt but i didnt want to start a new thread ....can some one point me in the right direction how to start to make a dialog.... is there a tutorial at all.

sorry if it sounds noobish but i need to ask to learn

thnx..... help.gif

Share this post


Link to post
Share on other sites

Use the ST_KEEP_ASPECT_RATIO style, in combination with the picture style:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#define ST_KEEP_ASPECT_RATIO 0x800

#define ST_PICTURE 48

style = ST_PICTURE + ST_KEEP_ASPECT_RATIO;

Alternatively, you could use a listbox that only has room for one element, since listbox pictures also keep their aspect ratio. You can also take advantage of the eventhandlers available to LBs for scripting if you choose this route.

Share this post


Link to post
Share on other sites

Thanks for your input guys. it's appreciated. While I am not really a fan of UNN's proposal (even though perfectly acceptable for special applications) I was totally surprised by Barron's input - am I blind or why don't I see/find/read these things? biggrin_o.gif Is it me or is the documentation about dialogs really that thin as Spliff's question also indicates?

Regards,

VictorFarbau

Share this post


Link to post
Share on other sites

Thanks Gen B! I was actually wondering about this myself.

Spliff:

The wiki is a bit thin, but you can get some evry basic info there. http://community.bistudio.com/wiki....ress%29

This tutorial is a good start, but as it is for OFP, some things have changed: EG, you have to open the description.ext files and change all fonts to "bitstream", and I think example 3 crashes arma. http://www.ofpec.com/ed_depo....cat=xyz

Dr_Eyeball's dialog framework is a good place to start making your own dialogs once you have the basics.

http://www.flashpoint1985.com/cgi-bin....amework

Share this post


Link to post
Share on other sites

Thanks Barron, that actually works like a charm thumbs-up.gif This looks a lot better! I also finally managed add transparency to my VFAI control panel background pic. Now I wonder what I will need to do to make the whole dialog and all elements moveable (like BIS' compass or GPS device). Any hot tips or references?

Regards,

VictorFarbau

Share this post


Link to post
Share on other sites
Now I wonder what I will need to do to make the whole dialog and all elements moveable (like BIS' compass or GPS device).

You must use a 3d dialog control (they are configured in the "objects[]" part of the dialog, not "controls[]" or "controlsBackground[]").

This is a whole 'nother topic, do some searching in the OFP forums and you should find info. Or, look at the BIS configs for the compass and GPS device. Or look in my old ofp vietnam mission (in my signature), as it also has an example.

Note, however, that not all dialog controls can be placed inside of a 3d object. Multi-line text boxes come to mind as one example; I think listboxes might be another.

Share this post


Link to post
Share on other sites

You simple give every control an IDC and use the onMouseMove-event. May be easier and works on all controls.

Share this post


Link to post
Share on other sites
Quote[/b] ]Now I wonder what I will need to do to make the whole dialog and all elements moveable (like BIS' compass or GPS device).

Don't you just need to set

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">movingEnable=1;

in your dialog class?

Share this post


Link to post
Share on other sites
Don't you just need to set

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">movingEnable=1;

in your dialog class?

No. That doesn't do anything. I believe it pauses the simulation, for dialogs like the escape menu, but it doesn't work in "normal" dialogs.

i0n0s's suggestion is a great idea:

Quote[/b] ]You simple give every control an IDC and use the onMouseMove-event. May be easier and works on all controls.

To add to this:

if you place all your controls within one control group, then you'll only have to move the one control, and everything inside it will move as well.

You'd obviously also want to use the onMouseDown/onMouseUp events, so the dialog only moves when the player is holding the mouse button.

Share this post


Link to post
Share on other sites

You can add the entry "moving" to one of the background controls. Then you can drag the whole display with LMB.

Share this post


Link to post
Share on other sites
Quote[/b] ]No. That doesn't do anything. I believe it pauses the simulation

That would be:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">enableSimulation = 1;

It works for any standard dialog that I’ve used.

The Moving property Raedor mentioned looks like it’s the one.

I just did a quick test. I had both MovingEnable set to true for my entire dialog and Moving set to true for my main background control. MovingEnable could be removed, set to true, or false, without affecting the dialogs movement.

Share this post


Link to post
Share on other sites

UNN, I had hoped for the same when I saw that movingEnable variable; but as Raedor already mentioned it's got nothing to do with the window being moveable.

Anyway, I set it to "1" so my control panel would be less disturbing during gameplay; do I need to mention it still blocks the player completely? whistle.gif

Sigh, if there'd only be some complete documentation. Would make coding time much more efficient. Lord, send me a GUI builder for Arma - and do it quick. I am a coder and not an interface guy.

Cheers,

VictorFarbau

Share this post


Link to post
Share on other sites
Quote[/b] ]UNN, I had hoped for the same when I saw that movingEnable variable; but as Raedor already mentioned it's got nothing to do with the window being moveable.

I assumed it applied to dialogs and displays, because it appears to have nothing to do with what the Wiki says. Fortunately I also had the moving parameter setup in the dialogs I wanted to move, so I didn't give it a second thought.

Share this post


Link to post
Share on other sites

Just an idea... maybe movingEnable has to be set to true, otherwise the control's moving entry doe snot take effect? Sounds reasonable, I think. smile_o.gif

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  

×