|
||||||||||
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
public abstract class Widget
This is the base for all Widgets to be drawn on the HUD.
Any concrete extension must have a parameterless constructor.
Field Summary | |
---|---|
static LogChannel |
LOG_CHANNEL
|
static int |
NEEDED_DATA_ALL
|
static int |
NEEDED_DATA_SCORING
|
static int |
NEEDED_DATA_TELEMETRY
|
Constructor Summary | |
---|---|
protected |
Widget(WidgetSet widgetSet,
WidgetPackage widgetPackage,
float width,
boolean widthPercent,
float height,
boolean heightPercent)
Creates a new Widget . |
protected |
Widget(WidgetSet widgetSet,
WidgetPackage widgetPackage,
float width,
float height)
Creates a new Widget . |
Method Summary | |
---|---|
protected void |
addBackgroundPropertyToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the background property to the container. |
protected void |
addBorderPropertyToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the border property to the container. |
protected void |
addFontPropertiesToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the font and font color properties to the container. |
protected void |
addPaddingPropertiesToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the padding properties to the container. |
protected void |
addPositionAndSizePropertiesToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the position and size properties to the PropertiesContainer . |
protected void |
addTypeAndNamePropertiesToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the type and name properties to the PropertiesContainer . |
protected void |
addVisibilityPropertiesToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the visibility properties to the PropertiesContainer . |
void |
afterConfigurationLoaded(WidgetsConfiguration widgetsConfig,
LiveGameData gameData,
boolean isEditorMode)
This event is fired right after the WidgetsConfiguration has been (re-)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 |
canHaveBorder()
Defines, if this Widget type can have a border. |
protected boolean |
checkForChanges(LiveGameData gameData,
boolean isEditorMode,
TextureImage2D texture,
int width,
int height)
Checks, if the Widget needs any changes before it is drawn. |
boolean |
clearBackgroundRegion(TextureImage2D texture,
int offsetX,
int offsetY,
int localX,
int localY,
int width,
int height,
boolean markDirty,
Rect2i dirtyRect)
Clears the given part of the Widget area with the current background. |
void |
clearRegion(TextureImage2D texture,
int offsetX,
int offsetY)
Clears the region on the texture, that is covered by this Widget . |
protected void |
clearRegion(TextureImage2D texture,
int offsetX,
int offsetY,
int width,
int height)
|
Widget |
clone()
|
protected boolean |
cloneProperty(Property src,
Property trg)
Clones the value of the src property to the trg property. |
protected void |
debug(java.lang.Object... data)
Logs data to the plugin's log file. |
protected void |
debugCS(java.lang.Object... data)
Logs data to the plugin's log file. |
protected void |
drawBackground(LiveGameData gameData,
boolean isEditorMode,
TextureImage2D texture,
int offsetX,
int offsetY,
int width,
int height,
boolean isRoot)
You can use this method to directly draw static content onto your Widget's background. |
protected void |
drawBorder(boolean isEditorMode,
BorderWrapper border,
TextureImage2D texture,
int offsetX,
int offsetY,
int width,
int height)
|
void |
drawWidget(Clock clock,
boolean completeRedrawForced,
LiveGameData gameData,
boolean isEditorMode,
TextureImage2D texture,
boolean drawAtZero)
This method invokes the parts of the actual drawing code for this Widget. |
protected abstract 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. |
void |
forceAndSetDirty(boolean mergedBackgroundToo)
This simply calls forceCompleteRedraw(boolean) , forceReinitialization() and setDirtyFlag() . |
void |
forceCompleteRedraw(boolean mergedBackgroundToo)
Forces a complete redraw on the next render. |
void |
forceReinitialization()
|
int |
getAbsoluteOffsetX()
Gets the absolute x-position relative to the configuration origin. |
int |
getAbsoluteOffsetY()
Gets the absolute y-position relative to the configuration origin. |
boolean |
getAutoVisibility()
Gets the automatically toggled visibility flag. |
WidgetBackground |
getBackground()
Gets the Widget 's background. |
BackgroundProperty |
getBackgroundProperty()
|
BorderWrapper |
getBorder()
Returns a BorderWrapper , that encapsulates the actual used border with convenience wrappers for the size getters. |
protected BorderProperty |
getBorderProperty()
|
WidgetsConfiguration |
getConfiguration()
Gets the WidgetsConfiguration , this Widget is a member of. |
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. |
boolean |
getDirtyFlag(boolean reset)
|
java.lang.String |
getDocumentationSource()
|
protected DrawnStringFactory |
getDrawnStringFactory()
Gets the Widget 's DrawnStringFactory . |
int |
getEffectiveHeight()
Gets the result of getSize().getEffectiveHeight(). |
int |
getEffectiveWidth()
Gets the result of getSize().getEffectiveWidth(). |
protected java.awt.Font |
getFont()
|
protected java.awt.Color |
getFontColor()
Gets the Widget 's font color. |
ColorProperty |
getFontColorProperty()
|
FontProperty |
getFontProperty()
|
protected java.lang.String |
getInitialBackground()
Gets the initial value for the background property. |
InnerSize |
getInnerSize()
Gets the inner size of the Widget . |
InputAction[] |
getInputActions()
Gets the InputActions, that can be bound with a Widget of this type. |
boolean |
getInputVisibility()
Gets this Widget's visibility usually controlled by the ToggleWidgetVisibility InputAction. |
AbstractAssembledWidget |
getMasterWidget()
If this Widget is part of an AbstractAssembledWidget , this master Widget is returned. |
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. |
java.lang.String |
getName()
Gets this Widget 's name. |
int |
getNeededData()
Gets the data indicators for the data needed for this Widget to be drawn (bitmask). |
protected Widget |
getNewInstanceForClone()
|
int |
getOffsetXToRootMasterWidget()
Gets the x-offset relative to the master Widget. |
int |
getOffsetYToRootMasterWidget()
Gets the y-offset relative to the master Widget. |
protected int |
getPaddingBottom()
|
protected int |
getPaddingLeft()
|
protected IntProperty |
getPaddingPropertyBottom()
|
protected IntProperty |
getPaddingPropertyLeft()
|
protected IntProperty |
getPaddingPropertyRight()
|
protected IntProperty |
getPaddingPropertyTop()
|
protected int |
getPaddingRight()
|
protected int |
getPaddingTop()
|
Position |
getPosition()
Gets the Widget 's position. |
void |
getProperties(PropertiesContainer propsCont,
boolean forceAll)
Puts all editable properties to the editor. |
protected void |
getPropertiesForParentGroup(PropertiesContainer propsCont,
boolean forceAll)
Puts all editable properties to the editor. |
java.util.Iterator<Property> |
getPropertiesIterator()
Gets an Iterator to iterate all properties, defined in this class. |
Size |
getSize()
Gets this Widget 's size. |
TransformableTexture[] |
getSubTextures(LiveGameData gameData,
boolean isEditorMode,
int widgetInnerWidth,
int widgetInnerHeight)
Gets the TransformableTexture s, that this Widget keeps. |
boolean |
getUpdatedVisibility()
Gets this Widget's user visibility flag 2. |
WidgetController |
getWidgetController()
|
WidgetPackage |
getWidgetPackage()
Gets the package to group the Widget in the editor. |
WidgetSet |
getWidgetSet()
Gets the WidgetSet this Widget belongs to. |
int |
getZIndex()
Gets the Widget 's z-index relative to other Widget s in the same configuration. |
protected boolean |
hasBorder()
Gets whether this Widget has a border or not. |
boolean |
hasFixedSize()
Gets, whether this Widget has a fixed (unmodifiable) size. |
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 abstract 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 void |
initSubTextures(LiveGameData gameData,
boolean isEditorMode,
int widgetInnerWidth,
int widgetInnerHeight,
SubTextureCollector collector)
Gets the TransformableTexture s, that this Widget keeps. |
protected boolean |
isFontAntiAliased()
|
boolean |
isVisible()
Gets this Widget's total visibility flag ( getInputVisibility() && getAutoVisibility() && getUpdatedVisibility() ). |
void |
loadProperty(PropertyLoader loader)
Loads (and parses) a certain property from a config file. |
protected void |
log(LogLevel logLevel,
java.lang.Object... data)
Logs data to the plugin's log file. |
protected void |
log(java.lang.Object... data)
Logs data to the plugin's log file. |
protected void |
logCS(LogLevel logLevel,
java.lang.Object... data)
Logs data to the plugin's log file. |
protected void |
logCS(java.lang.Object... data)
Logs data to the plugin's log file. |
protected void |
onBackgroundChanged(boolean imageChanged,
float deltaScaleX,
float deltaScaleY)
This method is invoked when the background has changed. |
protected 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. |
protected void |
onCanvasSizeChanged()
|
protected void |
onCompleteRedrawForced()
This method is called when a complete redraw has been forced. |
protected void |
onDirtyFlagSet()
|
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. |
protected void |
onPositionChanged(RelativePositioning oldPositioning,
int oldX,
int oldY,
RelativePositioning newPositioning,
int newX,
int newY)
|
void |
onPropertyChanged(Property property,
java.lang.Object oldValue,
java.lang.Object newValue)
Invoked when a kept Property has changed. |
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. |
protected void |
onReinitializationForced()
|
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. |
protected void |
onSizeChanged(int oldWidth,
int oldHeight,
int newWidth,
int newHeight)
|
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. |
protected void |
onVisibilityChanged(boolean visible)
|
void |
prepareForMenuItem()
This method is called by the editor before it draws the Widget to a menu item. |
void |
saveProperties(PropertyWriter writer)
Saves all settings to the config file. |
void |
setAllPosAndSizeToPercents()
|
void |
setAllPosAndSizeToPixels()
|
void |
setDirtyFlag()
|
void |
setName(java.lang.String name)
Sets this Widget 's name. |
protected void |
setPadding(int top,
int left,
int right,
int bottom)
Sets padding for this Widget. |
void |
setWidgetController(WidgetController controller)
|
void |
setZIndex(int zIndex)
Sets the Widget 's z-index relative to other Widget s in the same configuration. |
protected java.lang.Boolean |
updateVisibility(LiveGameData gameData,
boolean isEditorMode)
This method is called first by the rendering system each to check for visibility changes. |
boolean |
visibilityChangedSinceLastDraw()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final LogChannel LOG_CHANNEL
public static final int NEEDED_DATA_TELEMETRY
public static final int NEEDED_DATA_SCORING
public static final int NEEDED_DATA_ALL
Constructor Detail |
---|
protected Widget(WidgetSet widgetSet, WidgetPackage widgetPackage, float width, boolean widthPercent, float height, boolean heightPercent)
Widget
.
widgetSet
- the WidgetSet
this Widget
belongs towidgetPackage
- the package in the editorwidth
- negative numbers for (screen_width - width)widthPercent
- width parameter treated as percentsheight
- negative numbers for (screen_height - height)heightPercent
- height parameter treated as percentsprotected Widget(WidgetSet widgetSet, WidgetPackage widgetPackage, float width, float height)
Widget
.
widgetSet
- the WidgetSet
this Widget
belongs towidgetPackage
- the package in the editorwidth
- negative numbers for (screen_width - width)height
- negative numbers for (screen_height - height)Method Detail |
---|
protected java.lang.String getInitialBackground()
protected void onBackgroundChanged(boolean imageChanged, float deltaScaleX, float deltaScaleY)
imageChanged
- whether the image has changeddeltaScaleX
- the x-scale factor in as a difference between the old background image and the new one or -1 of no background image was selecteddeltaScaleY
- the y-scale factor in as a difference between the old background image and the new one or -1 of no background image was selectedprotected final void log(LogLevel logLevel, java.lang.Object... data)
logLevel
- the log leveldata
- the data to logprotected final void logCS(LogLevel logLevel, java.lang.Object... data)
logLevel
- the log leveldata
- the data to log (comma separated)protected final void log(java.lang.Object... data)
data
- the data to logprotected final void logCS(java.lang.Object... data)
data
- the data to log (comma separated)protected final void debug(java.lang.Object... data)
data
- the data to logprotected final void debugCS(java.lang.Object... data)
data
- the data to log (comma separated)public void setWidgetController(WidgetController controller)
public final WidgetController getWidgetController()
protected void onVisibilityChanged(boolean visible)
public void onPropertyChanged(Property property, java.lang.Object oldValue, java.lang.Object newValue)
Property
has changed.
onPropertyChanged
in interface PropertiesKeeper
property
- the changed propertyoldValue
- the old valuenewValue
- the new valueprotected void onPositionChanged(RelativePositioning oldPositioning, int oldX, int oldY, RelativePositioning newPositioning, int newX, int newY)
oldPositioning
- the old value for the positioningoldX
- the old xoldY
- the old ynewPositioning
- the new value for the positioningnewX
- the new xnewY
- the new yprotected void onSizeChanged(int oldWidth, int oldHeight, int newWidth, int newHeight)
oldWidth
- the old widtholdHeight
- the old heightnewWidth
- the new widthnewHeight
- the new heightprotected void onCanvasSizeChanged()
public final WidgetSet getWidgetSet()
WidgetSet
this Widget
belongs to.
WidgetSet
this Widget
belongs to.public final WidgetPackage getWidgetPackage()
null
to be displayed in the root or a slash separated path.
public java.lang.String getDefaultBorderValue(java.lang.String name)
name
- the border name to query
public java.lang.String getDefaultNamedColorValue(java.lang.String name)
name
- the color name to query
public java.lang.String getDefaultNamedFontValue(java.lang.String name)
name
- the font name to query
public final WidgetsConfiguration getConfiguration()
WidgetsConfiguration
, this Widget
is a member of.
WidgetsConfiguration
, this Widget
is a member of.public final AbstractAssembledWidget getMasterWidget()
Widget
is part of an AbstractAssembledWidget
, this master Widget
is returned.
AbstractAssembledWidget
or null
.public InputAction[] getInputActions()
protected abstract void initSubTextures(LiveGameData gameData, boolean isEditorMode, int widgetInnerWidth, int widgetInnerHeight, SubTextureCollector collector)
TransformableTexture
s, that this Widget
keeps.
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 final TransformableTexture[] getSubTextures(LiveGameData gameData, boolean isEditorMode, int widgetInnerWidth, int widgetInnerHeight)
TransformableTexture
s, that this Widget
keeps.
gameData
- the live game dataisEditorMode
- rendering in the editor?widgetInnerWidth
- the total widget width excluding borderswidgetInnerHeight
- the total widget height excluding borders
TransformableTexture
s, that this Widget
keeps or null for no textures.protected void onDirtyFlagSet()
public void setDirtyFlag()
public final boolean getDirtyFlag(boolean reset)
protected void onReinitializationForced()
public final void forceReinitialization()
public void setName(java.lang.String name)
Widget
's name.
name
- the new name for this Widget
public final java.lang.String getName()
Widget
's name.
Widget
's name.public final Position getPosition()
Widget
's position.
Widget
's position.public final int getOffsetXToRootMasterWidget()
public final int getOffsetYToRootMasterWidget()
public final int getAbsoluteOffsetX()
public final int getAbsoluteOffsetY()
public void setZIndex(int zIndex)
Widget
's z-index relative to other Widget
s in the same configuration.
zIndex
- the new z-indexpublic final int getZIndex()
Widget
's z-index relative to other Widget
s in the same configuration.
Widget
's z-index relative to other Widget
s in the same configuration.public boolean hasFixedSize()
Widget
has a fixed (unmodifiable) size.
Widget
has a fixed (unmodifiable) size.public final Size getSize()
Widget
's size.
Widget
's width.public final InnerSize getInnerSize()
Widget
.
Widget
.public final int getEffectiveWidth()
public final int getEffectiveHeight()
public int getMinWidth(LiveGameData gameData, boolean isEditorMode)
Widget
in pixels.
gameData
- the live game dataisEditorMode
- rendering in the editor?
Widget
in pixels.public int getMinHeight(LiveGameData gameData, boolean isEditorMode)
Widget
in pixels.
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.
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.
gameData
- the live game dataisEditorMode
- rendering in the editor?
Widget
.public void bake(boolean convertToPixels)
convertToPixels
- if true, all coordinates are converted to absolute pixels and positioned to TOP_LEFT.public void setAllPosAndSizeToPercents()
public void setAllPosAndSizeToPixels()
public final BackgroundProperty getBackgroundProperty()
public final WidgetBackground getBackground()
Widget
's background.
Widget
's background.public final FontProperty getFontProperty()
protected final java.awt.Font getFont()
protected final boolean isFontAntiAliased()
public final ColorProperty getFontColorProperty()
protected final java.awt.Color getFontColor()
Widget
's font color.
Widget
's font color.protected final IntProperty getPaddingPropertyTop()
protected final int getPaddingTop()
protected final IntProperty getPaddingPropertyLeft()
protected final int getPaddingLeft()
protected final IntProperty getPaddingPropertyRight()
protected final int getPaddingRight()
protected final IntProperty getPaddingPropertyBottom()
protected final int getPaddingBottom()
protected final BorderProperty getBorderProperty()
protected final void setPadding(int top, int left, int right, int bottom)
top
- top padding valueleft
- left padding valueright
- right padding valuebottom
- bottom padding valuepublic final BorderWrapper getBorder()
BorderWrapper
, that encapsulates the actual used border with convenience wrappers for the size getters.
The BorderWrapper
instance is never null while the border can be null.
BorderWrapper
for the used Border (never null).protected void onCompleteRedrawForced()
public final void forceCompleteRedraw(boolean mergedBackgroundToo)
mergedBackgroundToo
- if true
, the clear-background will be redrawn and the drawBackground(LiveGameData, boolean, TextureImage2D, int, int, int, int, boolean)
methods will be called again.public final void forceAndSetDirty(boolean mergedBackgroundToo)
forceCompleteRedraw(boolean)
, forceReinitialization()
and setDirtyFlag()
.
This method must be called after a value has been changed, that requires a reinitialization of all positioned strings, etc.
mergedBackgroundToo
- whether to set merged background dirty, toopublic final boolean getInputVisibility()
public final boolean getAutoVisibility()
public final boolean getUpdatedVisibility()
public final boolean isVisible()
getInputVisibility()
&& getAutoVisibility()
&& getUpdatedVisibility()
).
public final boolean visibilityChangedSinceLastDraw()
protected java.lang.Boolean updateVisibility(LiveGameData gameData, boolean isEditorMode)
onBoundInputStateChanged(InputAction, boolean, int, long, LiveGameData, boolean)
method.
Automatic visiblity can also override the result.
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.getUpdatedVisibility()
public int getNeededData()
Widget
to be drawn (bitmask).
Widget
to be drawn.NEEDED_DATA_TELEMETRY
,
NEEDED_DATA_SCORING
,
NEEDED_DATA_SCORING
protected final DrawnStringFactory getDrawnStringFactory()
Widget
's DrawnStringFactory
.
Widget
's DrawnStringFactory
.public void afterConfigurationLoaded(WidgetsConfiguration widgetsConfig, LiveGameData gameData, boolean isEditorMode)
WidgetsConfiguration
has been (re-)loaded.
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.
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)
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)
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 onNeededDataComplete(LiveGameData, boolean)
.
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).
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.
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onNeededDataComplete(LiveGameData gameData, boolean isEditorMode)
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onPitsEntered(LiveGameData gameData, boolean isEditorMode)
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onGarageEntered(LiveGameData gameData, boolean isEditorMode)
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onGarageExited(LiveGameData gameData, boolean isEditorMode)
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onPitsExited(LiveGameData gameData, boolean isEditorMode)
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactorpublic void onRealtimeExited(LiveGameData gameData, boolean isEditorMode)
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)
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 updateVisibility(LiveGameData, boolean)
method or onBoundInputStateChanged(InputAction, boolean, int, long, LiveGameData, boolean)
method.getAutoVisibility()
public void onLapStarted(VehicleScoringInfo vsi, LiveGameData gameData, boolean isEditorMode)
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 rFactorprotected java.lang.Boolean onBoundInputStateChanged(InputAction action, boolean state, int modifierMask, long when, LiveGameData gameData, boolean isEditorMode)
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 updateVisibility(LiveGameData, boolean)
method.
Automatic visiblity can also override the result.getInputVisibility()
public boolean hasMasterCanvas(boolean isEditorMode)
true
, if this Widget
draws on the main texture, false
otherwise.true
.
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 clearRegion(TextureImage2D texture, int offsetX, int offsetY, int width, int height)
public final void clearRegion(TextureImage2D texture, int offsetX, int offsetY)
Widget
.
texture
- the texture image to draw on. Use TextureImage2D.getTextureCanvas()
to retrieve the Texture2DCanvas
for Graphics2D drawing.offsetX
- the x offset of the Widget
on the drawing textureoffsetY
- the y offset of the Widget
on the drawing texturepublic boolean clearBackgroundRegion(TextureImage2D texture, int offsetX, int offsetY, int localX, int localY, int width, int height, boolean markDirty, Rect2i dirtyRect)
Widget
area with the current background.
texture
- the target textureoffsetX
- the x offset of the Widget
on the drawing textureoffsetY
- the y offset of the Widget
on the drawing texturelocalX
- the x coordinate of the upper left corner of the area to be cleared relative to the Widget's locationlocalY
- the y coordinate of the upper left corner of the area to be cleared relative to the Widget's locationwidth
- the width of the area to be clearedheight
- the height of the area to be clearedmarkDirty
- if true, the pixel is marked dirtydirtyRect
- if non null, the dirty rect is written to this instance
true
, if this Widgets defines a background to clear with, false
otherwise.protected abstract void initialize(LiveGameData gameData, boolean isEditorMode, DrawnStringFactory drawnStringFactory, TextureImage2D texture, int width, int height)
DrawnString
s used on this 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)
drawBorder(boolean, BorderWrapper, TextureImage2D, int, int, int, int)
and possibly drawBackground(LiveGameData, boolean, TextureImage2D, int, int, int, int, boolean)
are (re-)invoked.
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 drawBorder(boolean isEditorMode, BorderWrapper border, TextureImage2D texture, int offsetX, int offsetY, int width, int height)
isEditorMode
- true
, if the Editor is used for rendering instead of rFactorborder
- the bordertexture
- the texture image to draw on. Use TextureImage2D.getTextureCanvas()
to retrieve the Texture2DCanvas
for Graphics2D drawing.offsetX
- the x-offset on the drawing textureoffsetY
- the y offset on the drawing texturewidth
- the width of the area on the drawing textureheight
- the height of the area on the drawing textureprotected void drawBackground(LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int offsetX, int offsetY, int width, int height, boolean isRoot)
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 drawing textureoffsetY
- the y offset on the drawing texturewidth
- the width of the area on the drawing textureheight
- the height of the area on the drawing textureisRoot
- if this is true, you can possibly clear your stuff onto the texture instead of drawing it.protected abstract void drawWidget(Clock clock, boolean needsCompleteRedraw, LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int offsetX, int offsetY, int width, int height)
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 final void drawWidget(Clock clock, boolean completeRedrawForced, LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, boolean drawAtZero)
clock
- this is a clock for very dynamic content, that needs smooth display. If 'needsCompleteRedraw' is true, clock1 is also true.completeRedrawForced
- 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.drawAtZero
- draw at position 0,0?public void saveProperties(PropertyWriter writer) throws java.io.IOException
saveProperties
in interface PropertiesKeeper
writer
- the widgets configuration writer to write properties to
java.io.IOException
- if something went wrongpublic void loadProperty(PropertyLoader loader)
loadProperty
in interface PropertiesKeeper
loader
- the property loader to load properties frompublic java.util.Iterator<Property> getPropertiesIterator()
Iterator
to iterate all properties, defined in this class.
Iterator
to iterate all properties, defined in this class.protected void addTypeAndNamePropertiesToContainer(PropertiesContainer propsCont, boolean forceAll)
PropertiesContainer
.
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this Widget
must be added.
If false
, only the properties, that are relevant for the current Widget
's situation have to be added, some can be ignored.protected void addVisibilityPropertiesToContainer(PropertiesContainer propsCont, boolean forceAll)
PropertiesContainer
.
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this Widget
must be added.
If false
, only the properties, that are relevant for the current Widget
's situation have to be added, some can be ignored.protected void addPositionAndSizePropertiesToContainer(PropertiesContainer propsCont, boolean forceAll)
PropertiesContainer
.
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this Widget
must be added.
If false
, only the properties, that are relevant for the current Widget
's situation have to be added, some can be ignored.protected void addBorderPropertyToContainer(PropertiesContainer propsCont, boolean forceAll)
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this Widget
must be added.
If false
, only the properties, that are relevant for the current Widget
's situation have to be added, some can be ignored.protected void addPaddingPropertiesToContainer(PropertiesContainer propsCont, boolean forceAll)
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this Widget
must be added.
If false
, only the properties, that are relevant for the current Widget
's situation have to be added, some can be ignored.protected void addBackgroundPropertyToContainer(PropertiesContainer propsCont, boolean forceAll)
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this Widget
must be added.
If false
, only the properties, that are relevant for the current Widget
's situation have to be added, some can be ignored.protected void addFontPropertiesToContainer(PropertiesContainer propsCont, boolean forceAll)
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this Widget
must be added.
If false
, only the properties, that are relevant for the current Widget
's situation have to be added, some can be ignored.protected void getPropertiesForParentGroup(PropertiesContainer propsCont, boolean forceAll)
propsCont
- the container to add the properties toforceAll
- If true
, all properties provided by this Widget
must be added.
If false
, only the properties, that are relevant for the current Widget
's situation have to be added, some can be ignored.public void getProperties(PropertiesContainer propsCont, boolean forceAll)
getProperties
in interface PropertiesKeeper
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()
protected boolean cloneProperty(Property src, Property trg)
src
- trg
-
true
, if the properties list needs to be refreshed, false
otherwise.public Widget clone()
clone
in class java.lang.Object
public final java.lang.String getDocumentationSource()
protected boolean canHaveBorder()
protected boolean canHaveBackground()
protected final boolean hasBorder()
Widget
has a border or not.
Widget
has a border or not.protected boolean hasText()
false
, the editor won't provide font or font-color selection.
Should return a contant value.
public void prepareForMenuItem()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |