SafeZone

From Bohemia Interactive Community
Jump to navigation Jump to search

Template:Stub

Introduction

Terminology

  • Display: The video display.
  • Game Screen: That part of the video display that shows the game. Either the full Display, or part of the Display in windowed mode.


Dialogs and controls are positioned in the Game Screen in a rectangular box using screen-coordinates where the top left corner of Game Screen = 0,0. Bottom Right = 1,1.

In the Bis world, all positions, widths and heights are expressed in fractions of the full coordinate area of (1.0, 1.0).

Before Arma2 the positioning of these controls was the game screen.

Post Arma2 these positions are a user screen (green), embedded in the game screen (red).

  • A user can now set his prefered menusize in the grafic options of Arma2. So if you choose for example "small", the positioning grid is redefined to a smaller, centered area with borders around.

Example for SafeZone (red areas)

The SafeZone is the red area, and can only be reached with values outside the range of 0 to 1.

Handling the SafeZone

SafeZone = red area including the green one = complete screen.

To position your control to the left border of the game screen, you have to set a negative value to the "x" tag of your control. But this value depends on the menusize setting of the user. So how do I get the right value ?

BI give you 4 functions to get the whole dimensions of the screen.

  • SafeZoneX returns the value for the left side of screen relative to the user left side.
  • SafeZoneY returns the value for the top of the screen relative to the user top side.
  • SafeZoneW returns the width of the Game Screen
  • SafeZoneH returns the height of the Game Screen

Note that Safezone X & Y will be negative values.

Because of above functions, actual sizes of your display area are also available.

some useful syntax

x=SafeZoneX; // positions at extreme left of Game Display
x=0;         // positions at left edge of user area
#define USER_WIDTH  (SafeZoneW+2*SafeZoneX)
#define USER_HEIGHT (SafeZoneH+2*SafeZoneY)
x=USER_WIDTH; // positions at right edge of user screen
y=USER_HEIGHT; // positions at bottom edge of user screen

Code Examples

(WIP ...)


See also

SafeZoneX, SafeZoneY, SafeZoneW, SafeZoneH