GUI Coordinates – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (R3vo moved page GUI Coordinates to Arma 3 GUI Coordinates: Naming convention)
m (code fix)
Line 4: Line 4:
# Open [[Eden Editor]]
# Open [[Eden Editor]]
# Open debug console (Tools > Debug Console)
# Open debug console (Tools > Debug Console)
# Execute this code: <syntaxhighlight lang="cpp">0 = (finddisplay 313) createdisplay "RscTestGrids";</syntaxhighlight>
# Execute this code: <syntaxhighlight lang="cpp">finddisplay 313 createdisplay "RscTestGrids";</syntaxhighlight>


A menu where you can see how all grid systems react to specific resolution, aspect ratio and interface size.
A menu where you can see how all grid systems react to specific resolution, aspect ratio and interface size.

Revision as of 10:15, 19 June 2019

Example

Arma 3 logo black.png1.66 You can check some of the grid systems in interactive test menu in game:

  1. Open Eden Editor
  2. Open debug console (Tools > Debug Console)
  3. Execute this code:
    finddisplay 313 createdisplay "RscTestGrids";
    

A menu where you can see how all grid systems react to specific resolution, aspect ratio and interface size.

a3 GUI grids.png

  • Hovering over each grid will show detailed description in tooltip.
  • Data for each grid show the current size and max number of grids horizontally and vertically. Useful to making sure your menu proportions will work in all combinations.
  • Click COPY TO CLIPBOARD button to copy a code with example that can be used directly in Config.cpp or Description.ext.

Grids

SafeZone

Grid relative to actual screen size. Has the same aspect ratio as the screen itself.

class MyControl: RscText
{
	x = safezoneX;
	y = safezoneY;
	w = 0.5 * safezoneW;
	h = 0.5 * safezoneH;
};

GUI_GRID

Grid used in majority of game's menus, does not use pixel accurate coordinates. Affected only by interface size, giving user ability to customize its scale on the screen. Designed to use only 40x25 grids (i.e., size on 16:10 screen with Very Large interface size), although some menus may be stretched to fill the whole screen. Never gets smaller than 40x25 grids.

Default grid in the User Interface Editor.

class MyControl: RscText
{
	x = GUI_GRID_X;
	y = GUI_GRID_Y;
	w = 10 * GUI_GRID_W;
	h = 10 * GUI_GRID_H;
};

Pixel Grid

pixelW / pixelH

Actual pixel size, remains constant. On displays with too fine resolution (e.g., 4K), it can get too small for practical use.

class MyControl: RscText
{
	x = safezoneX + 100 * pixelW;
	y = safezoneY + 100 * pixelH;
	w = 100 * pixelW;
	h = 100 * pixelH;
};

pixelGrid

Pixel accurate grid introduced to replace GUI_GRID. Respects both resolution and interface size, but always returns whole number which can be divided by up to 4 and still be a whole number. Due to this rounding, some interface sizes may use the same value.

class MyControl: RscText
{
	x = safezoneX + 10 * pixelGrid  * pixelW;
	y = safezoneY + 10 * pixelGrid  * pixelH;
	w = 20 * pixelGrid * pixelW;
	h = 20 * pixelGrid * pixelH;
};

pixelGridNoUIScale

Similar to pixelGrid, but affected only by resolution, not interface size. Usually used to keep some important elements, e.g., spotlight buttons in the main menu.

class MyControl: RscText
{
	x = safezoneX + 10 * pixelGridNoUIScale * pixelW;
	y = safezoneY + 10 * pixelGridNoUIScale * pixelH;
	w = 20 * pixelGridNoUIScale * pixelW;
	h = 20 * pixelGridNoUIScale * pixelH;
};