net.ctdp.rfdynhud.gamedata
Class GameEventsManager

java.lang.Object
  extended by net.ctdp.rfdynhud.gamedata.GameEventsManager
All Implemented Interfaces:
WidgetsConfiguration.ConfigurationLoadListener

public class GameEventsManager
extends java.lang.Object
implements WidgetsConfiguration.ConfigurationLoadListener

The events manager receives events from rFactor and modifies state-flags appropriately.

Author:
Marvin Froehlich (CTDP)

Field Summary
static boolean simulationMode
           
 
Constructor Summary
GameEventsManager(RFDynHUD rfDynHUD, WidgetsDrawingManager widgetsManager)
          Creates a new GameEventsManager.
 
Method Summary
 void afterWidgetsConfigurationLoaded(WidgetsConfiguration widgetsConfig)
          
 void beforeWidgetsConfigurationCleared(WidgetsConfiguration widgetsConfig)
          
 void checkAndFireOnLapStarted(boolean isEditorMode)
           
 void checkRaceRestart(long updateTimestamp)
           
 void fireOnInputStateChanged(InputMapping mapping, boolean state, int modifierMask, long when, boolean isEditorMode)
           
 ConfigurationLoader getConfigurationLoader()
           
 boolean hasWaitingWidgets()
           
 boolean isRunning()
          Returns whether the game has been started up and not yet been shut down.
 boolean isSessionRunning()
          Returns whether the current session is running.
 byte onGraphicsInfoUpdated(short viewportX, short viewportY, short viewportWidth, short viewportHeight)
          Will and must be called any time, the game is redendered (called from the C++-Plugin).
 byte onRealtimeEntered()
          This method must be called when realtime mode has been entered (the user clicked on "Drive").
 byte onRealtimeEntered(boolean isEditorMode)
           
 byte onRealtimeExited()
          This method must be called when the user exited realtime mode (pressed ESCAPE in the cockpit).
 void onRealtimeExited(boolean isEditorMode)
          This method must be called when the user exited realtime mode (pressed ESCAPE in the cockpit).
 byte onScoringInfoUpdated()
          This method must be called when ScoringInfo has been updated.
 byte onScoringInfoUpdated(boolean isEditorMode)
           
 void onSessionEnded()
          This method must be called when a session has been ended.
 void onSessionEnded(boolean isEditorMode)
           
 byte onSessionStarted()
          This method must be called when a session has been started.
 byte onSessionStarted(boolean isEditorMode)
           
 void onShutdown()
          This method must be called when the game shut down.
 void onShutdown(boolean isEditorMode)
          This method must be called when the game shut down.
 void onStartup()
          This method must be called when the game started up.
 void onStartup(boolean isEditorMode)
          This method must be called when the game started up.
 byte onTelemetryDataUpdated()
          This method must be called when TelemetryData has been updated.
 byte onTelemetryDataUpdated(boolean isEditorMode)
           
 byte reloadConfigAndSetupTexture(boolean force)
           
 void setGameData(LiveGameData gameData, WidgetsManager renderListenersManager)
          Sets live game data instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

simulationMode

public static boolean simulationMode
Constructor Detail

GameEventsManager

public GameEventsManager(RFDynHUD rfDynHUD,
                         WidgetsDrawingManager widgetsManager)
Creates a new GameEventsManager.

Parameters:
rfDynHUD - the main RFDynHUD instance
widgetsManager - the widgets manager
Method Detail

hasWaitingWidgets

public final boolean hasWaitingWidgets()

getConfigurationLoader

public final ConfigurationLoader getConfigurationLoader()

setGameData

public void setGameData(LiveGameData gameData,
                        WidgetsManager renderListenersManager)
Sets live game data instance.

Parameters:
gameData -
renderListenersManager -

beforeWidgetsConfigurationCleared

public void beforeWidgetsConfigurationCleared(WidgetsConfiguration widgetsConfig)

Specified by:
beforeWidgetsConfigurationCleared in interface WidgetsConfiguration.ConfigurationLoadListener

afterWidgetsConfigurationLoaded

public void afterWidgetsConfigurationLoaded(WidgetsConfiguration widgetsConfig)

Specified by:
afterWidgetsConfigurationLoaded in interface WidgetsConfiguration.ConfigurationLoadListener

onStartup

public void onStartup(boolean isEditorMode)
This method must be called when the game started up.

Parameters:
isEditorMode -

onStartup

public final void onStartup()
This method must be called when the game started up.


onShutdown

public void onShutdown(boolean isEditorMode)
This method must be called when the game shut down.

Parameters:
isEditorMode -

onShutdown

public final void onShutdown()
This method must be called when the game shut down.


isRunning

public final boolean isRunning()
Returns whether the game has been started up and not yet been shut down.

Returns:
whether the game has been started up and not yet been shut down.

fireOnInputStateChanged

public void fireOnInputStateChanged(InputMapping mapping,
                                    boolean state,
                                    int modifierMask,
                                    long when,
                                    boolean isEditorMode)
Parameters:
mapping -
state -
modifierMask -
when -
isEditorMode -

reloadConfigAndSetupTexture

public byte reloadConfigAndSetupTexture(boolean force)
Parameters:
force - force reload ignoring, whether it is already in action?
Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onSessionStarted

public byte onSessionStarted(boolean isEditorMode)
Parameters:
isEditorMode - editor mode?
Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onSessionStarted

public byte onSessionStarted()
This method must be called when a session has been started. Note: LiveGameData must have been updated before.

Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onSessionEnded

public void onSessionEnded(boolean isEditorMode)
Parameters:
isEditorMode - editor mode?

onSessionEnded

public final void onSessionEnded()
This method must be called when a session has been ended.


isSessionRunning

public final boolean isSessionRunning()
Returns whether the current session is running.

Returns:
whether the current session is running.

onRealtimeEntered

public byte onRealtimeEntered(boolean isEditorMode)
Parameters:
isEditorMode - editor mode?
Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onRealtimeEntered

public final byte onRealtimeEntered()
This method must be called when realtime mode has been entered (the user clicked on "Drive").

Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onRealtimeExited

public void onRealtimeExited(boolean isEditorMode)
This method must be called when the user exited realtime mode (pressed ESCAPE in the cockpit).

Parameters:
isEditorMode -

onRealtimeExited

public final byte onRealtimeExited()
This method must be called when the user exited realtime mode (pressed ESCAPE in the cockpit).

Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onGraphicsInfoUpdated

public final byte onGraphicsInfoUpdated(short viewportX,
                                        short viewportY,
                                        short viewportWidth,
                                        short viewportHeight)
Will and must be called any time, the game is redendered (called from the C++-Plugin).

Parameters:
viewportX - the left coordinate of the viewport
viewportY - the top coordinate of the viewport
viewportWidth - the width of the viewport
viewportHeight - the height of the viewport
Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onTelemetryDataUpdated

public final byte onTelemetryDataUpdated(boolean isEditorMode)
Parameters:
isEditorMode - editor mode?
Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onTelemetryDataUpdated

public final byte onTelemetryDataUpdated()
This method must be called when TelemetryData has been updated.

Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onScoringInfoUpdated

public final byte onScoringInfoUpdated(boolean isEditorMode)
Parameters:
isEditorMode - editor mode?
Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

onScoringInfoUpdated

public final byte onScoringInfoUpdated()
This method must be called when ScoringInfo has been updated.

Returns:
0 for no HUD to be drawn, 1 for HUD drawn, 2 for HUD drawn and texture re-requested.

checkRaceRestart

public final void checkRaceRestart(long updateTimestamp)
Parameters:
updateTimestamp - the timestamp at the update

checkAndFireOnLapStarted

public final void checkAndFireOnLapStarted(boolean isEditorMode)
Parameters:
isEditorMode - editor mode?