Actually, those behaviors are so much alike, let's group it into a handy interface to ensure they stay that way.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@973 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2010-08-10 22:54:49 +00:00
parent 469d356609
commit 85aca29ae6
3 changed files with 41 additions and 6 deletions
@@ -0,0 +1,35 @@
//
// Nenya library - tools for developing networked games
// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/nenya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.media.tile;
public interface BaseSizableTileSet
{
/**
* Returns the base width for the specified object index.
*/
public abstract int getBaseWidth (int tileIdx);
/**
* Returns the base height for the specified object index.
*/
public abstract int getBaseHeight (int tileIdx);
}
@@ -33,7 +33,7 @@ import com.threerings.media.image.Colorization;
* @see ObjectTile
*/
public class ObjectTileSet extends SwissArmyTileSet
implements RecolorableTileSet
implements RecolorableTileSet, BaseSizableTileSet
{
/** A constraint prefix indicating that the object must have empty space in
* the suffixed direction (N, E, S, or W). */
@@ -193,16 +193,16 @@ public class ObjectTileSet extends SwissArmyTileSet
return _zations;
}
/**
* Returns the base width for the specified object index.
/* (non-Javadoc)
* @see com.threerings.media.tile.BaseSizableTileSet#getBaseWidth(int)
*/
public int getBaseWidth (int tileIdx)
{
return _owidths[tileIdx];
}
/**
* Returns the base height for the specified object index.
/* (non-Javadoc)
* @see com.threerings.media.tile.BaseSizableTileSet#getBaseHeight(int)
*/
public int getBaseHeight (int tileIdx)
{
@@ -43,7 +43,7 @@ import com.threerings.media.tile.util.TileSetTrimmer;
* memory efficient).
*/
public class TrimmedObjectTileSet extends TileSet
implements RecolorableTileSet
implements RecolorableTileSet, BaseSizableTileSet
{
@Override
public int getTileCount ()