-
Notifications
You must be signed in to change notification settings - Fork 0
SimState.java
Raphael Lutz edited this page Aug 19, 2018
·
1 revision
Main state, manages about ticking and rendering all its elements.
-
UIManager uiManager: link to theuiManager. -
KeyManager keyManager: link to thekeyManager. -
Network network: represents the network being simulated. -
int step = 0: the counter of the number of steps being already simulated. -
double stepSize = 1: size of a step in seconds. -
String[] daysOfWeek = {"Mon","Tue","Wed","Thu","Fri","Sat","Sun"}: contains the abbreviated days of a week. -
boolean paused = false: tells if the simulation is paused. -
boolean askExit = false: tells if user has clicked on "Exit" button. -
long lastTick: long containing time of the last tick. -
double simSpeed = 20: speed of the simulation display. -
double offsetSpeed = 1: speed at which user can offset the network. -
double offsetSpeedDefault = offsetSpeed: default value ofoffsetSpeed. -
long offsetTime = 0: records the duration of the offset. -
double rotationSpeed = 0.02: speed at which user can rotate the network. -
UITextButton stepByStep, exitY, exitN: represents the 3 text button (step-by-step, Yes/No buttons after asking to exit) -
UIImageButton playPause: the only buttons changing its image. -
UITextSwitch colorOn, wireOn, idOn, namesOn, centersOn: the buttons changing their text. -
BufferedImage[] networkDisplays: the possible displays of the network (wire, colors, ...). -
BufferedImage currentDisplay: the current display chosen by user. -
BufferedImage hud: image containing the HUD. -
BufferedImage background: image of the background. -
int currentBackgroundID = 0: current ID of the background. -
int currentNetwork = -1: current chosen network.
-
SimState(Simulation simulation): constructor of the class, initializes the managers and the buttons. -
void init(): initializes the simulation, renders the backgrounds and network, and call computation of cells position. -
void renderBG(Network network, BufferedImage[] backgrounds): render all backgrounds possibilities onbackgrounds. -
void tick(int n): calls evolution of the networkntimes every tick, and listen mouse and keyboard entries. -
void increaseOffset(): increase the offset speed, giving a smooth movement. -
void tick(): does nothing. -
void render(Graphics g): renders the background, network, HUD and buttons. -
void restartNetwork(): restarts simulation of the network. -
String getTime(): returns the time on human format "DDD HH:MM:SS".
The getters and setters for some fields.
- data/
- DataManager.java (TODO)
- ExpVarCalculator.java (TODO)
- VehicleCounter.java (TODO)
- elements/
- Cell.java (TODO)
- Connection.java (TODO)
- CrossRoad.java (empty) (TODO)
- Direction.java (TODO)
- MaxVehicleOutflow.java (TODO)
- MultiLaneRoundAbout.java (TODO)
- Phase.java (TODO)
- Ride.java (TODO)
- Road.java (empty) (TODO)
- RoundAbout.java (empty) (TODO)
- TrafficLightsSystem.java (TODO)
- Vehicle.java (TODO)
- graphics/
- Assets.java (TODO)
- Display.java (TODO)
- ImageLoader.java (TODO)
- SpriteSheet.java (TODO)
- Text.java (TODO)
- input/
- KeyManager.java (TODO)
- MouseManager.java (TODO)
- main/
- Main.java (TODO)
- Simulation.java (TODO)
- network/
- AllNetworkRides.java (empty) (TODO)
- Network.java (TODO)
- NetworkComputing.java (TODO)
- NetworkRendering.java (TODO)
- states/
- MenuState.java (TODO)
- SimSettingsState.java (TODO)
- SimState.java (TODO)
- State.java (TODO)
- ui/
- ClickListener.java (TODO)
- UIImageButton.java (TODO)
- UIManager.java (TODO)
- UIObject.java (TODO)
- UISlider.java (TODO)
- UISliderDouble.java (TODO)
- UISliderTriple.java (TODO)
- UITextButton.java (TODO)
- UITextSwitch.java (TODO)
- utils/
- Defaults.java (TODO)
- OriginDestinationCalculator.java (TODO)
- SortByPos.java (TODO)
- Utils.java (TODO)