public abstract class WorldGame
extends java.lang.Object
MapTile
, HandlerEntityGame
,
FactoryObjectGame
...).
It contains different elements, such as:
Keyboard
: The keyboard input reference, in order to retrieve keyboard key usesMouse
: The mouse input reference, in order to retrieve mouse movement and click usesConfig
: The configuration used by the Loader
width
: The source screen width, retrieve from the source screen Resolution
height
: The source screen height, retrieve from the source screen Resolution
Sequence
.
Here a standard world usage:
public class MySequence extends Sequence { private final World world; public MySequence(Loader loader) { super(loader); // Initialize variables here world = new World(this); } @Override protected void load() { // Load resources here world.loadFromFile(Media.get("level.lvl")); } @Override protected void update(double extrp) { // Update routine world.update(extrp); } @Override protected void render(Graphic g) { // Render routine world.render(g); } }
Constructor and Description |
---|
WorldGame(com.b3dgs.lionengine.core.Sequence sequence)
Create a new world.
|
Modifier and Type | Method and Description |
---|---|
void |
loadFromFile(com.b3dgs.lionengine.core.Media media)
Load world from the specified file.
|
abstract void |
render(com.b3dgs.lionengine.Graphic g)
Internal world rendering.
|
void |
saveToFile(com.b3dgs.lionengine.core.Media media)
Save world to the specified file.
|
abstract void |
update(double extrp)
Internal world updates.
|
public WorldGame(com.b3dgs.lionengine.core.Sequence sequence)
Config
,
screen size and wide state.sequence
- The sequence reference.public abstract void update(double extrp)
extrp
- The extrapolation value.public abstract void render(com.b3dgs.lionengine.Graphic g)
g
- The graphic output.public final void saveToFile(com.b3dgs.lionengine.core.Media media)
media
- The output media.public final void loadFromFile(com.b3dgs.lionengine.core.Media media)
media
- The input media.