return null;
}
private void drawCore( @NotNull Graphics2D g2d ) throws Exception {
final Level level = getLevel();
final Player player = level.getPlayer();
final Point2D screenPlayerPosition;
if ( player instanceof AnimatedElement ) {
final EntityMovementAnimation animation = ( (AnimatedElement) player ).getAnimation();
Point2D animationPosition;
if ( animation != null ) {
try {
animationPosition = animation.getActualPosition();
} catch ( TerminatedAnimationException e ) {
animationPosition = player.getPosition();
}
} else {
animationPosition = player.getPosition();
}
screenPlayerPosition = GraphicsEnv.getInstance().centeredGamePointToScreen( animationPosition );
} else {
screenPlayerPosition = GraphicsEnv.getInstance().centeredGamePointToScreen( player.getPosition() );
}
int actualGamePointSize = GraphicsEnv.getInstance().getScaledPointDimension();
double screenMaxLateralSize = actualGamePointSize * MAX_LATERAL_SPACE;
final Rectangle2D gameScreenBounds = new Rectangle2D.Double( ( this.levelBounds.x * actualGamePointSize ) - screenMaxLateralSize,
( this.levelBounds.y * actualGamePointSize ) - screenMaxLateralSize,
( this.levelBounds.width * actualGamePointSize ) + ( screenMaxLateralSize * 2 ),
( this.levelBounds.height * actualGamePointSize ) + ( screenMaxLateralSize * 2 ) );
final Rectangle clipBounds = g2d.getClipBounds();
final Rectangle2D gameScreen = new Rectangle2D.Double( screenPlayerPosition.getX() - ( clipBounds.width / 2 ),
screenPlayerPosition.getY() - ( clipBounds.height / 2 ),
clipBounds.width, clipBounds.height );
if ( ! gameScreenBounds.contains( gameScreen ) ) {
if ( gameScreen.getWidth() < gameScreenBounds.getWidth() ) {
if ( gameScreen.getMaxX() > gameScreenBounds.getMaxX() ) {
gameScreen.setFrame( gameScreen.getX() - ( gameScreen.getMaxX() - gameScreenBounds.getMaxX() ),
gameScreen.getY(),
gameScreen.getWidth(),
gameScreen.getHeight() );
}
if ( gameScreen.getMinX() < gameScreenBounds.getMinX() ) {
gameScreen.setFrame( gameScreenBounds.getMinX(), gameScreen.getMinY(), gameScreen.getWidth(), gameScreen.getHeight() );
}
} else {
gameScreen.setFrame( gameScreenBounds.getCenterX() - ( gameScreen.getWidth() / 2 ), gameScreen.getMinY(),
gameScreen.getWidth(), gameScreen.getHeight() );
}
if ( gameScreen.getHeight() < gameScreenBounds.getHeight() ) {
if ( gameScreen.getMaxY() > gameScreenBounds.getMaxY() ) {
gameScreen.setFrame( gameScreen.getX(),
gameScreen.getY() - ( gameScreen.getMaxY() - gameScreenBounds.getMaxY() ),
gameScreen.getWidth(),
gameScreen.getHeight() );
}
if ( gameScreen.getMinY() < gameScreenBounds.getMinY() ) {
gameScreen.setFrame( gameScreen.getMinX(), gameScreenBounds.getMinY(), gameScreen.getWidth(), gameScreen.getHeight() );
}
} else {
gameScreen.setFrame( gameScreenBounds.getMinX(), gameScreenBounds.getCenterY() - ( gameScreen.getHeight() / 2 ),
gameScreen.getWidth(), gameScreen.getHeight() );
}
}
g2d.translate( - gameScreen.getX(), - gameScreen.getY() );
for (Map.Entry<Face, Integer> faceEntry : this.faces.entrySet()) {
final Face face = faceEntry.getKey();
face.setColored( level.isFaceColored( faceEntry.getValue() ) );
face.draw( g2d );
}
for (Pipe pipe : level.getMap().edgeSet()) {
pipe.draw( g2d );
}
for (Junction junction : level.getMap().vertexSet()) {
junction.draw( g2d );
}
for (Monster mob : level.getMonsters()) {
mob.draw( g2d );
}
player.draw( g2d ) ;
}