OpenTTD Source: src/core/geometry_type.hpp File Reference

OpenTTD Source 15.0-RC2

Data Structures | Typedefs | Functions
geometry_type.hpp File Reference

All geometry types in OpenTTD. More...

Go to the source code of this file.

## Data Structures
struct | Coord2D< T >
| A coordinate with two dimensons. More...
struct | Coord3D< T >
| A coordinate with three dimensions. More...
struct | Dimension
| Dimensions (a width and height) of a rectangle in 2D. More...
struct | RectPadding
| Padding dimensions to apply to each side of a Rect. More...
struct | Rect
| Specification of a rectangle with absolute coordinates of all edges. More...
struct | PointDimension
| Specification of a rectangle with an absolute top-left coordinate and a (relative) width/height. More...

## Typedefs
using | Point = Coord2D< int >
| Coordinates of a point in 2D.

## Functions
int | CentreBounds (int min, int max, int size)
| Determine where to position a centred object.

## Detailed Description

All geometry types in OpenTTD.

Definition in file geometry_type.hpp.

## Typedef Documentation

## ◆ Point

using Point = Coord2D<int>

Coordinates of a point in 2D.

Definition at line 53 of file geometry_type.hpp.

## Function Documentation

## ◆ CentreBounds()

int CentreBounds | ( | int | min,
|  | int | max,
|  | int | size
| ) |  |
| inline

Determine where to position a centred object.

Parameters

  min | The top or left coordinate.
  max | The bottom or right coordinate.
  size | The height or width of the object to draw.

Returns
  Offset of where to position the object.

Definition at line 26 of file geometry_type.hpp.

Referenced by Rect::CentreToHeight(), DrawAircraftImage(), StationViewWindow::DrawCargoIcons(), DrawCharCentered(), DrawCloseBox(), DrawCompanyManagerFace(), DrawEngineList(), VehicleGroupWindow::DrawGroupInfo(), DrawRoadVehImage(), DrawShipImage(), BuildSignalWindow::DrawSignalSprite(), DrawTrainImage(), NewGRFInspectWindow::DrawVehicleChainWidget(), BuildAirportWindow::DrawWidget(), CompanyWindow::DrawWidget(), GraphLegendWindow::DrawWidget(), PerformanceRatingDetailWindow::DrawWidget(), LinkGraphLegendWindow::DrawWidget(), BaseNetworkContentDownloadStatusWindow::DrawWidget(), NetworkJoinStatusWindow::DrawWidget(), NewGRFWindow::DrawWidget(), ScanProgressWindow::DrawWidget(), NewsWindow::DrawWidget(), StatusBarWindow::DrawWidget(), BuildTreesWindow::DrawWidget(), RefitWindow::DrawWidget(), VehicleDetailsWindow::DrawWidget(), VehicleViewWindow::DrawWidget(), ScriptDebugWindow::DrawWidgetCompanyButton(), GetAlignedPosition(), and SmallMapWindow::GetStationMiddle().