function __construct() { $this->arrowFastNext = Quad::create()->setSizen(8, 8); $this->arrowFastPrev = Quad::create()->setSizen(8, 8); $this->arrowFirst = Quad::create()->setSizen(8, 8); $this->arrowLast = Quad::create()->setSizen(8, 8); $this->arrowPrev = Quad::create()->setSizen(8, 8); $this->arrowNext = Quad::create()->setSizen(8, 8); $this->text = Label::create()->setSizen(14); $this->textBg = Quad::create()->setSizen(16, 6); }
static function getTree() { $manialink = Manialink::create()->setVersion(1)->setBackground('stations')->setNavigable3d(0); Timeout::create()->setNodeValue(0)->appendTo($manialink); $cellCountX = 4; $cellCountY = 3; $frame = Frame::create()->setSizen(300, 160)->setPosn(-150, 80, 0)->setLayout(new Flow())->appendTo($manialink); $cases = array(); for ($y = 0; $y < $cellCountY; $y++) { for ($x = 0; $x < $cellCountX; $x++) { $cases[] = Frame::create()->setSizen(300 / $cellCountX, 160 / $cellCountY)->appendTo($frame)->appendChild(Quad::create()->setSizen(300 / $cellCountX, 160 / $cellCountY)->setBgcolor(($x + $y) % 2 ? 'ccc' : '666')); } } $title = Label::create()->setSizen(300 / $cellCountX - 4, 10)->setPosn(0, -1, 1)->setBothAlign('center', 'top')->setAutonewline(1)->setStyle(LabelStyles::TextValueSmallSm)->setTextSize(2)->setTextcolor('ff0')->appendTo($cases[0]); $quad = Quad::create()->setSizen(11, 11)->setBgcolor('f00'); $frame = Frame::create()->setPosn(15, -15, 1)->appendChild(Quad::create()->setSizen(10, 10)->setPosn(0, 0, 5)->setAlign('center', 'center')->setStyle(Icons64x64_1::QuitRace)); $frameSize = $frame->getClone()->setSizen(30, 30)->appendChild(Quad::create()->setSizen(30, 30)->setBgcolor('fff5')); $frameSizeAlign = $frameSize->getClone()->setAlign('center', 'center')->setPosn(30, -30); $elt = $frameSizeAlign->getChildren(); $elt = reset($elt); $elt->setRelativeAlign('center', 'center'); $frameSizeSmall = $frame->getClone()->setPosn(0, 0, 1)->setSizen(13, 13)->appendChild(Quad::create()->setSizen(13, 13)->setBgcolor('fff5')); $quadSmall = $quad->getClone()->setSizen(7, 7); $cases[0]->appendChild($title->getClone()->setText('1. Frame + Quad')); $cases[0]->appendChild($frame->getClone()->appendChild($quad->getClone())); $cases[1]->appendChild($title->getClone()->setText('2. Frame + Quad + Align')); $cases[1]->appendChild($frame->getClone()->appendChild($quad->getClone()->setAlign('center', 'center'))); $cases[2]->appendChild($title->getClone()->setText('3. Frame + Size + Quad')); $cases[2]->appendChild($frameSize->getClone()->appendChild($quad->getClone())); $cases[3]->appendChild($title->getClone()->setText('4. Frame + Size + Quad + Align')); $cases[3]->appendChild($frameSize->getClone()->appendChild($quad->getClone()->setAlign('center', 'center'))); $cases[4]->appendChild($title->getClone()->setText('5. Frame + Size + Quad + Relative Align')); $cases[4]->appendChild($frameSize->getClone()->setPosn(10, -10)->appendChild($quad->getClone()->setRelativeAlign('right', 'bottom'))); $cases[5]->appendChild($title->getClone()->setText('6. Frame + Size + Quad + Relative Align + Align')); $cases[5]->appendChild($frameSize->getClone()->appendChild($quad->getClone()->setRelativeAlign('right', 'bottom')->setAlign('right', 'bottom'))); $cases[6]->appendChild($title->getClone()->setText('7. Frame + Size + Align + Quad')); $cases[6]->appendChild($frameSizeAlign->getClone()->appendChild($quad->getClone())); $cases[7]->appendChild($title->getClone()->setText('8. Frame + Size + Align + Quad + Relative Align + Align')); $cases[7]->appendChild($frameSizeAlign->getClone()->appendChild($quad->getClone()->setRelativeAlign('right', 'bottom')->setAlign('right', 'bottom'))); $cases[8]->appendChild($title->getClone()->setText('9. Frame + Size + Align + Frame + Size')); $cases[8]->appendChild($frameSizeAlign->getClone()->appendChild($frameSizeSmall->getClone())); $cases[9]->appendChild($title->getClone()->setText('10. Frame + Size + Align + Frame + Size + Both Align')); $cases[9]->appendChild($frameSizeAlign->getClone()->appendChild($frameSizeSmall->getClone()->setBothAlign('right', 'bottom'))); $cases[10]->appendChild($title->getClone()->setText('11. Frame + Size + Align + Frame + Size + Both Align + Quad')); $cases[10]->appendChild($frameSizeAlign->getClone()->appendChild($frameSizeSmall->getClone()->setBothAlign('right', 'bottom')->appendChild($quadSmall->getClone()))); $cases[11]->appendChild($title->getClone()->setText('9. Frame + Size + Align + Frame + Size + Both Align + Quad + Both Align')); $cases[11]->appendChild($frameSizeAlign->getClone()->appendChild($frameSizeSmall->getClone()->setBothAlign('right', 'bottom')->appendChild($quadSmall->getClone()->setBothAlign('right', 'bottom')))); return $manialink; }
$frame = Frame::create()->setSizen(300, 160)->setPosn(-150, 80, 0)->setLayout(new Flow())->appendTo($manialink); $cases = array(); for ($y = 0; $y < CELL_COUNT_Y; $y++) { for ($x = 0; $x < CELL_COUNT_X; $x++) { $cases[] = Frame::create()->setSizen(300 / CELL_COUNT_X, 160 / CELL_COUNT_Y)->appendTo($frame)->appendChild(Quad::create()->setSizen(300 / CELL_COUNT_X, 160 / CELL_COUNT_Y)->setBgcolor(($x + $y) % 2 ? 'ccc' : '666')); } } $title = Label::create()->setSizen(300 / CELL_COUNT_X - 4, 10)->setPosn(0, -1, 1)->setBothAlign('center', 'top')->setAutonewline(1)->setStyle(LabelStyles::TextValueSmallSm)->setTextSize(2)->setTextcolor('ff0')->appendTo($cases[0]); $quad = Quad::create()->setSizen(11, 11)->setBgcolor('f00'); $frame = Frame::create()->setPosn(15, -15, 1)->appendChild(Quad::create()->setSizen(10, 10)->setPosn(0, 0, 5)->setAlign('center', 'center')->setStyle(Icons64x64_1::QuitRace)); $frameSize = $frame->getClone()->setSizen(30, 30)->appendChild(Quad::create()->setSizen(30, 30)->setBgcolor('fff5')); $frameSizeAlign = $frameSize->getClone()->setAlign('center', 'center')->setPosn(30, -30); $elt = $frameSizeAlign->getChildren(); $elt = reset($elt); $elt->setRelativeAlign('center', 'center'); $frameSizeSmall = $frame->getClone()->setPosn(0, 0, 1)->setSizen(13, 13)->appendChild(Quad::create()->setSizen(13, 13)->setBgcolor('fff5')); $quadSmall = $quad->getClone()->setSizen(7, 7); $cases[0]->appendChild($title->getClone()->setText('1. Frame + Quad')); $cases[0]->appendChild($frame->getClone()->appendChild($quad->getClone())); $cases[1]->appendChild($title->getClone()->setText('2. Frame + Quad + Align')); $cases[1]->appendChild($frame->getClone()->appendChild($quad->getClone()->setAlign('center', 'center'))); $cases[2]->appendChild($title->getClone()->setText('3. Frame + Size + Quad')); $cases[2]->appendChild($frameSize->getClone()->appendChild($quad->getClone())); $cases[3]->appendChild($title->getClone()->setText('4. Frame + Size + Quad + Align')); $cases[3]->appendChild($frameSize->getClone()->appendChild($quad->getClone()->setAlign('center', 'center'))); $cases[4]->appendChild($title->getClone()->setText('5. Frame + Size + Quad + Relative Align')); $cases[4]->appendChild($frameSize->getClone()->setPosn(10, -10)->appendChild($quad->getClone()->setRelativeAlign('right', 'bottom'))); $cases[5]->appendChild($title->getClone()->setText('6. Frame + Size + Quad + Relative Align + Align')); $cases[5]->appendChild($frameSize->getClone()->appendChild($quad->getClone()->setRelativeAlign('right', 'bottom')->setAlign('right', 'bottom'))); $cases[6]->appendChild($title->getClone()->setText('7. Frame + Size + Align + Quad')); $cases[6]->appendChild($frameSizeAlign->getClone()->appendChild($quad->getClone()));
function __construct() { $this->bg = Quad::create()->appendTo($this); }
error_reporting(E_ALL); $ml = new Manialink(); Timeout::create()->setNodeValue(0)->appendTo($ml); $frame = Frame::create()->setPosn(-150, 80)->appendTo($ml); Quad::create()->setSizen(50, 10)->setPosn(2, 0, 0.1)->setStyle(Bgs1::BgWindow1)->appendTo($frame); Label::create()->setSizen(50, 5)->setPosn(0, -15, 0.1)->setText('hello world')->appendTo($frame); $frame2 = Frame::create()->setPosn(0, -25, 0.1)->setLayout(Line::create()->setMarginWidth(1))->appendTo($frame); for ($i = 0; $i < 5; $i++) { Quad::create()->setSizen(5, 5)->setBgcolor('ccc')->appendTo($frame2); } $ui = LabelBox::create()->setPosn(0, -35)->setSizen(100, 10)->appendTo($frame); $ui->getBg()->setStyle(Bgs1::BgTitle3); $ui->getLabel()->setText('Much foobar')->setTextSize(4); $frame2 = Frame::create()->setPosn(0, -50)->setSizen(50, 50)->setAlign('left', 'top')->appendTo($frame); Quad::create()->setSizen(50, 50)->setBgcolor('eee')->appendTo($frame2); Quad::create()->setSizen(10, 10)->setPosnZ(0.1)->setAlign('right', 'bottom')->setRelativeAlign('right', 'bottom')->setBgcolor('ccc')->appendTo($frame2); Script::create()->setNodeValue('main(){ log("Hello world"); } // < &')->appendTo($ml); Fragment::create()->setNodeValue('<label text="This label is written directly in XML" />')->appendTo($ml); return $ml; //This will output: //<manialink version="1"> // <timeout>0</timeout> // <frame posn="-150 80 0"> // <quad style="Bgs1" substyle="BgWindow1" posn="2 0 0.1" sizen="50 10"/> // <label text="hello world" posn="0 -15 0.1" sizen="50 5"/> // <frame posn="0 -25 0.1"> // <quad bgcolor="ccc" posn="0 0 0" sizen="5 5"/> // <quad bgcolor="ccc" posn="6 0 0" sizen="5 5"/> // <quad bgcolor="ccc" posn="12 0 0" sizen="5 5"/> // <quad bgcolor="ccc" posn="18 0 0" sizen="5 5"/> // <quad bgcolor="ccc" posn="24 0 0" sizen="5 5"/>
use ManiaLib\Manialink\Elements\Frame; use ManiaLib\Manialink\Elements\Label; use ManiaLib\Manialink\Elements\Manialink; use ManiaLib\Manialink\Elements\Quad; use ManiaLib\Manialink\Elements\Timeout; use ManiaLib\Manialink\Layouts\Line; use ManiaLib\Manialink\Styles\Icons64x64_1; use ManiaLib\Manialink\Styles\LabelStyles; error_reporting(E_ALL); $ml = new Manialink(); Timeout::create()->setNodeValue(0)->appendTo($ml); $alignements = array('left', 'center', 'right'); Label::create()->setText('Line layout examples')->setAlign('center')->setStyle(LabelStyles::TextRaceMessageBig)->setPosn(0, 80)->appendTo($ml); $contentFrame = Frame::create()->setPosn(-150, 60)->setLayout(Line::create())->appendTo($ml); foreach ($alignements as $key => $aligmenement) { $testFrame = Frame::create()->setSizen(90, 35)->appendTo($contentFrame); Label::create()->setBothAlign('center')->setText(sprintf('%s align', ucfirst($aligmenement)))->setStyle(LabelStyles::TextTitle3)->setPosn(0, -3)->appendTo($testFrame); Quad::create()->setSizen(6, 6)->setRelativeValign('center')->setAlign('center', 'center')->setPosn(25, -3, 2)->setStyle(Icons64x64_1::QuitRace)->appendTo($testFrame); $frame = Frame::create()->setRelativeValign('center')->setPosn(25, -3)->setLayout(Line::create()->setMarginWidth(1))->appendTo($testFrame); for ($i = 0; $i < 3; $i++) { Quad::create()->setSizen(20, 20)->setAlign($aligmenement, 'center')->setBgcolor('F00')->setOpacity(0.5)->appendTo($frame); } } $testFrame = Frame::create()->setPosn(-45, 20)->setSizen(90, 35)->appendTo($ml); Label::create()->setBothAlign('center')->setText('left and right align')->setStyle(LabelStyles::TextTitle3)->setPosn(0, -3)->appendTo($testFrame); Quad::create()->setSizen(6, 6)->setRelativeValign('center')->setAlign('center', 'center')->setPosn(25, -3, 2)->setStyle(Icons64x64_1::QuitRace)->appendTo($testFrame); $frame = Frame::create()->setRelativeValign('center')->setPosn(25, -3)->setLayout(Line::create()->setMarginWidth(1))->appendTo($testFrame); for ($i = 0; $i < 3; $i++) { Quad::create()->setSizen(20, 20)->setHalign($i % 2 == 0 ? 'left' : 'right')->setBgcolor('F00')->setOpacity(0.5)->appendTo($frame); } return $ml;