This document is the API specification for the Alien-Factory JavaMappy v2.
JavaMappy has been designed to run on all Java platforms. It is largely common code that has been written to the lowest common denominator, J2ME. To compensate JavaMappy makes use of platform specific pluggable renderers that render your Map to the screen.
Below is the simplist bit of code I can think of to get JavaMappy up and running and drawing a (non-animated) Map.
import java.awt.Graphics;
import java.io.FileInputStream;
import javax.swing.JFrame;
import com.alienfactory.javamappy.Map;
import com.alienfactory.javamappy.loader.MapLoader;
import com.alienfactory.javamappy.viewer.MapViewer;
import com.alienfactory.javamappy.viewer.render.*;
public class SimpleExample extends JFrame {
private static MapViewer mapViewer;
public void paint(Graphics gfx) {
mapViewer.draw(gfx, false);
}
public static void main(String[] args) throws Exception {
FileInputStream mapStream = new FileInputStream("alienEpidemic.fmp");
Map map = MapLoader.loadMap(mapStream);
Renderer r = new JDK12Renderer(map);
mapViewer = new MapViewer(map, r, 320, 256);
mapStream.close();
SimpleExample window = new SimpleExample();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setSize(320, 256);
window.setVisible(true);
}
}