Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ColorPickButtonElement
- ConstructionScreen
- ContextActionDisplay
- ControlBarDisplay
- DialogElement
- DynamicFadedBitmapElement
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GameInfoDisplayMobile
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiTopDownCursor
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDSliderElement
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InfoDisplay
- InfoHUDBox
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputGlyphElementUI
- InputHelpDisplay
- KeyValueInfoHUDBox
- ListElement
- ListItemElement
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PictureElement
- PlatformIconElement
- PlayerControlPadDisplay
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- ScrollingLayoutElement
- SettingsModel
- SideNotification
- SideNotificationMobile
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- SpeedSliderDisplay
- StatusBar
- SteeringSliderDisplay
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TerrainLayerElement
- TextBackdropElement
- TextElement
- TextInputElement
- ThreePartBitmapElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VariableWorkWidthHUDExten...
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- WardrobeScreen
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
InfoDisplay
DescriptionHUD player informationParent
HUDDisplayElementFunctions
- createBackground
- draw
- getBackgroundPosition
- getDisplayHeight
- setEnabled
- setScale
- storeScaledValues
- update
- updateSize
createBackground
DescriptionCreate the background overlay.Definition
createBackground()Code
152 | function InfoDisplay.createBackground() |
153 | local posX, posY = InfoDisplay.getBackgroundPosition(1) |
154 | local width, height = getNormalizedScreenValues(unpack(InfoDisplay.SIZE.SELF)) |
155 | |
156 | local overlay = Overlay.new(g_baseUIFilename, posX, posY, width, height) |
157 | overlay:setUVs(g_colorBgUVs) |
158 | overlay:setColor(1, 0, 0, 0.75) |
159 | |
160 | return overlay |
161 | end |
draw
DescriptionDefinitiondraw()Code
97 | function InfoDisplay:draw() |
98 | if not self.isEnabled then |
99 | return |
100 | end |
101 | |
102 | InfoDisplay:superClass().draw(self) |
103 | |
104 | local posX, posY = 1 - g_safeFrameOffsetX, g_safeFrameOffsetY |
105 | |
106 | for i = #self.boxes, 1, -1 do |
107 | local box = self.boxes[i] |
108 | |
109 | if box:canDraw() then |
110 | box:draw(posX, posY) |
111 | |
112 | posY = posY + box:getDisplayHeight() + self.boxMarginY |
113 | end |
114 | end |
115 | end |
getBackgroundPosition
DescriptionGet the scaled background position.Definition
getBackgroundPosition()Code
123 | function InfoDisplay.getBackgroundPosition(uiScale) |
124 | local width, _ = getNormalizedScreenValues(unpack(InfoDisplay.SIZE.SELF)) |
125 | local posX = 1 - g_safeFrameOffsetX - width * uiScale |
126 | local posY = g_safeFrameOffsetY |
127 | |
128 | return posX, posY |
129 | end |
getDisplayHeight
DescriptionDefinitiongetDisplayHeight()Code
87 | function InfoDisplay:getDisplayHeight() |
88 | if self.isEnabled then |
89 | return self.totalHeight |
90 | else |
91 | return 0 |
92 | end |
93 | end |
setEnabled
DescriptionDefinitionsetEnabled()Code
32 | function InfoDisplay:setEnabled(isEnabled) |
33 | self.isEnabled = isEnabled |
34 | end |
setScale
DescriptionSet this element's UI scale factor.Definition
setScale(float uiScale)Arguments
float | uiScale | UI scale factor |
134 | function InfoDisplay:setScale(uiScale) |
135 | InfoDisplay:superClass().setScale(self, uiScale, uiScale) |
136 | self.uiScale = uiScale |
137 | self:storeScaledValues() |
138 | |
139 | for _, box in ipairs(self.boxes) do |
140 | self:setScale(uiScale) |
141 | end |
142 | end |
storeScaledValues
DescriptionStore scaled position and size values.Definition
storeScaledValues()Code
146 | function InfoDisplay:storeScaledValues() |
147 | self.boxMarginY = self:scalePixelToScreenHeight(InfoDisplay.SIZE.BOX_MARGIN) |
148 | end |
update
DescriptionDefinitionupdate()Code
61 | function InfoDisplay:update(dt) |
62 | InfoDisplay:superClass().update(self, dt) |
63 | |
64 | if self.isEnabled then |
65 | self:updateSize() |
66 | end |
67 | end |
updateSize
DescriptionUpdate the info display size depending on used rows.Definition
updateSize()Code
71 | function InfoDisplay:updateSize() |
72 | local height = 0 |
73 | |
74 | for i = 1, #self.boxes do |
75 | local box = self.boxes[i] |
76 | |
77 | if box:canDraw() then |
78 | height = height + box:getDisplayHeight() + self.boxMarginY |
79 | end |
80 | end |
81 | |
82 | self.totalHeight = height |
83 | end |