@Override public void setVisible(boolean visible0) { if (isVisible() == visible0) { return; } // add/remove drop down from current screen or top overlay when its visibility changes FContainer container = FOverlay.getTopOverlay(); if (container == null) { container = Forge.getCurrentScreen(); } if (visible0) { updateSizeAndPosition(); if (autoHide()) { // add invisible backdrop if needed to allow auto-hiding when pressing // outide drop down backdrop = new Backdrop(); backdrop.setSize(container.getWidth(), container.getHeight()); container.add(backdrop); } container.add(this); } else { container.remove(this); if (backdrop != null) { backdrop.setVisible(false); container.remove(backdrop); backdrop = null; } } super.setVisible(visible0); }
/** * Render the TiledMap, Player and Backdrop. * * @param gc Slick GameContainer. * @param g Java Graphics. * @throws SlickException */ public void render(GameContainer gc, Graphics g) throws SlickException { if (backdrop != null) { backdrop.render(screenRight, screenDown); } g.translate(camX, camY); tileOffsetX = (camX % mapWidth); tileOffsetY = (camY % mapHeight); tileIndexX = -1 * (camX / mapWidth); tileIndexY = -1 * (camY / mapHeight); renderLayer("BACKGROUND"); renderLayer("PLATFORMS"); for (Entity e : entity) { e.render(gc, g); } player.render(gc, g); renderFore(); g.translate(-camX, -camY); }