Skip to content

Instantly share code, notes, and snippets.

@fodinabor
Last active August 29, 2015 14:06
Show Gist options
  • Save fodinabor/d30dfb89095f80165a70 to your computer and use it in GitHub Desktop.
Save fodinabor/d30dfb89095f80165a70 to your computer and use it in GitHub Desktop.
Polycode UI Needed things
CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
CoreServices::getInstance()->getResourceManager()->addArchive("UIThemes.pak");
CoreServices::getInstance()->getConfig()->loadConfig("Polycode", "UIThemes/dark/theme.xml");
//creating HUD
hud = new Scene(Scene::SCENE_2D_TOPLEFT);
fps = new UILabel("FPS: " + String::NumberToString(core->getFPS()), 16, "mono"); //fps is a UILabel declared in the header file
fps->setPosition(core->getXRes() - 75, 8);
fps->setColor(1.0, 1.0, 0.0, 1.0);
hud->addChild(fps);
String controlsText = "WASD for movement, SHIFT for boost, Mouse or Arrow Keys for rotation, SPACE for Music,\nESC to exit, F1 to swap Cam, F12 to toggle fullscreen";
UIMultilineLabel *controls = new UIMultilineLabel(controlsText, 16, 5, "mono");
Logger::log("controls: %s\n", controls->getText().c_str());
controls->setPosition(5, 8);
controls->setColor(1.0, 1.0, 1.0, 1.0);
hud->addChild(controls);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment