if ((Player getVariable "SpareTime") > 0) then {...
« Changelog 26/06/2009Changelog 24/06/2009 »

New to ArmA 2: Dialogues

Permalink 06/24/09 03:28, by jonas, Categories: RTE, ArmA

Err, new to ArmA 2? We have dialogues since OFP!

Yes, this is true, but the designing of dialogues got a little nicer with ArmA 2. We have SafeZone :D

I never had any problems designing my dialogue...
Those problems only occurred to those people who made full screen dialogues.

So what's now?

In ArmA the screen can have different dialogue coordinates. Only in 4:3 we have width: 0 : 1 and height: 0 : 1. 16:10 for example has width: -0.1 : 1.1 and height: 0 : 1. Those different coordinates are required to keep the aspect ratio, so it is good to have them. But it was hard to detect which ratio is active. You could use UNN_WideScreenDetect which solved this problem.

...

In ArmA 2 we have multiple GUI sizes and multiple aspect ratios. Sounds like a hell, but we have SafeZone :D
So we change our dialogues to be dynamic in the size.

We have two variants to do this:
First we can scale the dialogue and have borders for different aspect ratios. I can't recommend it since it is some work and ignores the GUI size.
Second we can move the dialogue parts just like we did when we adjusted it for the different aspect ratios.

Here are two images from the RTE:
The first one with big GUI, the second one with normal GUI.
arma2 2009-06-24 03-05-08-96arma2 2009-06-24 03-04-02-20
Nearly all controls have been moved to the edges, only the menu and the debug command line have been widen to fill the gap. This works fine for every GUI size and aspect ratio.

The implementation of it itself was very easy:
We have with SafeZoneX, SafeZoneY the origin of the dialogue and with SafeZoneW, SafeZoneH the width and height.

Code:


_define_Map_Left = SafeZoneX;
_define_Map_Top = SafeZoneY;
_define_Map_Width = SafeZoneW;
_define_Map_Height = SafeZoneH;
 
_define_ObjectList_Width = 0.2;
_define_ObjectList_Left = SafeZoneX + SafeZoneW - _define_ObjectList_Width;
_define_ObjectList_Top = SafeZoneY;
_define_ObjectList_Height = SafeZoneH;
 
_define_Menu_Left = SafeZoneX;
_define_Menu_Top = SafeZoneY;
_define_Menu_Width = SafeZoneW - _define_ObjectList_Width;
_define_Menu_Height = 0.04;

This are the positions of the background controls of the map, the objectlist and the menu.

The code itself for the controls is a little ugly:

Code:


with uiNameSpace do {
//Map
  ION_RTE_Ctrl = ION_RTE_Display displayCtrl ION_MAP;
  ION_RTE_Ctrl ctrlSetPosition   [_define_Map_Left,
               _define_Map_Top,
               _define_Map_Width,
               _define_Map_Height];
  ION_RTE_Ctrl ctrlCommit 0;
};

We need to do this for every control. A load of code, but if we made this good, then we can design the position of our controls on the fly :)

Ok, overall dialogues still aren't good to design. ArmA 2 will crash too when encountering an error in the dialogue definition. But with SafeZone GUI size and aspect ratio ain't a problem any more!

No feedback yet

©2012 by Jonas Scholz

Impressum

Contact | Help | Blog skin by Asevo | b2 | web hosting | monetizing