<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create audio element to play a sound $audio = new \FML\Controls\Audio(); $maniaLink->addChild($audio); $audio->setSize(20, 20)->setVolume(30)->setData('http://fml.steeffeen.com/media/shoopdawhoop.ogg'); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create entry element to allow input $entry = new \FML\Controls\Entry(); $maniaLink->addChild($entry); $entry->setSize(50, 7)->setName('input')->setAutoComplete(true); // Add submit feature $entry->addSubmitFeature('fancyml?entrysubmit'); // Display input if any is given if (!empty($_GET['input'])) { $outputLabel = new \FML\Controls\Label(); $maniaLink->addChild($outputLabel); $outputLabel->setY(-30)->setText("Your Input: '{$_GET['input']}'"); } // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create music element to play background music $music = new \FML\Elements\Music(); $maniaLink->addChild($music); $music->setData('http://fml.steeffeen.com/media/cantinabar.ogg'); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create file entry element to allow uploading a ScreenShot file $fileEntry = new \FML\Controls\FileEntry(); $maniaLink->addChild($fileEntry); $fileEntry->setSize(50, 7)->setName('inputFile')->setFolder('ScreenShots'); // Add submit button $submitButton = new \FML\Controls\Quads\Quad_Icons64x64_1(); $maniaLink->addChild($submitButton); $submitButton->setSize(10, 10)->setX(40)->setSubStyle($submitButton::SUBSTYLE_Outbox)->setManialink('POST(fancyml?fileentry&filename=inputFile,inputFile)'); // Display information about uploaded file if (isset($_GET['filename'])) { // Get content of uploaded file $inputFile = file_get_contents('php://input'); if ($inputFile) { // Temporarily save the file, determine size and delete it $fileUrl = tempnam(null, 'fml_'); file_put_contents($fileUrl, $inputFile); $fileSize = round(filesize($fileUrl) / 1024.0, 2); unlink($fileUrl); // Build output labels showing file name and size $nameLabel = new \FML\Controls\Label(); $maniaLink->addChild($nameLabel); $nameLabel->setPosition(-20, -22)->setHorizontalAlign('left')->setText('File Name: ' . $_GET['filename']); $sizeLabel = new \FML\Controls\Label(); $maniaLink->addChild($sizeLabel); $sizeLabel->setPosition(-20, -30)->setHorizontalAlign('left')->setText("File Size: {$fileSize} KB");
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create map info button $mapInfoQuad = new \FML\Controls\Quads\Quad_Icons128x128_1(); $maniaLink->addChild($mapInfoQuad); $mapInfoQuad->setSize(30, 30)->setSubStyle($mapInfoQuad::SUBSTYLE_Editor)->addMapInfoFeature(); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create menu item list $menuItem0 = new \FML\Controls\Labels\Label_Button(); $maniaLink->addChild($menuItem0); $menuItem0->setPosition(-50, 10)->setStyle($menuItem0::STYLE_CardButtonSmall)->setText('Neutral'); $menuItem1 = new \FML\Controls\Labels\Label_Button(); $maniaLink->addChild($menuItem1); $menuItem1->setPosition(-50, 0)->setStyle($menuItem1::STYLE_CardButtonSmall)->setText('Blue Team'); $menuItem2 = new \FML\Controls\Labels\Label_Button(); $maniaLink->addChild($menuItem2); $menuItem2->setPosition(-50, -10)->setStyle($menuItem2::STYLE_CardButtonSmall)->setText('Red Team'); // Create subMenus $subMenu0 = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($subMenu0); $subMenu0->setPosition(10, 0)->setSize(50, 50)->setSubStyle($subMenu0::SUBSTYLE_0); $subMenu1 = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($subMenu1); $subMenu1->setPosition(10, 0)->setSize(50, 50)->setSubStyle($subMenu1::SUBSTYLE_1)->setVisible(false); $subMenu2 = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($subMenu2); $subMenu2->setPosition(10, 0)->setSize(50, 50)->setSubStyle($subMenu2::SUBSTYLE_2)->setVisible(false); // Create menu $menu = new \FML\Script\Features\Menu(); $maniaLink->createScript()->addFeature($menu); $menu->addItem($menuItem0, $subMenu0)->addItem($menuItem1, $subMenu1, true)->addItem($menuItem2, $subMenu2); // Print xml
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Add toggled control $toggleQuad = new \FML\Controls\Quad(); $maniaLink->addChild($toggleQuad); $toggleQuad->setX(10)->setSize(10, 10)->setBackgroundColor('00f'); // Add quad toggling another quad $clickQuad = new \FML\Controls\Quad(); $maniaLink->addChild($clickQuad); $clickQuad->setX(-10)->setSize(10, 10)->setBackgroundColor('0f0')->addToggleFeature($toggleQuad); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create frame model containing elements $frameModel = new \FML\Elements\FrameModel(); $maniaLink->addChild($frameModel); $frameModel->setId('MyFrameModel'); $label = new \FML\Controls\Label(); $frameModel->addChild($label); $label->setText('Neat!'); $quad = new \FML\Controls\Quads\Quad_Copilot(); $frameModel->addChild($quad); $quad->setY(-10)->setSize(10, 10)->setSubStyle($quad::SUBSTYLE_UpGood); $quad = new \FML\Controls\Quads\Quad_Copilot(); $frameModel->addChild($quad); $quad->setY(10)->setSize(10, 10)->setSubStyle($quad::SUBSTYLE_Down); // Create frame instances at various positions for ($i = -5; $i <= 5; $i++) { $frameInstance = new \FML\Controls\FrameInstance(); $maniaLink->addChild($frameInstance); $frameInstance->setModel($frameModel)->setX($i * 13); } // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Label element showing the current time $timeLabel = new \FML\Controls\Label(); $maniaLink->addChild($timeLabel); $timeLabel->setId('Label_Time'); // Create script with plain script text showing the local date time $script = new \FML\Elements\SimpleScript(); $maniaLink->addChild($script); $scriptText = ' main() { declare Label_Time <=> (Page.GetFirstChild("Label_Time") as CMlLabel); while (True) { yield; Label_Time.Value = CurrentLocalDateText; } }'; $script->setText($scriptText); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create the tooltip label $tooltipLabel = new \FML\Controls\Label(); $maniaLink->addChild($tooltipLabel); $tooltipLabel->setY(-20); // Create first quad $firstQuad = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($firstQuad); $firstQuad->setPosition(-20, 10)->setSize(20, 20)->setSubStyle($firstQuad::SUBSTYLE_1)->addTooltipLabelFeature($tooltipLabel, 'First Quad'); // Create second quad $secondQuad = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($secondQuad); $secondQuad->setPosition(20, 10)->setSize(20, 20)->setSubStyle($secondQuad::SUBSTYLE_2)->addTooltipLabelFeature($tooltipLabel, 'Second Quad', true); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); $script = $maniaLink->createScript(); // Label element showing the current time $timeLabel = new \FML\Controls\Label(); $maniaLink->addChild($timeLabel); $timeLabel->setId("Label_Time"); // Add custom script label to show the local date time $scriptText = ' declare Label_Time <=> (Page.GetFirstChild("Label_Time") as CMlLabel); Label_Time.Value = CurrentLocalDateText; '; $script->addCustomScriptLabel(\FML\Script\ScriptLabel::LOOP, $scriptText); // Add another custom part for fun $timeLabel->setScriptEvents(true); $scriptText = ' Event.Control.Scale *= 1.3; '; $script->addCustomScriptLabel(\FML\Script\ScriptLabel::MOUSECLICK, $scriptText); $scriptText = ' Event.Control.Scale = 1.; '; $script->addCustomScriptLabel(\FML\Script\ScriptLabel::MOUSEOUT, $scriptText); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create profile button $profileQuad = new \FML\Controls\Quads\Quad_Icons128x128_1(); $maniaLink->addChild($profileQuad); $profileQuad->setSize(30, 30)->setSubStyle($profileQuad::SUBSTYLE_Profile)->addPlayerProfileFeature('PlayerLogin'); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create pages $page0 = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($page0); $page0->setSize(50, 50)->setSubStyle($page0::SUBSTYLE_0); $page1 = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($page1); $page1->setSize(50, 50)->setSubStyle($page1::SUBSTYLE_1); $page2 = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($page2); $page2->setSize(50, 50)->setSubStyle($page2::SUBSTYLE_2); // Create paging buttons $leftPagerQuad = new \FML\Controls\Quads\Quad_Icons64x64_1(); $maniaLink->addChild($leftPagerQuad); $leftPagerQuad->setPosition(-20, -30)->setSize(10, 10)->setSubStyle($leftPagerQuad::SUBSTYLE_ArrowPrev); $rightPagerQuad = new \FML\Controls\Quads\Quad_Icons64x64_1(); $maniaLink->addChild($rightPagerQuad); $rightPagerQuad->setPosition(20, -30)->setSize(10, 10)->setSubStyle($rightPagerQuad::SUBSTYLE_ArrowNext); // Create counter label (optional) $counterLabel = new \FML\Controls\Label(); $maniaLink->addChild($counterLabel); $counterLabel->setY(-30); // Create paging $paging = new \FML\Script\Features\Paging(); $maniaLink->createScript()->addFeature($paging); // Set pagers
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create checkbox $checkBox = new \FML\Components\CheckBox('TestCheckBox'); $maniaLink->addChild($checkBox); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Static action via xml $homeLabel = new \FML\Controls\Label(); $maniaLink->addChild($homeLabel); $homeLabel->setX(-10)->setText('Home')->setAction(\FML\Types\Actionable::ACTION_HOME); // Dynamic action via script $enterLabel = new \FML\Controls\Label(); $maniaLink->addChild($enterLabel); $enterLabel->setX(10)->setText('Quit')->addActionTriggerFeature(\FML\Types\Actionable::ACTION_QUIT); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create quad playing a sound on click $soundQuad = new \FML\Controls\Quads\Quad_Icons64x64_1(); $maniaLink->addChild($soundQuad); $soundQuad->setSize(40, 40)->setSubStyle($soundQuad::SUBSTYLE_ClipPlay)->addUISoundFeature(\FML\Script\Features\UISound::Capture); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Label element $testLabel = new \FML\Controls\Label(); $maniaLink->addChild($testLabel); $testLabel->setText('Click Me!'); // Add custom script text to show a click counter $scriptText = ' declare Counter for Label = 0; Counter += 1; Label.Value = Counter^"x! Click Me Again!"; '; $testLabel->addScriptText($scriptText); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Include another url $include = new \FML\Elements\Including(); $maniaLink->addChild($include); $include->setUrl('http://fml.steeffeen.com/examples/included.php'); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create the tooltip quad $tooltipQuad = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($tooltipQuad); $tooltipQuad->setPosition(50, 50)->setSize(50, 50)->setSubStyle($tooltipQuad::SUBSTYLE_2); // Create quad for which a tooltip will be shown $quad = new \FML\Controls\Quads\Quad_Emblems(); $maniaLink->addChild($quad); $quad->setSize(50, 50)->setSubStyle($quad::SUBSTYLE_1)->addTooltipFeature($tooltipQuad); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create value picker $valuePicker = new \FML\Components\ValuePicker('TestValuePicker'); $maniaLink->addChild($valuePicker); $valuePicker->setValues(array('Hydrogen', 'Helium', 'Lithium', 'Beryllium', 'Boron')); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create frame containing some elements $frame = new \FML\Controls\Frame(); $maniaLink->addChild($frame); // Add dark background for complete window $backgroundQuad = new \FML\Controls\Quad(); $frame->addChild($backgroundQuad); $backgroundQuad->setZ(-3)->setSize(400, 200)->setBackgroundColor('222'); // Create ManiaPlanet icon in top right corner $mpIconQuad = new \FML\Controls\Quads\Quad_ManiaPlanetLogos(); $frame->addChild($mpIconQuad); $mpIconQuad->setPosition(120, 70)->setSize(80, 20)->setSubStyle($mpIconQuad::SUBSTYLE_ManiaPlanetLogoWhite); // Create emblem on the left side $emblemQuad = new \FML\Controls\Quads\Quad_Emblems(); $frame->addChild($emblemQuad); $emblemQuad->setX(-110)->setSize(70, 70)->setSubStyle($emblemQuad::SUBSTYLE_1); // Create emblem on the right side $emblemQuad = new \FML\Controls\Quads\Quad_Emblems(); $frame->addChild($emblemQuad); $emblemQuad->setX(110)->setSize(70, 70)->setSubStyle($emblemQuad::SUBSTYLE_2); // Create center background $backgroundQuad = new \FML\Controls\Quads\Quad_UiSMSpectatorScoreBig(); $frame->addChild($backgroundQuad); $backgroundQuad->setPosition(0, -1, -2)->setSize(100, 150)->setSubStyle($backgroundQuad::SUBSTYLE_PlayerSlot); // Create some lines with several elements $y = 50;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create entry element to allow input $entry = new \FML\Controls\Entry(); $maniaLink->addChild($entry); $entry->setSize(50, 7)->setName('input'); // Add submit button $submitButton = new \FML\Controls\Quads\Quad_Icons64x64_1(); $maniaLink->addChild($submitButton); $submitButton->setSize(10, 10)->setX(40)->setSubStyle($submitButton::SUBSTYLE_Outbox)->setManialink('fancyml?entry&input=input'); // Display input if any is given if (!empty($_GET['input'])) { $outputLabel = new \FML\Controls\Label(); $maniaLink->addChild($outputLabel); $outputLabel->setY(-30)->setText("Your Input: '{$_GET['input']}'"); } // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create default time label $label = new \FML\Controls\Label(); $maniaLink->addChild($label); $label->setY(10)->addClockFeature(); // Create time label without seconds $label = new \FML\Controls\Label(); $maniaLink->addChild($label); $label->addClockFeature(false); // Create full date label $label = new \FML\Controls\Label(); $maniaLink->addChild($label); $label->setY(-10)->addClockFeature(true, true); // Print xml echo $maniaLink;
<?php // Include FML require_once __DIR__ . '/../autoload.php'; // Create ManiaLink $maniaLink = new \FML\ManiaLink(); // Create video element to play a short animation $video = new \FML\Controls\Video(); $maniaLink->addChild($video); $video->setSize(100, 60)->setData('http://fml.steeffeen.com/media/stylewalker.bik'); // Print xml echo $maniaLink;