|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.ctdp.rfdynhud.widgets.base.widget.Widget
net.ctdp.rfdynhud.widgets.base.widget.StatefulWidget<java.lang.Object,java.lang.Object>
net.ctdp.rfdynhud.widgets.base.widget.AbstractAssembledWidget
public abstract class AbstractAssembledWidget
An assembled Widget
is a master Widget
for other client Widget
s.
The client Widget
s define its actual display.
Field Summary |
---|
Fields inherited from class net.ctdp.rfdynhud.widgets.base.widget.Widget |
---|
LOG_CHANNEL, NEEDED_DATA_ALL, NEEDED_DATA_SCORING, NEEDED_DATA_TELEMETRY |
Constructor Summary | |
---|---|
protected |
AbstractAssembledWidget(float width,
boolean widthPercent,
float height,
boolean heightPercent,
boolean initParts)
Creates a new Widget. |
protected |
AbstractAssembledWidget(float width,
float height,
boolean initParts)
Creates a new Widget. |
Method Summary | |
---|---|
void |
afterConfigurationLoaded(WidgetsConfiguration widgetsConfig,
LiveGameData gameData,
boolean isEditorMode)
This event is fired right after the WidgetsConfiguration has been (re-)loaded. |
protected void |
arrangeParts(Widget[] parts)
This method is called when the configuration has been loaded. |
void |
bake(boolean convertToPixels)
Bakes effective position and size to variables, so that they don't need to be recalculated during runtime on each access. |
void |
beforeConfigurationCleared(WidgetsConfiguration widgetsConfig,
LiveGameData gameData,
boolean isEditorMode)
This event is fired right before the WidgetsConfiguration is cleared. |
protected boolean |
canHaveBackground()
Defines, if this Widget type can have a background. |
protected boolean |
checkForChanges(LiveGameData gameData,
boolean isEditorMode,
TextureImage2D texture,
int width,
int height)
Checks, if the Widget needs any changes before it is drawn. |
protected net.ctdp.rfdynhud.widgets.base.widget.AbstractAssembledWidget.AssembledGeneralStore |
createGeneralStore()
Creates a store object for all widgets of this type. |
protected net.ctdp.rfdynhud.widgets.base.widget.AbstractAssembledWidget.AssembledLocalStore |
createLocalStore()
Creates a store object for this Widget only. |
protected void |
drawWidget(Clock clock,
boolean needsCompleteRedraw,
LiveGameData gameData,
boolean isEditorMode,
TextureImage2D texture,
int offsetX,
int offsetY,
int width,
int height)
This method must contain the actual drawing code for this Widget. |
java.lang.String |
findFreePartName(java.lang.String baseName)
Finds a free name starting with 'baseName'. |
void |
forceReinitialization(boolean forwardCall)
|
java.lang.String |
getDefaultBorderValue(java.lang.String name)
Gets the default value for the given border alias/name. |
java.lang.String |
getDefaultNamedColorValue(java.lang.String name)
Gets the default value for the given named color. |
java.lang.String |
getDefaultNamedFontValue(java.lang.String name)
Gets the default value for the given named font. |
int |
getMaxHeight(LiveGameData gameData,
boolean isEditorMode)
Gets the maximum height covered by this Widget . |
int |
getMaxWidth(LiveGameData gameData,
boolean isEditorMode)
Gets the maximum width covered by this Widget . |
int |
getMinHeight(LiveGameData gameData,
boolean isEditorMode)
Gets the minimum height for this Widget in pixels. |
int |
getMinWidth(LiveGameData gameData,
boolean isEditorMode)
Gets the minimum width for this Widget in pixels. |
int |
getNeededData()
Gets the data indicators for the data needed for this Widget to be drawn (bitmask). |
protected Widget |
getNewInstanceForClone()
|
int |
getNumParts()
Gets the number of Widget parts in this AbstractAssembledWidget . |
Widget |
getPart(int index)
Gets the i-th Widget -part in this AbstractAssembledWidget . |
void |
getProperties(PropertiesContainer propsCont,
boolean forceAll)
Puts all editable properties to the editor. |
boolean |
hasMasterCanvas(boolean isEditorMode)
Returns true , if this Widget draws on the main texture, false otherwise. |
protected boolean |
hasText()
Defines, if a Widget type (potentially) contains any text. |
protected void |
initialize(LiveGameData gameData,
boolean isEditorMode,
DrawnStringFactory drawnStringFactory,
TextureImage2D texture,
int width,
int height)
This method is called once to initialized DrawnString s used on this Widget. |
protected abstract Widget[] |
initParts(float width,
boolean widthPercent,
float height,
boolean heightPercent)
|
protected void |
initSubTextures(LiveGameData gameData,
boolean isEditorMode,
int widgetInnerWidth,
int widgetInnerHeight,
SubTextureCollector collector)
Gets the TransformableTexture s, that this Widget keeps. |
void |
loadProperty(PropertyLoader loader)
Loads (and parses) a certain property from a config file. |
java.lang.Boolean |
onBoundInputStateChanged(InputAction action,
boolean state,
int modifierMask,
long when,
LiveGameData gameData,
boolean isEditorMode)
This event is fired, when a bound input component has changed its state. |
void |
onGarageEntered(LiveGameData gameData,
boolean isEditorMode)
This method is called when a the car entered the garage. |
void |
onGarageExited(LiveGameData gameData,
boolean isEditorMode)
This method is called when a the car exited the garage. |
void |
onLapStarted(VehicleScoringInfo vsi,
LiveGameData gameData,
boolean isEditorMode)
This method is called when a lap has been finished and a new one was started. |
void |
onNeededDataComplete(LiveGameData gameData,
boolean isEditorMode)
This method is called when the needed data is available in realtime mode. |
void |
onPitsEntered(LiveGameData gameData,
boolean isEditorMode)
This method is called when a the car entered the pits. |
void |
onPitsExited(LiveGameData gameData,
boolean isEditorMode)
This method is called when a the car exited the pits. |
void |
onRealtimeEntered(LiveGameData gameData,
boolean isEditorMode)
This method is called when a the user entered realtime mode. |
void |
onRealtimeExited(LiveGameData gameData,
boolean isEditorMode)
This method is called when a the user exited realtime mode. |
void |
onScoringInfoUpdated(LiveGameData gameData,
boolean isEditorMode)
This method is called when ScoringInfo have been updated (done at 2Hz). |
void |
onSessionStarted(SessionType sessionType,
LiveGameData gameData,
boolean isEditorMode)
This method is executed when a new session was started. |
void |
onTrackChanged(java.lang.String trackname,
LiveGameData gameData,
boolean isEditorMode)
This method is executed when a new track was loaded. |
protected java.lang.Boolean |
onVehicleControlChanged(VehicleScoringInfo viewedVSI,
LiveGameData gameData,
boolean isEditorMode)
This method is called when either the player's vehicle control has changed or another vehicle is being viewed. |
void |
onVehicleSetupUpdated(LiveGameData gameData,
boolean isEditorMode)
This method is called when VehicleSetup has been updated. |
void |
saveProperties(PropertyWriter writer)
Saves all settings to the config file. |
void |
setAllPosAndSizeToPercents()
|
void |
setAllPosAndSizeToPixels()
|
void |
setDirtyFlag(boolean forwardCall)
|
java.lang.Boolean |
updateVisibility(LiveGameData gameData,
boolean isEditorMode)
This method is called first by the rendering system each to check for visibility changes. |
Methods inherited from class net.ctdp.rfdynhud.widgets.base.widget.StatefulWidget |
---|
getGeneralStore, getGeneralStoreKey, getLocalStore |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractAssembledWidget(float width, boolean widthPercent, float height, boolean heightPercent, boolean initParts)
width
- negative numbers for (screen_width - width)widthPercent
- width parameter treated as percentsheight
- negative numbers for (screen_height - height)heightPercent
- height parameter treated as percentsinitParts
- this parameter must exist in your contructor and has to be forwarded to thisprotected AbstractAssembledWidget(float width, float height, boolean initParts)
width
- negative numbers for (screen_width - width)height
- negative numbers for (screen_height - height)initParts
- this parameter must exist in your contructor and has to be forwarded to thisMethod Detail |
---|
public java.lang.String findFreePartName(java.lang.String baseName)
baseName
- the name prefix
public final int getNumParts()
Widget
parts in this AbstractAssembledWidget
.
Widget
parts in this AbstractAssembledWidget
.public final Widget getPart(int index)
Widget
-part in this AbstractAssembledWidget
.
index
- the index
Widget
-part in this AbstractAssembledWidget
.protected final net.ctdp.rfdynhud.widgets.base.widget.AbstractAssembledWidget.AssembledGeneralStore createGeneralStore()
createGeneralStore
in class StatefulWidget<java.lang.Object,java.lang.Object>
null
is explicitly permitted and default implementation simply returns null
.protected final net.ctdp.rfdynhud.widgets.base.widget.AbstractAssembledWidget.AssembledLocalStore createLocalStore()
createLocalStore
in class StatefulWidget<java.lang.Object,java.lang.Object>
null
is explicitly permitted and default implementation simply returns null
.protected void arrangeParts(Widget[] parts)
parts
- the parts to arrangepublic java.lang.String getDefaultBorderValue(java.lang.String name)
getDefaultBorderValue
in class Widget
name
- the border name to query
public java.lang.String getDefaultNamedColorValue(java.lang.String name)
getDefaultNamedColorValue
in class Widget
name
- the color name to query
public java.lang.String getDefaultNamedFontValue(java.lang.String name)
getDefaultNamedFontValue
in class Widget
name
- the font name to query
protected void initSubTextures(LiveGameData gameData, boolean isEditorMode, int widgetInnerWidth, int widgetInnerHeight, SubTextureCollector collector)
TransformableTexture
s, that this Widget
keeps.
initSubTextures
in class Widget
gameData
- the live game dataisEditorMode
- rendering in the editor?widgetInnerWidth
- the total widget width excluding borderswidgetInnerHeight
- the total widget height excluding borderscollector
- the collector to collect all the sub texturespublic void setDirtyFlag(boolean forwardCall)
public void forceReinitialization(boolean forwardCall)
public int getMinWidth(LiveGameData gameData, boolean isEditorMode)
Widget
in pixels.
getMinWidth
in class Widget
gameData
- the live game dataisEditorMode
- rendering in the editor?
Widget
in pixels.public int getMinHeight(LiveGameData gameData, boolean isEditorMode)
Widget
in pixels.
getMinHeight
in class Widget
gameData
- the live game dataisEditorMode
- rendering in the editor?
Widget
in pixels.public int getMaxWidth(LiveGameData gameData, boolean isEditorMode)
Widget
.
By default this method returns the result of getEffectiveWidth(gameResX).
Override this method, if it will change its size during game play.
getMaxWidth
in class Widget
gameData
- the live game dataisEditorMode
- rendering in the editor?
Widget
.public int getMaxHeight(LiveGameData gameData, boolean isEditorMode)
Widget
.
By default this method returns the result of getEffectiveHeight(gameResX).
Override this method, if it will change its size during game play.
getMaxHeight
in class Widget
gameData
- the live game dataisEditorMode
- rendering in the editor?
Widget
.public void bake(boolean convertToPixels)
bake
in class Widget
convertToPixels
- if true, all coordinates are converted to absolute pixels and positioned to TOP_LEFT.public void setAllPosAndSizeToPercents()
setAllPosAndSizeToPercents
in class Widget
public void setAllPosAndSizeToPixels()
setAllPosAndSizeToPixels
in class Widget
public java.lang.Boolean updateVisibility(LiveGameData gameData, boolean isEditorMode)
Widget.onBoundInputStateChanged(InputAction, boolean, int, long, LiveGameData, boolean)
method.
Automatic visiblity can also override the result.
updateVisibility
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactor
true
to set visible, false
to set invisible, null
for no change in visibility.Widget.getUpdatedVisibility()
public int getNeededData()
Widget
to be drawn (bitmask).
getNeededData
in class Widget
Widget
to be drawn.Widget.NEEDED_DATA_TELEMETRY
,
Widget.NEEDED_DATA_SCORING
,
Widget.NEEDED_DATA_SCORING
public void afterConfigurationLoaded(WidgetsConfiguration widgetsConfig, LiveGameData gameData, boolean isEditorMode)
WidgetsConfiguration
has been (re-)loaded.
afterConfigurationLoaded
in class Widget
widgetsConfig
- the widgets configurationgameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void beforeConfigurationCleared(WidgetsConfiguration widgetsConfig, LiveGameData gameData, boolean isEditorMode)
WidgetsConfiguration
is cleared.
beforeConfigurationCleared
in class Widget
widgetsConfig
- the widgets configurationgameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onTrackChanged(java.lang.String trackname, LiveGameData gameData, boolean isEditorMode)
onTrackChanged
in class Widget
trackname
- the current track's namegameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onSessionStarted(SessionType sessionType, LiveGameData gameData, boolean isEditorMode)
onSessionStarted
in class Widget
sessionType
- the current session typegameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onRealtimeEntered(LiveGameData gameData, boolean isEditorMode)
Widget
needs some data
to be drawn correctly, consider using Widget.onNeededDataComplete(LiveGameData, boolean)
.
onRealtimeEntered
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onScoringInfoUpdated(LiveGameData gameData, boolean isEditorMode)
ScoringInfo
have been updated (done at 2Hz).
onScoringInfoUpdated
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onVehicleSetupUpdated(LiveGameData gameData, boolean isEditorMode)
VehicleSetup
has been updated.
onVehicleSetupUpdated
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onNeededDataComplete(LiveGameData gameData, boolean isEditorMode)
onNeededDataComplete
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onPitsEntered(LiveGameData gameData, boolean isEditorMode)
onPitsEntered
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onGarageEntered(LiveGameData gameData, boolean isEditorMode)
onGarageEntered
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onGarageExited(LiveGameData gameData, boolean isEditorMode)
onGarageExited
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onPitsExited(LiveGameData gameData, boolean isEditorMode)
onPitsExited
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onRealtimeExited(LiveGameData gameData, boolean isEditorMode)
onRealtimeExited
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorprotected java.lang.Boolean onVehicleControlChanged(VehicleScoringInfo viewedVSI, LiveGameData gameData, boolean isEditorMode)
onVehicleControlChanged
in class Widget
viewedVSI
- the currently viewed vehiclegameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactor
true
to set visible, false
to set invisible, null
for no change in visibility.
This doesn't affect the visiblity toggled by the Widget.updateVisibility(LiveGameData, boolean)
method or Widget.onBoundInputStateChanged(InputAction, boolean, int, long, LiveGameData, boolean)
method.Widget.getAutoVisibility()
public void onLapStarted(VehicleScoringInfo vsi, LiveGameData gameData, boolean isEditorMode)
onLapStarted
in class Widget
vsi
- the driver, who started the lap. If this is the leader and the session type is RACE, the whole race has moved on to the next lap.gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic java.lang.Boolean onBoundInputStateChanged(InputAction action, boolean state, int modifierMask, long when, LiveGameData gameData, boolean isEditorMode)
onBoundInputStateChanged
in class Widget
action
- the triggered actionstate
- the state of the input device componentmodifierMask
- see InputAction
when
- the timestamp in nano secondsgameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactor
true
to set visible, false
to set invisible, null
for no change in visibility.
This doesn't affect the visiblity toggled by the Widget.updateVisibility(LiveGameData, boolean)
method.
Automatic visiblity can also override the result.Widget.getInputVisibility()
public boolean hasMasterCanvas(boolean isEditorMode)
true
, if this Widget
draws on the main texture, false
otherwise.true
.
hasMasterCanvas
in class Widget
isEditorMode
- true
, if the Editor is used for rendering instead of rFactor
true
, if this Widget
draws on the main texture, false
otherwise.protected void initialize(LiveGameData gameData, boolean isEditorMode, DrawnStringFactory drawnStringFactory, TextureImage2D texture, int width, int height)
DrawnString
s used on this Widget.
initialize
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactordrawnStringFactory
- a factory to get DrawnString
instances fromtexture
- the texture image to draw on. Use TextureImage2D.getTextureCanvas()
to retrieve the Texture2DCanvas
for Graphics2D drawing.width
- the width on the textureheight
- the height on the textureprotected boolean checkForChanges(LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int width, int height)
Widget.drawBorder(boolean, BorderWrapper, TextureImage2D, int, int, int, int)
and possibly Widget.drawBackground(LiveGameData, boolean, TextureImage2D, int, int, int, int, boolean)
are (re-)invoked.
checkForChanges
in class Widget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactortexture
- the texture image to draw on. Use TextureImage2D.getTextureCanvas()
to retrieve the Texture2DCanvas
for Graphics2D drawing.width
- the width on the textureheight
- the height on the texture
protected void drawWidget(Clock clock, boolean needsCompleteRedraw, LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int offsetX, int offsetY, int width, int height)
drawWidget
in class Widget
clock
- this is a clock for very dynamic content, that needs smooth display. If 'needsCompleteRedraw' is true, clock1 is also true.needsCompleteRedraw
- whether this widget needs to be completely redrawn (true) or just the changed parts (false)gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactortexture
- the texture image to draw on. Use TextureImage2D.getTextureCanvas()
to retrieve the Texture2DCanvas
for Graphics2D drawing.offsetX
- the x-offset on the textureoffsetY
- the y-offset on the texturewidth
- the width on the textureheight
- the height on the texturepublic void saveProperties(PropertyWriter writer) throws java.io.IOException
saveProperties
in interface PropertiesKeeper
saveProperties
in class Widget
writer
- the widgets configuration writer to write properties to
java.io.IOException
- if something went wrongpublic void loadProperty(PropertyLoader loader)
loadProperty
in interface PropertiesKeeper
loadProperty
in class Widget
loader
- the property loader to load properties frompublic void getProperties(PropertiesContainer propsCont, boolean forceAll)
getProperties
in interface PropertiesKeeper
getProperties
in class Widget
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this PropertiesKeeper
must be added.
If false
, only the properties, that are relevant for the current PropertiesKeeper
's situation have to be added, some can be ignored.protected Widget getNewInstanceForClone()
getNewInstanceForClone
in class Widget
protected boolean hasText()
false
, the editor won't provide font or font-color selection.
Should return a contant value.
hasText
in class Widget
protected final boolean canHaveBackground()
canHaveBackground
in class Widget
protected abstract Widget[] initParts(float width, boolean widthPercent, float height, boolean heightPercent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |