Esempio n. 1
0
 public function addFloor(LevelItem $item)
 {
     $item->setRemainHeight(!empty($this->floor) ? $this->floor[0]->getItem()->getHeight() - $item->getItem()->getHeight() : 0);
     $this->maxHeight = max($this->maxHeight, $item->getItem()->getHeight());
     $item->setPosition($this->level, count($this->floor));
     $this->floor[] = $item;
     return $this;
 }
Esempio n. 2
0
 private function rectangle($canvas, $x1, $y1, $x2, $y2, LevelItem $item)
 {
     $colors = $this->getColors($canvas);
     imagefilledrectangle($canvas, $x1 * $this->scale, $y1 * $this->scale, $x2 * $this->scale, $y2 * $this->scale, imagecolorallocate($canvas, hexdec(substr($item->getItem()->getId(), 0, 2)), hexdec(substr($item->getItem()->getId(), 2, 2)), hexdec(substr($item->getItem()->getId(), 4, 2))));
     imagerectangle($canvas, $x1 * $this->scale, $y1 * $this->scale, $x2 * $this->scale, $y2 * $this->scale, $colors->borderMain);
     imagettftext($canvas, 7, 0, ($x1 + $item->getItem()->getLength() / 2 - 2) * $this->scale, ($y2 + $item->getItem()->getHeight() / 2) * $this->scale + 4, $colors->fillMain, __DIR__ . '/arial.ttf', $item->getItem()->getLength() . "x" . $item->getItem()->getWidth() . "x" . $item->getItem()->getHeight());
 }