@Test public void testUpdateUI() throws Exception { D3Vector position = new D3Vector(150, 100, 500); baseEntity.setPosition(position); D3PolarCoordinate direction = new D3PolarCoordinate(0.25 * Math.PI, 0.5 * Math.PI, 100); baseEntity.setDirection(direction); baseEntity.updateUI(); Assert.assertEquals(150, baseEntity.getSpriteX(), 0.1); Assert.assertEquals(100, baseEntity.getSpriteY(), 0.1); Assert.assertEquals(150, baseEntity.imageView.getLayoutX(), 0.1); Assert.assertEquals(100, baseEntity.imageView.getLayoutY(), 0.1); Assert.assertEquals(45, baseEntity.imageView.getRotate(), 0.1); Assert.assertEquals(0.55, baseEntity.imageView.getScaleX(), 0.1); Assert.assertEquals(0.55, baseEntity.imageView.getScaleY(), 0.1); }
void updateUI() { setSpriteX(position.getX() - imageView.getFitWidth() / 2); setSpriteY(position.getY() - imageView.getFitHeight() / 2); imageView.relocate(getSpriteX(), getSpriteY()); imageView.setRotate(getRotation()); imageView.setScaleX(getScale()); imageView.setScaleY(getScale()); }
BaseEntity { void updateUI() { setSpriteX(position.getX() - imageView.getFitWidth() / 2); setSpriteY(position.getY() - imageView.getFitHeight() / 2); imageView.relocate(getSpriteX(), getSpriteY()); imageView.setRotate(getRotation()); imageView.setScaleX(getScale()); imageView.setScaleY(getScale()); } }
BaseEntity { void updateUI() { setSpriteX(position.getX() - imageView.getFitWidth() / 2); setSpriteY(position.getY() - imageView.getFitHeight() / 2); imageView.relocate(getSpriteX(), getSpriteY()); imageView.setRotate(getRotation()); imageView.setScaleX(getScale()); imageView.setScaleY(getScale()); } BaseEntity(BlockingQueue<UIUpdate> uiUpdates, String image); }
BaseEntity { void updateUI() { setSpriteX(position.getX() - imageView.getFitWidth() / 2); setSpriteY(position.getY() - imageView.getFitHeight() / 2); imageView.relocate(getSpriteX(), getSpriteY()); imageView.setRotate(getRotation()); imageView.setScaleX(getScale()); imageView.setScaleY(getScale()); } BaseEntity(BlockingQueue<UIUpdate> uiUpdates, String image); void setPosition(D3Vector position); void setDirection(D3PolarCoordinate direction); double getSpriteX(); void setSpriteX(double spriteX); double getSpriteY(); void setSpriteY(double spriteY); String getId(); void setId(String id); void delete(); }
BaseEntity { void updateUI() { setSpriteX(position.getX() - imageView.getFitWidth() / 2); setSpriteY(position.getY() - imageView.getFitHeight() / 2); imageView.relocate(getSpriteX(), getSpriteY()); imageView.setRotate(getRotation()); imageView.setScaleX(getScale()); imageView.setScaleY(getScale()); } BaseEntity(BlockingQueue<UIUpdate> uiUpdates, String image); void setPosition(D3Vector position); void setDirection(D3PolarCoordinate direction); double getSpriteX(); void setSpriteX(double spriteX); double getSpriteY(); void setSpriteY(double spriteY); String getId(); void setId(String id); void delete();  }