public class Universe extends AnimationElement
| Modifier and Type | Field and Description |
|---|---|
static double |
MASS_EARTH
The Constant MASS_EARTH.
|
static double |
MASS_SUN
The Constant MASS_SUN.
|
float |
minimum_distance_apart
The minimum_distance_apart.
|
| Constructor and Description |
|---|
Universe(UniverseChangeDelegate delegate)
Instantiates a new universe.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBody(Body b)
Adds the body.
|
boolean |
canAddMore()
Can add more.
|
void |
elementStart(float tpf)
Called on the first
|
MassReference |
getDefaultBodyMass()
Gets the default body mass.
|
double |
getGravitationalConstant()
Gets the gravitational constant.
|
int |
getMaxBodies()
Gets the max bodies.
|
double |
getTimeMultiplier()
Gets the time multiplier.
|
boolean |
isFinished()
When this method returns true, the animation element will be reset.
|
void |
removeAllBodies()
Removes the all bodies.
|
void |
reset()
Called when the animation element is finished.
|
void |
setGravitationalConstant(double gravitationalConstant)
Sets the gravitational constant.
|
void |
setMaxBodies(int maxBodies)
Sets the max bodies.
|
void |
setScenario(UniverseScenario newValue)
Sets the scenario.
|
void |
setTimeMultiplier(double timeMultiplier)
Sets the time multiplier.
|
void |
updateAnimationState(float tpf)
Called each frame in the game loop.
|
enable, toString, updateStatepublic static final double MASS_EARTH
public static final double MASS_SUN
public float minimum_distance_apart
public Universe(UniverseChangeDelegate delegate)
delegate - the delegatepublic void addBody(Body b)
b - the bpublic boolean canAddMore()
public void elementStart(float tpf)
AnimationElementelementStart in class AnimationElementpublic MassReference getDefaultBodyMass()
public double getGravitationalConstant()
public int getMaxBodies()
public double getTimeMultiplier()
public boolean isFinished()
AnimationElementisFinished in class AnimationElementpublic void removeAllBodies()
public void reset()
AnimationElementisFinished()reset in class AnimationElementpublic void setGravitationalConstant(double gravitationalConstant)
gravitationalConstant - the new gravitational constantpublic void setMaxBodies(int maxBodies)
maxBodies - the new max bodiespublic void setScenario(UniverseScenario newValue)
newValue - the new scenariopublic void setTimeMultiplier(double timeMultiplier)
timeMultiplier - the new time multiplierpublic void updateAnimationState(float tpf)
AnimationElementupdateAnimationState in class AnimationElement