@Test public void testIsPointInnerMap () { RegionMap map = new RegionMap("test.tmx", 0, 0, 5, 5, 32, 32); assertEquals(false, map.isPointInnerMap(200, 200)); assertEquals(false, map.isPointInnerMap(161, 161)); assertEquals(true, map.isPointInnerMap(160, 160)); assertEquals(true, map.isPointInnerMap(150, 160)); assertEquals(false, map.isPointInnerMap(150, 161)); assertEquals(false, map.isPointInnerMap(160, 161)); assertEquals(false, map.isPointInnerMap(161, 160)); assertEquals(false, map.isPointInnerMap(-1, -1)); assertEquals(false, map.isPointInnerMap(-1, 1)); assertEquals(false, map.isPointInnerMap(1, -1)); assertEquals(true, map.isPointInnerMap(1, 1)); assertEquals(true, map.isPointInnerMap(0, 0)); }
public boolean isPointInnerMap (float objX, float objY) { int width = widthInTiles * tileWidth; int height = heightInTiles * tileHeight; return MathUtils.overlapping(absX, absX + width, objX, objX) && MathUtils.overlapping(absY, absY + height, objY, objY); }
RegionMap { public boolean isPointInnerMap (float objX, float objY) { int width = widthInTiles * tileWidth; int height = heightInTiles * tileHeight; return MathUtils.overlapping(absX, absX + width, objX, objX) && MathUtils.overlapping(absY, absY + height, objY, objY); } }
RegionMap { public boolean isPointInnerMap (float objX, float objY) { int width = widthInTiles * tileWidth; int height = heightInTiles * tileHeight; return MathUtils.overlapping(absX, absX + width, objX, objX) && MathUtils.overlapping(absY, absY + height, objY, objY); } RegionMap(String file, int absX, int absY, int widthInTiles, int heightInTiles, int tileWidth, int tileHeight); }
RegionMap { public boolean isPointInnerMap (float objX, float objY) { int width = widthInTiles * tileWidth; int height = heightInTiles * tileHeight; return MathUtils.overlapping(absX, absX + width, objX, objX) && MathUtils.overlapping(absY, absY + height, objY, objY); } RegionMap(String file, int absX, int absY, int widthInTiles, int heightInTiles, int tileWidth, int tileHeight); boolean isPointInnerMap(float objX, float objY); }
RegionMap { public boolean isPointInnerMap (float objX, float objY) { int width = widthInTiles * tileWidth; int height = heightInTiles * tileHeight; return MathUtils.overlapping(absX, absX + width, objX, objX) && MathUtils.overlapping(absY, absY + height, objY, objY); } RegionMap(String file, int absX, int absY, int widthInTiles, int heightInTiles, int tileWidth, int tileHeight); boolean isPointInnerMap(float objX, float objY); final String file; final int absX; final int absY; final int widthInTiles; final int heightInTiles; }