|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.maps.MapWriter wyvern.kernel.maps.PythonMapWriter
Writes a map out to a python file.
Field Summary |
Fields inherited from class wyvern.kernel.maps.MapWriter |
cache_, externCache_, filename_, out_, terrainCache_ |
Constructor Summary | |
PythonMapWriter()
|
Method Summary | |
protected java.lang.String |
getPyClassName(java.lang.String filename)
Returns the name of the python class to use (same as filename). |
protected void |
printConstructor(GameMap map)
Prints the __init__ function for the python map. |
protected java.lang.String |
printMapProperty(java.lang.String name,
java.lang.Object value)
Prints a property of the map. |
protected void |
printMapProps(GameMap map,
java.io.PrintWriter out)
Generates code that adds the map properties. |
void |
writeMap(GameMap map,
java.lang.String filename)
Writes a map as python code. |
protected void |
writeObject(GameObject obj,
int x,
int y)
Writes python version of a single object. |
protected void |
writeRectangle(GameObject obj,
int x,
int y,
int w,
int h)
Writes out a rectangle in the map containing the passed object at every location in the rectangle. |
Methods inherited from class wyvern.kernel.maps.MapWriter |
compareObjects, extendLeftRight, extendUpDown, findClone, getMapClassName, iterateObjects, openFile, overlapping, writeDenseMap, writeLocalArchetypes, writeObject, writeObjectAndNeighbors |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PythonMapWriter()
Method Detail |
public void writeMap(GameMap map, java.lang.String filename) throws java.io.IOException
writeMap
in class MapWriter
map
- the map to writefilename
- the file to write it to
java.io.IOException
- if the write failsprotected java.lang.String getPyClassName(java.lang.String filename)
filename
- full path to the fileprotected void printConstructor(GameMap map)
protected void printMapProps(GameMap map, java.io.PrintWriter out)
printMapProps
in class MapWriter
map
- the mapout
- file output streamprotected java.lang.String printMapProperty(java.lang.String name, java.lang.Object value)
name
- the property namevalue
- the property valueprotected void writeObject(GameObject obj, int x, int y)
writeObject
in class MapWriter
obj
- the object to write into the mapx
- the x location for the objecty
- the y location for the objectprotected void writeRectangle(GameObject obj, int x, int y, int w, int h)
writeRectangle
in class MapWriter
obj
- the object to write into the mapx
- rectangle lefty
- rectangle topw
- rectangle widthh
- rectangle height
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |