|
||||||||||
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.needlemeter.NeedleMeterWidget
net.ctdp.rfdynhud.widgets.base.revneedlemeter.AbstractRevNeedleMeterWidget
public abstract class AbstractRevNeedleMeterWidget
The AbstractRevNeedleMeterWidget
displays rev/RPM information.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_GEAR_FONT_NAME
|
protected BooleanProperty |
displayGear
|
protected ImageProperty |
gearBackgroundImageName
|
protected FontProperty |
gearFont
|
protected ColorProperty |
gearFontColor
|
protected IntProperty |
gearPosX
|
protected IntProperty |
gearPosY
|
static int |
PEAK_NEEDLE_LOCAL_Z_INDEX
|
protected DelayProperty |
peakNeedleCooldown
|
protected DelayProperty |
peakNeedleDownshiftIgnoreTime
|
protected ImageProperty |
peakNeedleImageName
|
protected IntProperty |
peakNeedlePivotBottomOffset
|
protected DelayProperty |
peakNeedleWaitTime
|
protected BooleanProperty |
useMaxRevLimit
|
Fields inherited from class net.ctdp.rfdynhud.widgets.base.needlemeter.NeedleMeterWidget |
---|
displayMarkerNumbers, displayMarkers, displayValue, firstMarkerNumberOffset, lastMarkerBig, lastMarkerNumberOffset, markerNumbersCentered, markerNumbersInside, markersBigStep, markersColor, markersFont, markersFontColor, markersFontDropShadowColor, markersInnerRadius, markersLength, markersOnCircle, markersSmallStep, maxValue, MIN_MAX_VALUE_NONE, minValue, NEEDLE_LOCAL_Z_INDEX, needleMountX, needleMountY, needlePivotBottomOffset, needleRotationForMaxValue, needleRotationForMinValue, valueBackgroundImageName, valueFont, valueFontColor, valuePosX, valuePosY |
Fields inherited from class net.ctdp.rfdynhud.widgets.base.widget.Widget |
---|
LOG_CHANNEL, NEEDED_DATA_ALL, NEEDED_DATA_SCORING, NEEDED_DATA_TELEMETRY |
Constructor Summary | |
---|---|
AbstractRevNeedleMeterWidget(WidgetSet widgetSet,
WidgetPackage widgetPackage,
float width,
float height)
|
Method Summary | |
---|---|
protected void |
addMaxValuePropertyToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the maxValue property to the container. |
protected void |
addVisibilityPropertiesToContainer(PropertiesContainer propsCont,
boolean forceAll)
Adds the visibility properties to the PropertiesContainer . |
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 boolean |
doRenderNeedle(LiveGameData gameData,
boolean isEditorMode)
Live-checks, whether the needle is to be rendered or not. |
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 |
getDefaultNamedFontValue(java.lang.String name)
Gets the default value for the given named font. |
protected java.lang.String |
getDigiValuePropertiesGroupName()
Gets the display name of the properties group for the digital value in the editor. |
protected void |
getGearProperties(PropertiesContainer propsCont,
boolean forceAll)
Collects the properties for the gear. |
protected java.lang.String |
getInitialPeakNeedleImage()
|
protected java.lang.String |
getMarkerLabelForValue(LiveGameData gameData,
boolean isEditorMode,
float value)
Gets the text label for the big markers at the given value. |
protected int |
getMarkersBigStepLowerLimit()
|
protected void |
getMarkersProperties(PropertiesContainer propsCont,
boolean forceAll)
Collects the properties for the markers. |
protected int |
getMarkersSmallStepLowerLimit()
|
protected float |
getMaxDataValue(LiveGameData gameData,
boolean isEditorMode)
Gets the maximum value for the markers and needle coming from game data or known limits. |
protected float |
getMinDataValue(LiveGameData gameData,
boolean isEditorModes)
Gets the minimum value for the markers and needle coming from game data or known limits. |
int |
getNeededData()
Gets the data indicators for the data needed for this Widget to be drawn (bitmask). |
protected void |
getNeedleProperties(PropertiesContainer propsCont,
boolean forceAll)
Collects the properties for the needle. |
java.lang.String |
getPeakNeedleImageName()
|
void |
getProperties(PropertiesContainer propsCont,
boolean forceAll)
Puts all editable properties to the editor. |
protected float |
getValue(LiveGameData gameData,
boolean isEditorMode)
Gets the value for the needle and the digital value display. |
protected int |
getValueForValueDisplay(LiveGameData gameData,
boolean isEditorMode)
Gets the value for the digital value display. |
protected void |
initialize(LiveGameData gameData,
boolean isEditorMode,
DrawnStringFactory dsf,
TextureImage2D texture,
int width,
int height)
This method is called once to initialized DrawnString s used on this Widget. |
protected void |
initParentProperties()
This method is called as the last item in the constructor. |
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. |
protected void |
onBackgroundChanged(boolean imageChanged,
float deltaScaleX,
float deltaScaleY)
This method is invoked when the background has changed. |
void |
onNeededDataComplete(LiveGameData gameData,
boolean isEditorMode)
This method is called when the needed data is available in realtime mode. |
void |
onRealtimeEntered(LiveGameData gameData,
boolean isEditorMode)
This method is called when a the user entered realtime mode. |
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 |
prepareForMenuItem()
This method is called by the editor before it draws the Widget to a menu item. |
protected void |
saveGearProperties(PropertyWriter writer)
|
protected void |
saveMarkersProperties(PropertyWriter writer)
|
protected void |
saveNeedleProperties(PropertyWriter writer)
|
void |
saveProperties(PropertyWriter writer)
Saves all settings to the config file. |
void |
setPeakNeedleImageName(java.lang.String image)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PEAK_NEEDLE_LOCAL_Z_INDEX
public static final java.lang.String DEFAULT_GEAR_FONT_NAME
protected final BooleanProperty useMaxRevLimit
protected final BooleanProperty displayGear
protected final ImageProperty gearBackgroundImageName
protected final IntProperty gearPosX
protected final IntProperty gearPosY
protected final FontProperty gearFont
protected final ColorProperty gearFontColor
protected final ImageProperty peakNeedleImageName
protected final IntProperty peakNeedlePivotBottomOffset
protected final DelayProperty peakNeedleCooldown
protected final DelayProperty peakNeedleWaitTime
protected final DelayProperty peakNeedleDownshiftIgnoreTime
Constructor Detail |
---|
public AbstractRevNeedleMeterWidget(WidgetSet widgetSet, WidgetPackage widgetPackage, float width, float height)
Method Detail |
---|
protected int getMarkersBigStepLowerLimit()
getMarkersBigStepLowerLimit
in class NeedleMeterWidget
protected int getMarkersSmallStepLowerLimit()
getMarkersSmallStepLowerLimit
in class NeedleMeterWidget
protected java.lang.String getInitialPeakNeedleImage()
protected void onBackgroundChanged(boolean imageChanged, float deltaScaleX, float deltaScaleY)
Widget
onBackgroundChanged
in class NeedleMeterWidget
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 selectedpublic java.lang.String getDefaultNamedFontValue(java.lang.String name)
getDefaultNamedFontValue
in class Widget
name
- the font name to query
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
protected float getMinDataValue(LiveGameData gameData, boolean isEditorModes)
NeedleMeterWidget
getMinDataValue
in class NeedleMeterWidget
protected float getMaxDataValue(LiveGameData gameData, boolean isEditorMode)
NeedleMeterWidget
getMaxDataValue
in class NeedleMeterWidget
protected float getValue(LiveGameData gameData, boolean isEditorMode)
NeedleMeterWidget
NeedleMeterWidget.getValueForValueDisplay(LiveGameData, boolean)
to use a different value
for the digital value.
getValue
in class NeedleMeterWidget
protected int getValueForValueDisplay(LiveGameData gameData, boolean isEditorMode)
NeedleMeterWidget
NeedleMeterWidget.getValue(LiveGameData, boolean)
and converts it to an int.
getValueForValueDisplay
in class NeedleMeterWidget
protected java.lang.String getMarkerLabelForValue(LiveGameData gameData, boolean isEditorMode, float value)
NeedleMeterWidget
getMarkerLabelForValue
in class NeedleMeterWidget
public void setPeakNeedleImageName(java.lang.String image)
public final java.lang.String getPeakNeedleImageName()
protected void initSubTextures(LiveGameData gameData, boolean isEditorMode, int widgetInnerWidth, int widgetInnerHeight, SubTextureCollector collector)
NeedleMeterWidget
TransformableTexture
s, that this Widget
keeps.
initSubTextures
in class NeedleMeterWidget
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 onRealtimeEntered(LiveGameData gameData, boolean isEditorMode)
Widget
needs some data
to be drawn correctly, consider using Widget.onNeededDataComplete(LiveGameData, boolean)
.
onRealtimeEntered
in class NeedleMeterWidget
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 NeedleMeterWidget
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()
protected void initialize(LiveGameData gameData, boolean isEditorMode, DrawnStringFactory dsf, TextureImage2D texture, int width, int height)
DrawnString
s used on this Widget.
initialize
in class NeedleMeterWidget
gameData
- the live game dataisEditorMode
- true
, if the Editor is used for rendering instead of rFactordsf
- 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 boolean doRenderNeedle(LiveGameData gameData, boolean isEditorMode)
NeedleMeterWidget
doRenderNeedle
in class NeedleMeterWidget
protected void drawWidget(Clock clock, boolean needsCompleteRedraw, LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int offsetX, int offsetY, int width, int height)
Widget
drawWidget
in class NeedleMeterWidget
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 textureprotected void initParentProperties()
NeedleMeterWidget
initParentProperties
in class NeedleMeterWidget
protected void saveMarkersProperties(PropertyWriter writer) throws java.io.IOException
saveMarkersProperties
in class NeedleMeterWidget
java.io.IOException
protected void saveNeedleProperties(PropertyWriter writer) throws java.io.IOException
saveNeedleProperties
in class NeedleMeterWidget
java.io.IOException
protected void saveGearProperties(PropertyWriter writer) throws java.io.IOException
java.io.IOException
public void saveProperties(PropertyWriter writer) throws java.io.IOException
saveProperties
in interface PropertiesKeeper
saveProperties
in class NeedleMeterWidget
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 NeedleMeterWidget
loader
- the property loader to load properties fromprotected void addVisibilityPropertiesToContainer(PropertiesContainer propsCont, boolean forceAll)
PropertiesContainer
.
addVisibilityPropertiesToContainer
in class Widget
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 addMaxValuePropertyToContainer(PropertiesContainer propsCont, boolean forceAll)
addMaxValuePropertyToContainer
in class NeedleMeterWidget
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 getMarkersProperties(PropertiesContainer propsCont, boolean forceAll)
getMarkersProperties
in class NeedleMeterWidget
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 getNeedleProperties(PropertiesContainer propsCont, boolean forceAll)
getNeedleProperties
in class NeedleMeterWidget
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 getGearProperties(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 java.lang.String getDigiValuePropertiesGroupName()
getDigiValuePropertiesGroupName
in class NeedleMeterWidget
public void getProperties(PropertiesContainer propsCont, boolean forceAll)
getProperties
in interface PropertiesKeeper
getProperties
in class NeedleMeterWidget
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.public void prepareForMenuItem()
prepareForMenuItem
in class NeedleMeterWidget
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |