use of com.b3dgs.lionengine.game.feature.DisplayableModel in project lionengine by b3dgs.
the class SceneRasterable method add.
private void add(SetupSurfaceRastered setup, int offsetX) {
final SpriteAnimated surface = Drawable.loadSpriteAnimated(setup.getSurface(), 4, 4);
final Featurable featurable = new FeaturableModel(services, setup);
featurable.addFeature(new MirrorableModel(services, setup));
featurable.addFeature(new AnimatableModel(services, setup, surface));
final Transformable transformable = featurable.addFeatureAndGet(new TransformableModel(services, setup));
final Rasterable rasterable = new RasterableModel(services, setup);
rasterable.setOrigin(Origin.MIDDLE);
rasterable.setFrameOffsets(1, 2);
featurable.addFeature(rasterable);
featurable.addFeature(new RefreshableModel(extrp -> {
transformable.setLocationY(UtilMath.sin(count) * 240);
surface.setLocation(camera, transformable);
rasterable.update(extrp);
surface.update(extrp);
}));
featurable.addFeature(new DisplayableModel(g -> rasterable.render(g)));
transformable.setLocationX(120 + offsetX);
handler.add(featurable);
}
use of com.b3dgs.lionengine.game.feature.DisplayableModel in project lionengine by b3dgs.
the class EntityHelper method addAfter.
/*
* Featurable
*/
@Override
public void addAfter(Services services, Setup setup) {
final Routines routines = addFeatureAndGet(new Routines(services, setup));
updating = extrp -> {
state.update(extrp);
attacker.update(extrp);
extractor.update(extrp);
producer.update(extrp);
launchable.update(extrp);
launcher.update(extrp);
routines.update(extrp);
body.update(extrp);
pathfindable.update(extrp);
tileCollidable.update(extrp);
state.postUpdate();
mirrorable.update(extrp);
animatable.update(extrp);
rasterable.update(extrp);
};
rendering = g -> {
pathfindable.render(g);
rasterable.render(g);
collidable.render(g);
routines.render(g);
};
updatingCurrent = updating;
renderingCurrent = rendering;
addFeature(new RefreshableModel(extrp -> {
checker.update(extrp);
updatingCurrent.update(extrp);
}));
addFeature(new DisplayableModel(g -> {
renderingCurrent.render(g);
}));
}
Aggregations