DemoState::DemoState(const std::string& stateID, GUI* gui) : GUIState(stateID, gui) { gui->formatTooltip("fonts/copperplate_gothic.glf", 10, ColourRGBA::YELLOW); /* Create the options area */ GUIElement* optionsContainer = new GUIElement("optionsContainer", Vector2(-470, 200)); // Empty element, used as a container optionsContainer->attachChild(new Label("state_title", "Demonstration", 14, Vector2(0, 70))); optionsContainer->attachChild(new Label("state_subtitle", "Press some buttons!", 9, Vector2(0, 55))); ComboBox* cursorCombo = new ComboBox("cursorCombo", Vector2(105, 40), 200); cursorCombo->attachChild(new Label("cursorLabel", "Cursor:", Vector2(-55, 11))); cursorCombo->setOptions(6, "Standard", "Arrow", "Diamond sword", "Dragon scimitar", "Portal gun", "Sonic screwdriver"); optionsContainer->attachChild(cursorCombo); cursorCombo->getDescendant("option_Standard")->setToolTip("Bug: might not re-appear."); cursorCombo->getDescendant("option_Portal gun")->setToolTip("Animated!"); ComboBox* imageCombo = new ComboBox("imageCombo", Vector2(85, 0), 150); imageCombo->attachChild(new Label("imageLabel", "Image:", Vector2(-45, 11))); imageCombo->setOptions(5, "Bat-smiley", "Derby", "Rage", "Red John", "You tried"); imageCombo->setSelected("Red John"); optionsContainer->attachChild(imageCombo); createImage("demo/images/redjohn.tga"); Button* demoAnim = createNiceButton("demoAnim", Vector2(0, -58), "Animation"); demoAnim->setToolTip("Opens the animation window."); demoAnim->resize(128, 37); optionsContainer->attachChild(demoAnim); optionsContainer->attachChild(createNiceButton("demoEffects", Vector2(0, -102), "Effects")) ->setToolTip("Opens the effects window."); optionsContainer->attachChild(createNiceButton("demoRGBA", Vector2(0, -146), "Colour")) ->setToolTip("Opens an RGBA colour picker."); optionsContainer->attachChild(createNiceButton("demoChatbox", Vector2(0, -190), "Chatbox")) ->setToolTip("Demonstrates TextField and ScrollPane."); attachChild(optionsContainer); }
void DemoState::createPlainWindow() { detachChild("plainWindow"); plainWindow = new Window("plainWindow", Vector2(100, 100), Vector2(300, 200), ColourRGBA(ColourRGBA::CYAN)); plainWindow->setDraggable(true); plainWindow->setResizable(true); plainWindow->setGradiant(TO_BOTTOM, 4.0f); ComboBox* gradiants = new ComboBox("gradiantCombo", Vector2(120, 80), 120); gradiants->setOptions(5, "To bottom", "To top", "To left", "To right", "None"); gradiants->attachChild(new Label("gradLabel", "Gradiant:", 10, Vector2(-55, 10))); plainWindow->attachChild(gradiants); attachChild(plainWindow); }
void ViewerState::createOptions() { Vector2 labelOffset = Vector2(12, 8); GUIElement* optionsContainer = new GUIElement("optionsContainer", Vector2(-490, -370)); ComboBox* modelBox = new ComboBox("modelCombo", Vector2(83, 210), 165); modelBox->setOptions(8, "Crate", "Cone", "Cube", "Deathstar", "Deer", "TARDIS", "Teapot", "Teddy"); modelBox->setSelected("Teapot"); modelBox->attachChild(new Label("modelLabel", "Model:", Vector2(-45, 11))); optionsContainer->attachChild(modelBox); p_textureCombo = new ComboBox("textureCombo", Vector2(103, 175), 165); p_textureCombo->attachChild(new Label("texLabel", "Texture:", Vector2(-55, 11))); p_textureCombo->setOptions(5, "Untextured", "Crate", "Cone", "Deer", "Derby"); optionsContainer->attachChild(p_textureCombo); p_toggleSpinning = new Checkbox("togSpinning", Vector2(0, 40)); p_toggleSpinning->attachChild(new Label("spLabel", "Idle spin", 9, labelOffset)); p_toggleSpinning->setTicked(true); Checkbox* p_toggleWireframe = new Checkbox("togWireframe", Vector2(0, 10)); p_toggleWireframe->attachChild(new Label("wfLabel", "Wireframe", 9, labelOffset)); Checkbox* p_toggleLighting = new Checkbox("togLighting", Vector2(0, 70)); p_toggleLighting->attachChild(new Label("lightLabel", "Lighting", 9, labelOffset)); p_toggleLighting->setTicked(true); p_toggleClockwise = new Checkbox("togClockwise", Vector2(0, 100)); p_toggleClockwise->attachChild(new Label("togClockLabel", "Draw clockwise", 9, labelOffset)); p_toggleClockwise->setTicked(true); Checkbox* p_toggleCulling = new Checkbox("togCulling", Vector2(0, 130)); p_toggleCulling->attachChild(new Label("cullLabel", "Back-face culling", 9, labelOffset)); p_toggleCulling->setTicked(true); optionsContainer->attachChild(p_toggleSpinning); optionsContainer->attachChild(p_toggleWireframe); optionsContainer->attachChild(p_toggleLighting); optionsContainer->attachChild(p_toggleClockwise); optionsContainer->attachChild(p_toggleCulling); attachChild(optionsContainer); }