OpenTTD
Typedefs | Enumerations | Functions | Variables
transparency.h File Reference

Functions related to transparency. More...

#include "gfx_func.h"
#include "openttd.h"
#include "core/bitmath_func.hpp"

Go to the source code of this file.

Typedefs

typedef uint TransparencyOptionBits
 transparency option bits
 

Enumerations

enum  TransparencyOption {
  TO_SIGNS = 0, TO_TREES, TO_HOUSES, TO_INDUSTRIES,
  TO_BUILDINGS, TO_BRIDGES, TO_STRUCTURES, TO_CATENARY,
  TO_LOADING, TO_END, TO_INVALID
}
 Transparency option bits: which position in _transparency_opt stands for which transparency. More...
 

Functions

static bool IsTransparencySet (TransparencyOption to)
 Check if the transparency option bit is set and if we aren't in the game menu (there's never transparency) More...
 
static bool IsInvisibilitySet (TransparencyOption to)
 Check if the invisibility option bit is set and if we aren't in the game menu (there's never transparency) More...
 
static void ToggleTransparency (TransparencyOption to)
 Toggle the transparency option bit. More...
 
static void ToggleInvisibility (TransparencyOption to)
 Toggle the invisibility option bit. More...
 
static void ToggleInvisibilityWithTransparency (TransparencyOption to)
 Toggles between invisible and solid state. More...
 
static void ToggleTransparencyLock (TransparencyOption to)
 Toggle the transparency lock bit. More...
 
static void ResetRestoreAllTransparency ()
 Set or clear all non-locked transparency options.
 

Variables

TransparencyOptionBits _transparency_opt
 The bits that should be transparent.
 
TransparencyOptionBits _transparency_lock
 Prevent these bits from flipping with X.
 
TransparencyOptionBits _invisibility_opt
 The bits that should be invisible.
 
byte _display_opt
 What do we want to draw/do?
 

Detailed Description

Functions related to transparency.

Definition in file transparency.h.

Enumeration Type Documentation

◆ TransparencyOption

Transparency option bits: which position in _transparency_opt stands for which transparency.

If you change the order, change the order of the ShowTransparencyToolbar() stuff in transparency_gui.cpp too. If you add or remove an option don't forget to change the transparency 'hot keys' in main_gui.cpp.

Enumerator
TO_SIGNS 

signs

TO_TREES 

trees

TO_HOUSES 

town buildings

TO_INDUSTRIES 

industries

TO_BUILDINGS 

company buildings - depots, stations, HQ, ...

TO_BRIDGES 

bridges

TO_STRUCTURES 

other objects such as transmitters and lighthouses

TO_CATENARY 

catenary

TO_LOADING 

loading indicators

TO_INVALID 

Invalid transparency option.

Definition at line 24 of file transparency.h.

Function Documentation

◆ IsInvisibilitySet()

static bool IsInvisibilitySet ( TransparencyOption  to)
inlinestatic

Check if the invisibility option bit is set and if we aren't in the game menu (there's never transparency)

Parameters
tothe structure which invisibility option is ask for

Definition at line 61 of file transparency.h.

References _invisibility_opt, _transparency_opt, and HasBit().

Referenced by DrawCommonTileSeq(), DrawRoadCatenary(), DrawWaterTileStruct(), HasRailCatenaryDrawn(), and ToggleInvisibilityWithTransparency().

◆ IsTransparencySet()

static bool IsTransparencySet ( TransparencyOption  to)
inlinestatic

Check if the transparency option bit is set and if we aren't in the game menu (there's never transparency)

Parameters
tothe structure which transparency option is ask for

Definition at line 50 of file transparency.h.

References _transparency_opt, and HasBit().

Referenced by DrawCommonTileSeq(), DrawRoadCatenary(), and TransparenciesWindow::OnInvalidateData().

◆ ToggleInvisibility()

static void ToggleInvisibility ( TransparencyOption  to)
inlinestatic

Toggle the invisibility option bit.

Parameters
tothe structure which invisibility option is toggle

Definition at line 81 of file transparency.h.

References _invisibility_opt, and ToggleBit().

◆ ToggleInvisibilityWithTransparency()

static void ToggleInvisibilityWithTransparency ( TransparencyOption  to)
inlinestatic

Toggles between invisible and solid state.

If object is transparent, then it is made invisible. Used by the keyboard shortcuts.

Parameters
tothe object type which invisibility option to toggle

Definition at line 93 of file transparency.h.

References _invisibility_opt, _transparency_opt, ClrBit(), IsInvisibilitySet(), and SetBit().

◆ ToggleTransparency()

static void ToggleTransparency ( TransparencyOption  to)
inlinestatic

Toggle the transparency option bit.

Parameters
tothe transparency option to be toggled

Definition at line 71 of file transparency.h.

References _transparency_opt, and ToggleBit().

Referenced by TransparenciesWindow::OnClick().

◆ ToggleTransparencyLock()

static void ToggleTransparencyLock ( TransparencyOption  to)
inlinestatic

Toggle the transparency lock bit.

Parameters
tothe transparency option to be locked or unlocked

Definition at line 109 of file transparency.h.

References _transparency_lock, and ToggleBit().

Referenced by TransparenciesWindow::OnClick().