public synchronized void updateFog(){ toUpdate.clear(); toUpdate.add(new Rect(0, 0, mapWidth, mapHeight)); }
public Rect intersect( Rect other ) { Rect result = new Rect(); result.left = Math.max( left, other.left ); result.right = Math.min( right, other.right ); result.top = Math.max( top, other.top ); result.bottom = Math.min( bottom, other.bottom ); return result; }
public Rect union( Rect other ){ Rect result = new Rect(); result.left = Math.min( left, other.left ); result.right = Math.max( right, other.right ); result.top = Math.min( top, other.top ); result.bottom = Math.max( bottom, other.bottom ); return result; }
public Rect intersect( Rect other ) { Rect result = new Rect(); result.left = Math.max( left, other.left ); result.right = Math.min( right, other.right ); result.top = Math.max( top, other.top ); result.bottom = Math.min( bottom, other.bottom ); return result; }
public Rect intersect( Rect other ) { Rect result = new Rect(); result.left = Math.max( left, other.left ); result.right = Math.min( right, other.right ); result.top = Math.max( top, other.top ); result.bottom = Math.min( bottom, other.bottom ); return result; }
public Rect union( Rect other ){ Rect result = new Rect(); result.left = Math.min( left, other.left ); result.right = Math.max( right, other.right ); result.top = Math.min( top, other.top ); result.bottom = Math.max( bottom, other.bottom ); return result; }
protected Rect getConnectionSpace(){ Point c = getDoorCenter(); return new Rect(c.x, c.y, c.x, c.y); }
private synchronized void moveToUpdating(){ updating = new Rect(updated); updated.setEmpty(); }
public synchronized void updateFog( int cell, int radius ){ Rect update = new Rect( (cell % mapWidth) - radius, (cell / mapWidth) - radius, (cell % mapWidth) - radius + 1 + 2*radius, (cell / mapWidth) - radius + 1 + 2*radius); update.left = Math.max(0, update.left); update.top = Math.max(0, update.top); update.right = Math.min(mapWidth, update.right); update.bottom = Math.min(mapHeight, update.bottom); if (update.isEmpty()) return; updateFog( update ); }
public synchronized void updateFog( int cell, int radius ){ Rect update = new Rect( (cell % mapWidth) - radius, (cell / mapWidth) - radius, (cell % mapWidth) - radius + 1 + 2*radius, (cell / mapWidth) - radius + 1 + 2*radius); update.left = Math.max(0, update.left); update.top = Math.max(0, update.top); update.right = Math.min(mapWidth, update.right); update.bottom = Math.min(mapHeight, update.bottom); if (update.isEmpty()) return; updateFog( update ); }
protected Rect getConnectionSpace(){ Point c = connected.size() <= 1 ? center() : getDoorCenter(); return new Rect(c.x, c.y, c.x, c.y); }
protected Rect getConnectionSpace(){ Point c = connected.size() <= 1 ? center() : getDoorCenter(); return new Rect(c.x, c.y, c.x, c.y); }
@Override protected Rect getConnectionSpace() { if (connSpace == null) { Point c = getDoorCenter(); c.x = (int) GameMath.gate(left + 2, c.x, right - 2); c.y = (int) GameMath.gate(top + 2, c.y, bottom - 2); connSpace = new Rect(c.x-1, c.y-1, c.x+1, c.y+1); } return connSpace; } }
public BitmapFilm( Pixmap bitmap, int width, int height ) { this.bitmap = bitmap; int cols = bitmap.getWidth() / width; int rows = bitmap.getHeight() / height; for (int i=0; i < rows; i++) { for (int j=0; j < cols; j++) { Rect rect = new Rect( j * width, i * height, (j+1) * width, (i+1) * height ); add( i * cols + j, rect ); } } }
@Override protected Rect getConnectionSpace() { if (connSpace == null) { Point c = getDoorCenter(); c.x = (int) GameMath.gate(left + 2, c.x, right - 2); c.y = (int) GameMath.gate(top + 2, c.y, bottom - 2); connSpace = new Rect(c.x-1, c.y-1, c.x+1, c.y+1); } return connSpace; } }
@Override public void paint( Level level ) { Painter.fill( level, this, Terrain.WALL ); Painter.fill( level, this, 1 , Terrain.EMPTY ); for (Door door : connected.values()) { door.set( Door.Type.REGULAR ); //set door areas to be empty to help with create walls logic Painter.set(level, door, Terrain.EMPTY); } createWalls( level, new Rect(left+1, top+1, right-1, bottom-1)); }
@Override public void paint( Level level ) { Painter.fill( level, this, Terrain.WALL ); Painter.fill( level, this, 1 , Terrain.EMPTY ); for (Door door : connected.values()) { door.set( Door.Type.REGULAR ); //set door areas to be empty to help with create walls logic Painter.set(level, door, Terrain.EMPTY); } createWalls( level, new Rect(left+1, top+1, right-1, bottom-1)); }
public Tilemap( Object tx, TextureFilm tileset ) { super( 0, 0, 0, 0 ); this.texture = TextureCache.get( tx ); this.tileset = tileset; RectF r = tileset.get( 0 ); cellW = tileset.width( r ); cellH = tileset.height( r ); vertices = new float[16]; updated = new Rect(); }
public Tilemap( Object tx, TextureFilm tileset ) { super( 0, 0, 0, 0 ); this.texture = TextureCache.get( tx ); this.tileset = tileset; RectF r = tileset.get( 0 ); cellW = tileset.width( r ); cellH = tileset.height( r ); vertices = new float[16]; updated = new Rect(); }
public Tilemap( Object tx, TextureFilm tileset ) { super( 0, 0, 0, 0 ); this.texture = TextureCache.get( tx ); this.tileset = tileset; RectF r = tileset.get( 0 ); cellW = tileset.width( r ); cellH = tileset.height( r ); vertices = new float[16]; updated = new Rect(); }