Added support for default render priorities.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2225 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ObjectTile.java,v 1.13 2003/01/13 22:49:46 mdb Exp $
|
// $Id: ObjectTile.java,v 1.14 2003/01/29 21:31:37 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.tile;
|
package com.threerings.media.tile;
|
||||||
|
|
||||||
@@ -94,6 +94,22 @@ public class ObjectTile extends Tile
|
|||||||
_originY = y;
|
_originY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this object tile's default render priority.
|
||||||
|
*/
|
||||||
|
public int getPriority ()
|
||||||
|
{
|
||||||
|
return _priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets this object tile's default render priority.
|
||||||
|
*/
|
||||||
|
protected void setPriority (int priority)
|
||||||
|
{
|
||||||
|
_priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void toString (StringBuffer buf)
|
public void toString (StringBuffer buf)
|
||||||
{
|
{
|
||||||
@@ -102,6 +118,7 @@ public class ObjectTile extends Tile
|
|||||||
buf.append(", baseHeight=").append(_baseHeight);
|
buf.append(", baseHeight=").append(_baseHeight);
|
||||||
buf.append(", originX=").append(_originX);
|
buf.append(", originX=").append(_originX);
|
||||||
buf.append(", originY=").append(_originY);
|
buf.append(", originY=").append(_originY);
|
||||||
|
buf.append(", priority=").append(_priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The object footprint width in unit tile units. */
|
/** The object footprint width in unit tile units. */
|
||||||
@@ -119,4 +136,7 @@ public class ObjectTile extends Tile
|
|||||||
* origin or MIN_VALUE if the origin should be calculated based on the
|
* origin or MIN_VALUE if the origin should be calculated based on the
|
||||||
* footprint. */
|
* footprint. */
|
||||||
protected int _originY = Integer.MIN_VALUE;
|
protected int _originY = Integer.MIN_VALUE;
|
||||||
|
|
||||||
|
/** This object tile's default render priority. */
|
||||||
|
protected int _priority;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ObjectTileSet.java,v 1.10 2003/01/15 09:28:43 mdb Exp $
|
// $Id: ObjectTileSet.java,v 1.11 2003/01/29 21:31:37 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.tile;
|
package com.threerings.media.tile;
|
||||||
|
|
||||||
@@ -52,6 +52,14 @@ public class ObjectTileSet extends SwissArmyTileSet
|
|||||||
_yorigins = yorigins;
|
_yorigins = yorigins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default render priorities for our object tiles.
|
||||||
|
*/
|
||||||
|
public void setPriorities (int[] priorities)
|
||||||
|
{
|
||||||
|
_priorities = priorities;
|
||||||
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
protected void toString (StringBuffer buf)
|
protected void toString (StringBuffer buf)
|
||||||
{
|
{
|
||||||
@@ -60,6 +68,7 @@ public class ObjectTileSet extends SwissArmyTileSet
|
|||||||
buf.append(", oheights=").append(StringUtil.toString(_oheights));
|
buf.append(", oheights=").append(StringUtil.toString(_oheights));
|
||||||
buf.append(", xorigins=").append(StringUtil.toString(_xorigins));
|
buf.append(", xorigins=").append(StringUtil.toString(_xorigins));
|
||||||
buf.append(", yorigins=").append(StringUtil.toString(_yorigins));
|
buf.append(", yorigins=").append(StringUtil.toString(_yorigins));
|
||||||
|
buf.append(", prios=").append(StringUtil.toString(_priorities));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,8 +84,10 @@ public class ObjectTileSet extends SwissArmyTileSet
|
|||||||
if (_xorigins != null) {
|
if (_xorigins != null) {
|
||||||
tile.setOrigin(_xorigins[tileIndex], _yorigins[tileIndex]);
|
tile.setOrigin(_xorigins[tileIndex], _yorigins[tileIndex]);
|
||||||
}
|
}
|
||||||
|
if (_priorities != null) {
|
||||||
|
tile.setPriority(_priorities[tileIndex]);
|
||||||
|
}
|
||||||
return tile;
|
return tile;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The width (in tile units) of our object tiles. */
|
/** The width (in tile units) of our object tiles. */
|
||||||
@@ -91,6 +102,9 @@ public class ObjectTileSet extends SwissArmyTileSet
|
|||||||
/** The y offset in pixels to the origin of the tile images. */
|
/** The y offset in pixels to the origin of the tile images. */
|
||||||
protected int[] _yorigins;
|
protected int[] _yorigins;
|
||||||
|
|
||||||
|
/** The default render priorities of our objects. */
|
||||||
|
protected int[] _priorities;
|
||||||
|
|
||||||
/** Increase this value when object's serialized state is impacted by
|
/** Increase this value when object's serialized state is impacted by
|
||||||
* a class change (modification of fields, inheritance). */
|
* a class change (modification of fields, inheritance). */
|
||||||
private static final long serialVersionUID = 1;
|
private static final long serialVersionUID = 1;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ObjectTileSetRuleSet.java,v 1.4 2002/02/05 20:29:09 mdb Exp $
|
// $Id: ObjectTileSetRuleSet.java,v 1.5 2003/01/29 21:31:37 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.tile.tools.xml;
|
package com.threerings.media.tile.tools.xml;
|
||||||
|
|
||||||
@@ -36,6 +36,8 @@ import com.threerings.media.tile.ObjectTileSet;
|
|||||||
* <objectWidths>4, 3, 4, 3</objectWidths>
|
* <objectWidths>4, 3, 4, 3</objectWidths>
|
||||||
* <!-- the heights (in unit tile count) of the objects -->
|
* <!-- the heights (in unit tile count) of the objects -->
|
||||||
* <objectHeights>3, 4, 3, 4</objectHeights>
|
* <objectHeights>3, 4, 3, 4</objectHeights>
|
||||||
|
* <!-- the default render priorities for these object tiles -->
|
||||||
|
* <priorities>0, 0, -1, 0</priorities>
|
||||||
* </tileset>
|
* </tileset>
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@@ -85,6 +87,16 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
|||||||
((ObjectTileSet)target).setYOrigins(yorigins);
|
((ObjectTileSet)target).setYOrigins(yorigins);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
digester.addRule(
|
||||||
|
_prefix + TILESET_PATH + "/priorities",
|
||||||
|
new CallMethodSpecialRule(digester) {
|
||||||
|
public void parseAndSet (String bodyText, Object target)
|
||||||
|
{
|
||||||
|
int[] prios = StringUtil.parseIntArray(bodyText);
|
||||||
|
((ObjectTileSet)target).setPriorities(prios);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
|
|||||||
Reference in New Issue
Block a user