From aa3d2a1e1d13b04a8c5801629e077668214bc3ff Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Fri, 30 Jan 2009 09:40:40 -0500 Subject: Added viewpoint scrolling Now, maps can be larger than (20,15) and the map will scroll as the hero walks across the middle. However, Southward and Eastward middle-traversing appears to warp reality just a little and there are a few kinks that need to be straightened out. Map layer caching has also been added because the lower and upper layers of a map never change, so they are cached after the first rendering. --- .../fourpuzzle/gamestate/mapview/Map.java | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java') diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java index bc0073e..d02c7ed 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java @@ -11,6 +11,8 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.EventList; import com.fourisland.fourpuzzle.gamestate.mapview.event.HeroEvent; import com.fourisland.fourpuzzle.gamestate.mapview.event.LayerEvent; import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; import java.util.HashMap; import java.util.Vector; @@ -185,4 +187,61 @@ public abstract class Map { this.music = music; } + BufferedImage lowerLayer = null; + public BufferedImage renderLower() + { + if (lowerLayer == null) + { + lowerLayer = new BufferedImage(size.width*16, size.height*16, BufferedImage.TYPE_INT_ARGB); + Graphics2D g = lowerLayer.createGraphics(); + ChipSet chipSetObj = ChipSet.getChipSet(chipSet); + int i,x,y; + for (i=0;i