OpenTTD Source 20241224-master-gee860a5c8e
ViewportSign Struct Reference

Location information about a sign as seen on the viewport. More...

#include <viewport_type.h>

Inheritance diagram for ViewportSign:
TextEffect TrackedViewportSign

Public Member Functions

auto operator<=> (const ViewportSign &) const =default
 
void UpdatePosition (int center, int top, StringID str, StringID str_small=STR_NULL)
 Update the position of the viewport sign.
 
void MarkDirty (ZoomLevel maxzoom=ZOOM_LVL_MAX) const
 Mark the sign dirty in all viewports.
 

Data Fields

int32_t center
 The center position of the sign.
 
int32_t top
 The top of the sign.
 
uint16_t width_normal
 The width when not zoomed out (normal font)
 
uint16_t width_small
 The width when zoomed out (small font)
 

Detailed Description

Location information about a sign as seen on the viewport.

Definition at line 38 of file viewport_type.h.

Member Function Documentation

◆ UpdatePosition()

void ViewportSign::UpdatePosition ( int  center,
int  top,
StringID  str,
StringID  str_small = STR_NULL 
)

Update the position of the viewport sign.

Parameters
centerthe (preferred) center of the viewport sign
topthe new top of the sign
strthe string to show in the sign
str_smallthe string to show when zoomed out. STR_NULL means same as str

Definition at line 1466 of file viewport.cpp.

References Align(), center, FS_SMALL, WidgetDimensions::fullbevel, GetString(), GetStringBoundingBox(), MarkDirty(), WidgetDimensions::scaled, top, width_normal, and width_small.

Referenced by TrackedViewportSign::UpdatePosition().

Field Documentation

◆ center

int32_t ViewportSign::center

The center position of the sign.

Definition at line 39 of file viewport_type.h.

Referenced by CheckClickOnViewportSign(), MarkDirty(), UpdatePosition(), and ViewportAddString().

◆ top

int32_t ViewportSign::top

The top of the sign.

Definition at line 40 of file viewport_type.h.

Referenced by CheckClickOnViewportSign(), UpdatePosition(), TrackedViewportSign::UpdatePosition(), and ViewportAddString().

◆ width_normal

uint16_t ViewportSign::width_normal

The width when not zoomed out (normal font)

Definition at line 41 of file viewport_type.h.

Referenced by CheckClickOnViewportSign(), MarkDirty(), TextEffect::Reset(), UpdatePosition(), and ViewportAddString().

◆ width_small

uint16_t ViewportSign::width_small

The width when zoomed out (small font)

Definition at line 42 of file viewport_type.h.

Referenced by CheckClickOnViewportSign(), MarkDirty(), UpdatePosition(), and ViewportAddString().


The documentation for this struct was generated from the following files: