コード例 #1
0
ファイル: GuiPane.cpp プロジェクト: A7med-Shoukry/g3d
void GuiPane::pack() {
    // Resize to minimum bounds
    setSize(m_rect.wh() - m_clientRect.wh());
    for (int i = 0; i < containerArray.size(); ++i) {
        GuiPane* p = dynamic_cast<GuiPane*>(containerArray[i]);
        if (p != NULL) {
            p->pack();
        }
    }
    increaseBounds(contentsExtent());
}
コード例 #2
0
    SaveDialog(std::string& saveName, GuiSkinRef skin) : 
        GuiWindow("Save Path As", skin, Rect2D::xywh(100, 100, 10, 10), DIALOG_FRAME_STYLE, HIDE_ON_CLOSE), 
        ok(false), saveName(saveName) {
        GuiPane* rootPane = pane();

        textBox = rootPane->addTextBox("Filename", &saveName, GuiTextBox::IMMEDIATE_UPDATE);
        textBox->setSize(textBox->rect().wh() + Vector2(20, 0));
        textBox->setFocused(true);

        cancelButton = rootPane->addButton("Cancel");
        okButton = rootPane->addButton("Ok");
        okButton->moveRightOf(cancelButton);

        okButton->setEnabled(trimWhitespace(saveName) != "");

        pack();
    }
コード例 #3
0
ファイル: App.cpp プロジェクト: Mx7f/substep
void App::makeGUI() {
    // Initialize the developer HUD (using the existing scene)
    createDeveloperHUD();
    debugWindow->setVisible(false);
    developerWindow->videoRecordDialog->setVisible(false);
    developerWindow->cameraControlWindow->setVisible(false);
    developerWindow->sceneEditorWindow->setVisible(false);
    developerWindow->setVisible(false);
    showRenderingStats = false;
    
    GuiPane* infoPane = debugPane->addPane("Info", GuiTheme::ORNATE_PANE_STYLE);
    infoPane->beginRow(); {
        infoPane->addButton("Pause", [this]() { m_automata.setPaused(!m_automata.paused()); });
        infoPane->addNumberBox("BPM", &m_automata.m_bpm, "", GuiTheme::LINEAR_SLIDER, 30, 300);
        infoPane->addEnumClassRadioButtons("Display Mode", &m_automata.m_displayMode);
    } infoPane->endRow();
    // Example of how to add debugging controls
    infoPane->pack();

    // More examples of debugging GUI controls:
    // debugPane->addCheckBox("Use explicit checking", &explicitCheck);
    // debugPane->addTextBox("Name", &myName);
    // debugPane->addNumberBox("height", &height, "m", GuiTheme::LINEAR_SLIDER, 1.0f, 2.5f);
    // button = debugPane->addButton("Run Simulator");

    debugWindow->pack();
    debugWindow->setRect(Rect2D::xywh(0, 0, (float)window()->width(), debugWindow->rect().height()));
}
コード例 #4
0
ファイル: App.cpp プロジェクト: quirozmd/ASR-PathTracer
void App::makeGUI() {
    shared_ptr<GuiWindow> window = GuiWindow::create("Controls", debugWindow->theme(), Rect2D::xywh(0,0,0,0), GuiTheme::TOOL_WINDOW_STYLE);
    GuiPane* pane = window->pane();
    
	//pane->addButton("Restart", this, &App::onReset);
	//if (m_debugMode){
		pane->addButton("Filter", this, &App::onFilter);
		pane->addButton("SURE-Optimization", this, &App::onOptimize);
		pane->addButton("More samples", this, &App::onAddSamples);
	//}
	m_sampleCountPtrString = Pointer<String>(&m_sampleCountString);
	pane->addTextBox("Samples: ",m_sampleCountPtrString,G3D::GuiTextBox::DELAYED_UPDATE,G3D::GuiTheme::NO_BACKGROUND_UNLESS_FOCUSED_TEXT_BOX_STYLE );
    
    //pane->addNumberBox("Samples ppx", &m_samplesPerPixel, "", GuiTheme::LINEAR_SLIDER, 1, 5000, 1);
    //pane->addNumberBox("Max bounces", &m_maxBounces, "", GuiTheme::LINEAR_SLIDER, 1, 30, 1);

	window->pack();
    window->setVisible(true);
    addWidget(window);

	debugPane->moveBy(200, 10);
    debugPane->setCaption(GuiText("\t\t Mean\t\t\t\t\t Variance", GFont::fromFile(System::findDataFile("arial.fnt")), 16));
	
	debugPane->setVisible(true);
	debugPane->beginRow();
	GuiTabPane* tabPane = dynamic_cast<GuiTabPane*>(makeFeaturePane(debugPane,MEAN));
	tabPane->pack();

	GuiTabPane* tabPane2 = dynamic_cast<GuiTabPane*>(makeFeaturePane(debugPane,VAR));
	tabPane2->pack();
	tabPane2->moveRightOf(tabPane,50);
	debugPane->endRow();

	debugPane->pack();   

	char numStr[20];
	sprintf(numStr,"%d",m_sampleCount);
	m_sampleCountPtrString.setValue(String(numStr));	

	
}
コード例 #5
0
ファイル: GuiPane.cpp プロジェクト: A7med-Shoukry/g3d
GuiPane* GuiPane::addPane(const GuiText& text, GuiTheme::PaneStyle style) {
    Rect2D minRect = theme()->clientToPaneBounds(Rect2D::xywh(0,0,0,0), text, style);

    Vector2 pos = nextControlPos();

    // Back up by the border size
    pos -= minRect.x0y0();

    // Ensure the width isn't negative due to a very small m_clientRect
    // which would push the position off the parent panel
    float newRectWidth = max(m_clientRect.width() - pos.x * 2, 0.0f);

    Rect2D newRect = Rect2D::xywh(pos, Vector2(newRectWidth, minRect.height()));

    GuiPane* p = new GuiPane(this, text, newRect, style);

    containerArray.append(p);
    increaseBounds(p->rect().x1y1());

    return p;
}
コード例 #6
0
TextureBrowserWindow::TextureBrowserWindow
   (const shared_ptr<GuiTheme>&           skin) : 
    GuiWindow("Texture Browser", 
              skin, 
              Rect2D::xywh(5, 54, 200, 0),
              GuiTheme::NORMAL_WINDOW_STYLE,
              GuiWindow::REMOVE_ON_CLOSE),
    m_textureList(NULL), m_textureBox(NULL) {

    GuiPane* pane = GuiWindow::pane();
    
    refreshTextureList();

    m_textureIndex = 0;

    pane->beginRow(); {
        m_textureList = pane->addDropDownList("", m_textureNames, &m_textureIndex, GuiControl::Callback(this, &TextureBrowserWindow::textureDropDownCallback));
        pane->addButton("Refresh", this, &TextureBrowserWindow::updateDropDown);
    } pane->endRow();
    
    m_textureBox = pane->addTextureBox();
    m_textureBox->setSizeFromInterior(Vector2(sBrowserWidth, sBrowserWidth/2));

    textureDropDownCallback();

    pack();
}
コード例 #7
0
ファイル: App.cpp プロジェクト: tylerwolverton/CS-334
void App::makeGUI() {
    shared_ptr<GuiWindow> window = GuiWindow::create("Controls", debugWindow->theme(), Rect2D::xywh(0,0,0,0), GuiTheme::TOOL_WINDOW_STYLE);
    GuiPane* pane = window->pane();
    pane->addLabel("Use WASD keys + right mouse to move");
    pane->addButton("Render High Res.", this, &App::onRender);
    
    pane->addNumberBox("Rays per pixel", &m_raysPerPixel, "", GuiTheme::LINEAR_SLIDER, 1, 30, 1);
    pane->addNumberBox("Max bounces", &m_maxBounces, "", GuiTheme::LINEAR_SLIDER, 1, 16, 1);
	pane->addSlider("Fogginess", &m_fogginess, 0.0f, .1f);
	pane->addNumberBox("Aperture", &m_aperture, "", GuiTheme::LINEAR_SLIDER, 0, 100, 1);
	pane->addNumberBox("Focal Length", &m_focalLength, "", GuiTheme::LINEAR_SLIDER, 0, 100, 1);
    window->pack();

    window->setVisible(true);
    addWidget(window);
}
コード例 #8
0
ファイル: GuiTabPane.cpp プロジェクト: luaman/g3d-cvs
GuiPane* GuiTabPane::addTab(const GuiText& label, int id) {
    if (id == -1) {
        id = m_contentPaneArray.size();
    }

    debugAssertM(! m_contentIDArray.contains(id), format("id %d already in use", id));

    GuiPane* p = m_viewPane->addPane("", GuiTheme::NO_PANE_STYLE);
    p->setPosition(Vector2(0,0));
    m_viewPane->pack();
    GuiRadioButton* b = m_tabButtonPane->addRadioButton(label, id, m_indexPtr, GuiTheme::TOOL_RADIO_BUTTON_STYLE);
    (void)b;

    m_contentIDArray.append(id);
    m_contentPaneArray.append(p);
    p->setVisible(*m_indexPtr == id);

    m_tabButtonPane->pack();

    // TODO: adjust layout?

    return p;
}
コード例 #9
0
ファイル: App.cpp プロジェクト: jackpoz/G3D-backup
void App::onInit() {
    createDeveloperHUD();
	renderDevice->setSwapBuffersAutomatically(true);
    renderDevice->setColorClearValue(Color3::white());
    debugWindow->setVisible(false);
    developerWindow->cameraControlWindow->setVisible(true);
    developerWindow->cameraControlWindow->moveTo(Vector2(developerWindow->cameraControlWindow->rect().x0(), 0));
    developerWindow->setVisible(false);
    showRenderingStats = false;
    
    m_debugCamera->setFrame(CFrame::fromXYZYPRDegrees(-0.61369f, 0.734589f, 0.934322f, 314.163f, -12.1352f));
    m_debugCamera->filmSettings().setVignetteBottomStrength(0);
    m_debugCamera->filmSettings().setVignetteTopStrength(0);

    m_scene = BuildingScene::create();

    m_debugCamera->filmSettings().setAntialiasingEnabled(false);
    
    shared_ptr<GuiTheme> theme = debugWindow->theme();

    // Example of how to create windows
    shared_ptr<GuiWindow> toolBar = GuiWindow::create("Tools", theme, Rect2D::xywh(0,0,0,0), GuiTheme::TOOL_WINDOW_STYLE);

    shared_ptr<IconSet> icons = IconSet::fromFile(System::findDataFile("tango.icn"));
    GuiPane* toolPane = toolBar->pane();

    toolPane->addButton(icons->get("22x22/uwe/CreateCylinder.png"), GuiTheme::TOOL_BUTTON_STYLE);
    toolPane->addButton(icons->get("22x22/uwe/CreateBox.png"), GuiTheme::TOOL_BUTTON_STYLE);
    toolPane->addButton(icons->get("22x22/uwe/Emitter.png"), GuiTheme::TOOL_BUTTON_STYLE);
    toolPane->addButton(icons->get("22x22/uwe/PointLight.png"), GuiTheme::TOOL_BUTTON_STYLE)->moveBy(Vector2(10,0));
    toolPane->addButton(icons->get("22x22/categories/applications-multimedia.png"), GuiTheme::TOOL_BUTTON_STYLE);
    toolPane->addButton(icons->get("22x22/categories/applications-graphics.png"), GuiTheme::TOOL_BUTTON_STYLE);
    toolPane->addButton(icons->get("22x22/categories/applications-system.png"), GuiTheme::TOOL_BUTTON_STYLE);
    toolBar->pack();
    addWidget(toolBar);
}
コード例 #10
0
ファイル: App.cpp プロジェクト: jackpoz/G3D-backup
void App::makeGUI() {
    // Initialize the developer HUD (using the existing scene)
    createDeveloperHUD();
    debugWindow->setVisible(true);
    developerWindow->videoRecordDialog->setEnabled(true);

    GuiPane* infoPane = debugPane->addPane("Info", GuiTheme::ORNATE_PANE_STYLE);
    infoPane->addCheckBox("Show wireframe", &m_showWireframe);

    // Example of how to add debugging controls
    infoPane->addLabel("You can add more GUI controls");
    infoPane->addLabel("in App::onInit().");
    infoPane->addButton("Exit", this, &App::endProgram);
    infoPane->pack();

    // More examples of debugging GUI controls:
    // debugPane->addCheckBox("Use explicit checking", &explicitCheck);
    // debugPane->addTextBox("Name", &myName);
    // debugPane->addNumberBox("height", &height, "m", GuiTheme::LINEAR_SLIDER, 1.0f, 2.5f);
    // button = debugPane->addButton("Run Simulator");

    debugWindow->pack();
    debugWindow->setRect(Rect2D::xywh(0, 0, (float)window()->width(), debugWindow->rect().height()));
}
コード例 #11
0
PhysicsFrameSplineEditor::PhysicsFrameSplineEditor(const GuiText& caption, GuiPane* dockPane, shared_ptr<GuiTheme> theme) : 
    GuiWindow(caption,
              theme,
              Rect2D::xywh(0,0,100,40), 
              GuiTheme::TOOL_WINDOW_STYLE,
              GuiWindow::HIDE_ON_CLOSE),
    m_selectedControlPointIndex(0),
    m_isDocked(dockPane != NULL)
    {

    m_cachedPhysicsFrameString = CFrame(m_cachedPhysicsFrameValue).toAny().unparse();
    m_spline.append(CFrame());

    m_surface.reset(new SplineSurface(this));
    m_nodeManipulator = ThirdPersonManipulator::create();
    m_nodeManipulator->setEnabled(false);

    GuiPane* p = dockPane;

    if (p == NULL) {
        // Place into the window
        p = pane();
    } else {
        // No need to show the window
        setVisible(false);
    }
    
    GuiPane* cpPane = p->addPane("Control Point", GuiTheme::ORNATE_PANE_STYLE);
    cpPane->moveBy(0, -15);

    Array<std::string> indexList;
    getIndexRange(1, indexList);
    m_selectedControlPointDropDown = cpPane->addDropDownList("Control point: ", indexList, &m_selectedControlPointIndex, 
                                        GuiControl::Callback(this, &PhysicsFrameSplineEditor::controlPointDropDownCallback));
    cpPane->addNumberBox("Time", Pointer<float>(this, &PhysicsFrameSplineEditor::selectedNodeTime, &PhysicsFrameSplineEditor::setSelectedNodeTime), "s");
    cpPane->addTextBox("", Pointer<std::string>(this, &PhysicsFrameSplineEditor::selectedNodePFrameAsString, &PhysicsFrameSplineEditor::setSelectedNodePFrameFromString));

    cpPane->beginRow(); {
        GuiButton* b = cpPane->addButton("Add new", this, &PhysicsFrameSplineEditor::addControlPoint);
        b->moveBy(-2, -7);
        m_removeSelectedButton = cpPane->addButton("Remove", this, &PhysicsFrameSplineEditor::removeSelectedControlPoint);
    } cpPane->endRow();
    cpPane->pack();
    GuiPane* exPane = p->addPane("Extrapolation Mode", GuiTheme::NO_PANE_STYLE);
    exPane->beginRow(); {
        GuiControl* linearButton  = exPane->addRadioButton("Linear", SplineExtrapolationMode::LINEAR, this, 
                                        &PhysicsFrameSplineEditor::extrapolationMode, &PhysicsFrameSplineEditor::setExtrapolationMode);
        GuiControl* clampedButton = exPane->addRadioButton("Clamped", SplineExtrapolationMode::CLAMP, this, 
                                        &PhysicsFrameSplineEditor::extrapolationMode, &PhysicsFrameSplineEditor::setExtrapolationMode);
        clampedButton->moveRightOf(linearButton);
        clampedButton->moveBy(-145, 0);
        GuiControl* cyclicButton  = exPane->addRadioButton("Cyclic", SplineExtrapolationMode::CYCLIC, this, 
                                        &PhysicsFrameSplineEditor::extrapolationMode, &PhysicsFrameSplineEditor::setExtrapolationMode);
        cyclicButton->moveRightOf(clampedButton);
        cyclicButton->moveBy(-140, 0);
    } exPane->endRow();
    exPane->pack();
    GuiPane* inPane = p->addPane("Interpolation Mode", GuiTheme::NO_PANE_STYLE);
    inPane->beginRow(); {
        GuiControl* linearButton = inPane->addRadioButton("Linear", SplineInterpolationMode::LINEAR, this, 
                                       &PhysicsFrameSplineEditor::interpolationMode, &PhysicsFrameSplineEditor::setInterpolationMode);
        GuiControl* cubicButton  = inPane->addRadioButton("Cubic", SplineInterpolationMode::CUBIC, this, 
                                       &PhysicsFrameSplineEditor::interpolationMode, &PhysicsFrameSplineEditor::setInterpolationMode); 
        cubicButton->moveRightOf(linearButton);
        cubicButton->moveBy(-145, 0);
    } inPane->endRow();
    inPane->pack();
    GuiPane* finalIntervalPane = p->addPane("Final Interval", GuiTheme::NO_PANE_STYLE);
    finalIntervalPane->moveRightOf(exPane);
    finalIntervalPane->moveBy(-100, -5);
    static int m_explicitFinalInterval = 0;
    m_finalIntervalChoice[0] = finalIntervalPane->addRadioButton("automatic", 0, &m_explicitFinalInterval);
    finalIntervalPane->beginRow(); {
        m_finalIntervalChoice[1] = finalIntervalPane->addRadioButton("", 1, &m_explicitFinalInterval);
        m_finalIntervalBox = finalIntervalPane->addNumberBox("", &m_spline.finalInterval, "s", GuiTheme::NO_SLIDER, -1.0f, 10000.0f, 0.001f);
        m_finalIntervalBox->setWidth(76);
        m_finalIntervalBox->moveBy(-2, 0);
    } finalIntervalPane->endRow();
    pack();

    setEnabled(false);
}
コード例 #12
0
PhysicsFrameSplineEditor::PhysicsFrameSplineEditor(const GuiText& caption, GuiPane* dockPane, GuiTheme::Ref theme) : 
    GuiWindow(caption,
              theme,
              Rect2D::xywh(0,0,100,40), 
              GuiTheme::TOOL_WINDOW_STYLE,
              GuiWindow::HIDE_ON_CLOSE),
    m_selectedControlPointIndex(0),
    m_isDocked(dockPane != NULL) {

    m_cachedPhysicsFrameString = CFrame(m_cachedPhysicsFrameValue).toAny().unparse();
    m_spline.append(CFrame());

    m_surface = new SplineSurface(this);
    m_nodeManipulator = ThirdPersonManipulator::create();
    m_nodeManipulator->setEnabled(false);

    GuiPane* p = dockPane;

    if (p == NULL) {
        // Place into the window
        p = pane();
    } else {
        // No need to show the window
        setVisible(false);
    }
    
    GuiPane* cpPane = p->addPane("Control Point", GuiTheme::ORNATE_PANE_STYLE);
    cpPane->moveBy(0, -15);

    if (false) {
        static float x,y,z;
        //static const float translationControlWidth = 80;
        static const float rotationControlWidth    = 40;
        //static const float captionWidth = 10;
        static const float rotationPrecision = 0.1;
        //static const float translationPrecision = 0.001;
        static const std::string degrees = "\xba";
        cpPane->beginRow(); {
            GuiNumberBox<float>* c = NULL;
            static std::string s = "100.0, 100.0, 100.0";

            GuiControl* t = cpPane->addTextBox("xyz (", &s);
            t->setWidth(155);
            t->setCaptionWidth(26);
            cpPane->addLabel(") m");

            c = cpPane->addNumberBox("", &x, degrees, GuiTheme::NO_SLIDER, -finf(), finf(), rotationPrecision); 
            c->moveBy(20, 0);
            c->setCaptionWidth(0); c->setWidth(rotationControlWidth); c->setUnitsSize(8);

            c = cpPane->addNumberBox("", &y, degrees, GuiTheme::NO_SLIDER, -finf(), finf(), rotationPrecision); 
            c->setCaptionWidth(0); c->setWidth(rotationControlWidth); c->setUnitsSize(8);

            c = cpPane->addNumberBox("", &z, degrees, GuiTheme::NO_SLIDER, -finf(), finf(), rotationPrecision); 
            c->setCaptionWidth(0); c->setWidth(rotationControlWidth); c->setUnitsSize(8);
        } cpPane->endRow();
    }

    cpPane->addLabel("Control point: 0");
    cpPane->addNumberBox("Time", Pointer<float>(this, &PhysicsFrameSplineEditor::selectedNodeTime, &PhysicsFrameSplineEditor::setSelectedNodeTime), "s");
    cpPane->addTextBox("", Pointer<std::string>(this, &PhysicsFrameSplineEditor::selectedNodePFrameAsString, &PhysicsFrameSplineEditor::setSelectedNodePFrameFromString));

    cpPane->beginRow(); {
        GuiButton* b = cpPane->addButton("Add new", this, &PhysicsFrameSplineEditor::addControlPoint);
        b->moveBy(-2, -7);
        m_removeSelectedButton = cpPane->addButton("Remove", this, &PhysicsFrameSplineEditor::removeSelectedControlPoint);
    } cpPane->endRow();
    cpPane->pack();

    GuiControl* prev = p->addCheckBox("Loop with final interval", Pointer<bool>(this, &PhysicsFrameSplineEditor::cyclic, &PhysicsFrameSplineEditor::setCyclic));

    GuiPane* finalIntervalPane = p->addPane("", GuiTheme::NO_PANE_STYLE);
    finalIntervalPane->moveRightOf(prev);
    finalIntervalPane->moveBy(-1, -5);
    static int m_explicitFinalInterval = 0;
    m_finalIntervalChoice[0] = finalIntervalPane->addRadioButton("automatic", 0, &m_explicitFinalInterval);
    finalIntervalPane->beginRow(); {
        m_finalIntervalChoice[1] = finalIntervalPane->addRadioButton("", 1, &m_explicitFinalInterval);
        m_finalIntervalBox = finalIntervalPane->addNumberBox("", &m_spline.finalInterval, "s", GuiTheme::NO_SLIDER, -1.0f, 10000.0f, 0.001f);
        m_finalIntervalBox->setWidth(76);
        m_finalIntervalBox->moveBy(-2, 0);
    } finalIntervalPane->endRow();

    pack();

    setEnabled(false);
}
コード例 #13
0
void VideoRecordDialog::makeGUI() {
    pane()->addCheckBox("Record GUI (Surface2D)", &m_captureGUI);

    pane()->addLabel(GuiText("Video", shared_ptr<GFont>(), 12));
    GuiPane* moviePane = pane()->addPane("", GuiTheme::ORNATE_PANE_STYLE);

    GuiLabel* label = NULL;
    GuiDropDownList* formatList = moviePane->addDropDownList("Format", m_formatList, &m_templateIndex);

    const float width = 300.0f;
    // Increase caption size to line up with the motion blur box
    const float captionSize = 90.0f;

    formatList->setWidth(width);
    formatList->setCaptionWidth(captionSize);

    moviePane->addNumberBox("Quality", &m_quality, "", GuiTheme::LOG_SLIDER, 0.1f, 25.0f);
    
    if (false) {
        // For future expansion
        GuiCheckBox*  motionCheck = moviePane->addCheckBox("Motion Blur",  &m_enableMotionBlur);
        m_framesBox = moviePane->addNumberBox("", &m_motionBlurFrames, "frames", GuiTheme::LINEAR_SLIDER, 2, 20);
        m_framesBox->setUnitsSize(46);
        m_framesBox->moveRightOf(motionCheck);
        m_framesBox->setWidth(210);
    }

    GuiNumberBox<float>* recordBox   = moviePane->addNumberBox("Record as if",      &m_recordFPS, "fps", GuiTheme::NO_SLIDER, 1.0f, 120.0f, 0.1f);
    recordBox->setCaptionWidth(captionSize);

    GuiNumberBox<float>* playbackBox = moviePane->addNumberBox("Playback at",    &m_playbackFPS, "fps", GuiTheme::NO_SLIDER, 1.0f, 120.0f, 0.1f);
    playbackBox->setCaptionWidth(captionSize);

    const OSWindow* window = OSWindow::current();
    int w = window->width() / 2;
    int h = window->height() / 2;
    moviePane->addCheckBox(format("Half-size (%d x %d)", w, h), &m_halfSize);

    if (false) {
        // For future expansion
        moviePane->addCheckBox("Show cursor", &m_showCursor);
    }

    label = moviePane->addLabel("Hot key:");
    label->setWidth(captionSize);
    moviePane->addLabel(m_hotKeyString)->moveRightOf(label);

    // Add record on the same line as previous hotkey box
    m_recordButton = moviePane->addButton("Record Now (" + m_hotKeyString + ")");
    m_recordButton->moveBy(moviePane->rect().width() - m_recordButton->rect().width() - 5, -27);
    moviePane->pack();
    moviePane->setWidth(pane()->rect().width());

    ///////////////////////////////////////////////////////////////////////////////////
    pane()->addLabel(GuiText("Screenshot", shared_ptr<GFont>(), 12));
    GuiPane* ssPane = pane()->addPane("", GuiTheme::ORNATE_PANE_STYLE);

    m_ssFormatList.append("JPG", "PNG", "BMP", "TGA");
    GuiDropDownList* ssFormatList = ssPane->addDropDownList("Format", m_ssFormatList, &m_ssFormatIndex);
    m_ssFormatIndex = 0;

    ssFormatList->setWidth(width);
    ssFormatList->setCaptionWidth(captionSize);

    label = ssPane->addLabel("Hot key:");
    label->setWidth(captionSize);
    ssPane->addLabel(m_ssHotKeyString)->moveRightOf(label);

    ssPane->pack();
    ssPane->setWidth(pane()->rect().width());

    ///////////////////////////////////////////////////////////////////////////////////

    pack();
    setRect(Rect2D::xywh(rect().x0(), rect().y0(), rect().width() + 5, rect().height() + 2));
}
コード例 #14
0
ファイル: GUIViewer.cpp プロジェクト: A7med-Shoukry/g3d
void GUIViewer::createGui(const std::string& filename) {
    GuiPane*			pane;
    
    skin = GuiTheme::fromFile(filename, parentApp->debugFont);
    
    window         = GuiWindow::create("Normal", skin, Rect2D::xywh(50,50,0,0),   
                                       GuiTheme::NORMAL_WINDOW_STYLE, GuiWindow::IGNORE_CLOSE);
    toolWindow     = GuiWindow::create("Tool",   skin, Rect2D::xywh(300,100,0,0), 
                                       GuiTheme::TOOL_WINDOW_STYLE,   GuiWindow::IGNORE_CLOSE);
    bgControl      = GuiWindow::create("Dialog", skin, Rect2D::xywh(550,100,0,0), 
                                       GuiTheme::DIALOG_WINDOW_STYLE, GuiWindow::IGNORE_CLOSE);
    dropdownWindow = GuiWindow::create("Normal", skin, Rect2D::xywh(400,400,0,0), 
                                       GuiTheme::NORMAL_WINDOW_STYLE, GuiWindow::IGNORE_CLOSE);

    text = "Hello";

    pane = window->pane();
    slider[0] = 1.5f;
    slider[1] = 1.8f;

    {
        GuiPane* p = pane->addPane("Pane (NO_PANE_STYLE)", GuiTheme::NO_PANE_STYLE);
        p->addSlider("Slider", &slider[0], 1.0f, 2.2f);
        p->addSlider("Slider Disabled", &slider[1], 1.0f, 2.2f)->setEnabled(false);
    }
    {
        GuiPane* p = pane->addPane("Pane (SIMPLE_PANE_STYLE)", GuiTheme::SIMPLE_PANE_STYLE);
        p->addLabel("RadioButton (RADIO_STYLE)");
        p->addRadioButton("Sel, Dis", 1, &radio[0])->setEnabled(false);
        p->addRadioButton("Desel, Dis", 2, &radio[0])->setEnabled(false);
        p->addRadioButton("Sel, Enabled", 3, &radio[1]);
        p->addRadioButton("Desel, Disabled", 4, &radio[1]);
    }

    {
        GuiPane* p = pane->addPane("Pane (SIMPLE_PANE_STYLE)", GuiTheme::SIMPLE_PANE_STYLE);
        p->addLabel("RadioButton (BUTTON_STYLE)");
        p->addRadioButton("Selected, Disabled", 5, &radio[2], GuiTheme::BUTTON_RADIO_BUTTON_STYLE)->setEnabled(false);
        p->addRadioButton("Deselected, Disabled", 6, &radio[2], GuiTheme::BUTTON_RADIO_BUTTON_STYLE)->setEnabled(false);
        p->addRadioButton("Selected, Enabled", 7, &radio[3], GuiTheme::BUTTON_RADIO_BUTTON_STYLE);
        p->addRadioButton("Deselected, Disabled", 8, &radio[3], GuiTheme::BUTTON_RADIO_BUTTON_STYLE);
        p->addButton("Button");
    }

    pane = toolWindow->pane();
    {
        GuiPane* p = pane->addPane("Pane (ORNATE_PANE_STYLE)", GuiTheme::ORNATE_PANE_STYLE);
        p->addLabel("CheckBox (NORMAL_CHECK_BOX_SYLE)");
        checkbox[0] = true;
        checkbox[1] = false;
        checkbox[2] = true;
        checkbox[3] = false;
        p->addCheckBox("Selected, Enabled", &checkbox[0]);
        p->addCheckBox("Deselected, Enabled", &checkbox[1]);
        p->addCheckBox("Selected, Disabled", &checkbox[2])->setEnabled(false);
        p->addCheckBox("Deselected, Disabled", &checkbox[3])->setEnabled(false);
    }

    {
        GuiPane* p = pane->addPane("", GuiTheme::SIMPLE_PANE_STYLE);
        p->addLabel("CheckBox (BUTTON_CHECK_BOX_STYLE)");
        checkbox[4] = true;
        checkbox[5] = false;
        checkbox[6] = true;
        checkbox[7] = false;
        p->addCheckBox("Selected, Disabled", &checkbox[4], GuiTheme::BUTTON_CHECK_BOX_STYLE)->setEnabled(false);
        p->addCheckBox("Deselected, Disabled", &checkbox[5], GuiTheme::BUTTON_CHECK_BOX_STYLE)->setEnabled(false);
        p->addCheckBox("Selected, Enabled", &checkbox[6], GuiTheme::BUTTON_CHECK_BOX_STYLE);
        p->addCheckBox("Deselected, Enabled", &checkbox[7], GuiTheme::BUTTON_CHECK_BOX_STYLE);
        p->addButton("Disabled")->setEnabled(false);
    }

    pane = dropdownWindow->pane();
    pane->addButton("Tool", GuiTheme::TOOL_BUTTON_STYLE);
    GuiButton* t2 = pane->addButton("Tool", GuiTheme::TOOL_BUTTON_STYLE);
    t2->setEnabled(false);
    static bool check = false;
    pane->addCheckBox("Check", &check, GuiTheme::TOOL_CHECK_BOX_STYLE);

    dropdownIndex[0] = 0;
    dropdownIndex[1] = 0;
    dropdown.append("Option 1");
    dropdown.append("Option 2");
    dropdown.append("Option 3");
    dropdownDisabled.append("Disabled");
    pane->addLabel("Dropdown List");
    pane->addDropDownList(GuiText("Enabled"), dropdown, &dropdownIndex[0]);
    pane->addDropDownList(GuiText("Disabled"), dropdownDisabled, &dropdownIndex[1])->setEnabled(false);
    pane->addTextBox("TextBox", &text);
    pane->addTextBox("Disabled", &text)->setEnabled(false);

    pane = bgControl->pane();
    windowControl = BGIMAGE2;
    pane->addLabel("Background Color");
    pane->addRadioButton(GuiText("White"), WHITE, &windowControl);
    pane->addRadioButton(GuiText("Blue"), BLUE, &windowControl);
    pane->addRadioButton(GuiText("Black"), BLACK, &windowControl);
    pane->addRadioButton(GuiText("background1.jpg"), BGIMAGE1, &windowControl)->setEnabled(background1.notNull());
    pane->addRadioButton(GuiText("background2.jpg"), BGIMAGE2, &windowControl)->setEnabled(background2.notNull());

    // Gets rid of any empty, unused space in the windows
    window->pack();
    toolWindow->pack();
    bgControl->pack();
    dropdownWindow->pack();

    parentApp->addWidget(window);
    parentApp->addWidget(toolWindow);
    parentApp->addWidget(bgControl);
    parentApp->addWidget(dropdownWindow);
}
コード例 #15
0
DeveloperWindow::DeveloperWindow
(GApp*                                      app,
 const shared_ptr<FirstPersonManipulator>&   manualManipulator,
 const shared_ptr<UprightSplineManipulator>& trackManipulator,
 const Pointer< shared_ptr<Manipulator> >&   cameraManipulator,
 const shared_ptr<Camera>&                  debugCamera,
 const shared_ptr<Scene>&                   scene,
 const shared_ptr<Film>&                    film,
 const shared_ptr<GuiTheme>&                theme,
 const shared_ptr<GConsole>&                console,
 const Pointer<bool>&                       debugVisible,
 bool*                                      showStats,
 bool*                                      showText,
 const std::string&                         screenshotPrefix) :
    GuiWindow("Developer (F11)", theme, Rect2D::xywh(600, 80, 0, 0), GuiTheme::TOOL_WINDOW_STYLE, HIDE_ON_CLOSE), consoleWindow(console) {

    alwaysAssertM(this != NULL, "Memory corruption");
    alwaysAssertM(notNull(debugCamera), "NULL camera");

    cameraControlWindow = CameraControlWindow::create(manualManipulator, trackManipulator, cameraManipulator,
                          debugCamera, film, theme);

    cameraControlWindow->moveTo(Point2(app->window()->width() - cameraControlWindow->rect().width(), 0));

    videoRecordDialog = VideoRecordDialog::create(theme, screenshotPrefix, app);

    profilerWindow = ProfilerWindow::create(theme);
    app->addWidget(profilerWindow);
    profilerWindow->setVisible(false);

    if (notNull(scene)) {
        sceneEditorWindow = SceneEditorWindow::create(app, scene, theme);
        sceneEditorWindow->moveTo(cameraControlWindow->rect().x0y1() + Vector2(0, 15));
    }

    // For texture windows
    m_app      = app;
    m_theme    = theme;

    GuiPane* root = pane();

    const float iconSize = 32;
    Vector2 buttonSize(iconSize, iconSize);

    shared_ptr<IconSet> iconSet = IconSet::fromFile(System::findDataFile("icon/tango.icn"));
    GuiText cameraIcon(iconSet->get("22x22/devices/camera-photo.png"));
    GuiText movieIcon(iconSet->get("22x22/categories/applications-multimedia.png"));
    GuiText consoleIcon(iconSet->get("22x22/apps/utilities-terminal.png"));
    GuiText statsIcon(iconSet->get("22x22/apps/utilities-system-monitor.png"));
    GuiText debugIcon(iconSet->get("22x22/categories/preferences-desktop.png"));
    GuiText sceneIcon(iconSet->get("22x22/categories/preferences-system.png"));
    GuiText textIcon(iconSet->get("22x22/mimetypes/text-x-generic.png"));
    GuiText textureBrowserIcon(iconSet->get("22x22/actions/window-new.png"));
    GuiText profilerIcon(iconSet->get("22x22/actions/appointment-new.png"));

    Pointer<bool> ptr = Pointer<bool>((shared_ptr<GuiWindow>)cameraControlWindow, &GuiWindow::visible, &GuiWindow::setVisible);
    GuiControl* cameraButton = root->addCheckBox(cameraIcon, ptr, GuiTheme::TOOL_CHECK_BOX_STYLE);
    cameraButton->setSize(buttonSize);
    cameraButton->setPosition(0, 0);

    Pointer<bool> ptr2 = Pointer<bool>((shared_ptr<GuiWindow>)videoRecordDialog, &GuiWindow::visible, &GuiWindow::setVisible);
    GuiControl* movieButton = root->addCheckBox(movieIcon, ptr2, GuiTheme::TOOL_CHECK_BOX_STYLE);
    movieButton->setSize(buttonSize);

    static bool ignore = false;
    if (notNull(scene)) {
        Pointer<bool> ptr3 = Pointer<bool>((shared_ptr<GuiWindow>)sceneEditorWindow, &GuiWindow::visible, &GuiWindow::setVisible);
        GuiControl* sceneButton = root->addCheckBox(sceneIcon, ptr3, GuiTheme::TOOL_CHECK_BOX_STYLE);
        sceneButton->setSize(buttonSize);
    } else {
        GuiControl* sceneButton = root->addCheckBox(sceneIcon, &ignore, GuiTheme::TOOL_CHECK_BOX_STYLE);
        sceneButton->setSize(buttonSize);
        sceneButton->setEnabled(false);
    }

    Pointer<bool> profilePtr = Pointer<bool>((shared_ptr<GuiWindow>)profilerWindow, &GuiWindow::visible, &GuiWindow::setVisible);
    GuiControl* profilerButton = root->addCheckBox(profilerIcon, profilePtr, GuiTheme::TOOL_CHECK_BOX_STYLE);
    profilerButton->setSize(buttonSize);

    GuiControl* textureBrowserButton = root->addButton(textureBrowserIcon, this, &DeveloperWindow::makeNewTexturePane, GuiTheme::TOOL_BUTTON_STYLE);
    textureBrowserButton->setSize(buttonSize);

    GuiControl* consoleButton = root->addCheckBox(consoleIcon, Pointer<bool>(consoleWindow, &GConsole::active, &GConsole::setActive), GuiTheme::TOOL_CHECK_BOX_STYLE);
    consoleButton->setSize(buttonSize);

    GuiControl* debugButton = root->addCheckBox(debugIcon, debugVisible, GuiTheme::TOOL_CHECK_BOX_STYLE);
    debugButton->setSize(buttonSize);

    GuiControl* statsButton = root->addCheckBox(statsIcon, showStats, GuiTheme::TOOL_CHECK_BOX_STYLE);
    statsButton->setSize(buttonSize);

    GuiControl* printButton = root->addCheckBox(textIcon, showText, GuiTheme::TOOL_CHECK_BOX_STYLE);
    printButton->setSize(buttonSize);

    cameraControlWindow->setVisible(true);
    videoRecordDialog->setVisible(false);
    pack();

}
コード例 #16
0
ファイル: main.cpp プロジェクト: jackpoz/G3D-backup
void App::makeGui() {
    const shared_ptr<GuiWindow>& gui = GuiWindow::create("Material Parameters");
    GuiPane* pane = gui->pane();

    pane->beginRow();
    pane->addSlider("Lambertian", &lambertianScalar, 0.0f, 1.0f);
    pane->addDropDownList("", colorList, &lambertianColorIndex)->setWidth(80);
    pane->endRow();

    pane->beginRow();
    pane->addSlider("Glossy",    &glossyScalar, 0.0f, 1.0f);
    pane->addDropDownList("", colorList, &glossyColorIndex)->setWidth(80);
    pane->endRow();
    
    pane->addSlider("Mirror",     &reflect, 0.0f, 1.0f);
    pane->addSlider("Smoothness", &smoothness, 0.0f, 1.0f);
    
    gui->pack();
    addWidget(gui);
    gui->moveTo(Point2(10, 10));
}
コード例 #17
0
ファイル: App.cpp プロジェクト: A7med-Shoukry/g3d
void App::makeGUI() {
    // Turn on the developer HUD
    debugWindow->setVisible(true);
    developerWindow->cameraControlWindow->setVisible(true);
    developerWindow->videoRecordDialog->setEnabled(true);


    GFont::Ref iconFont = GFont::fromFile(System::findDataFile("icon.fnt"));
    
    // Create a scene management GUI
    GuiPane* scenePane = debugPane->addPane("Scene", GuiTheme::ORNATE_PANE_STYLE);
    scenePane->moveBy(0, -10);
    scenePane->beginRow(); {
        // Example of using a callback; you can also listen for events in onEvent or bind controls to data
        m_sceneDropDownList = scenePane->addDropDownList("", Scene::sceneNames(), NULL, GuiControl::Callback(this, &App::loadScene));

        static const char* reloadIcon = "q";
        static const char* diskIcon = "\xcd";

        scenePane->addButton(GuiText(reloadIcon, iconFont, 14), this, &App::loadScene, GuiTheme::TOOL_BUTTON_STYLE)->setWidth(32);
        scenePane->addButton(GuiText(diskIcon, iconFont, 18), this, &App::saveScene, GuiTheme::TOOL_BUTTON_STYLE)->setWidth(32);
    } scenePane->endRow();

    const int w = 120;
    scenePane->beginRow(); {
        scenePane->addCheckBox("Axes", &m_showAxes)->setWidth(w);
        scenePane->addCheckBox("Light sources", &m_showLightSources);
    } scenePane->endRow();
    scenePane->beginRow(); {
        scenePane->addCheckBox("Wireframe", &m_showWireframe)->setWidth(w);
    } scenePane->endRow();
    static const char* lockIcon = "\xcf";
    scenePane->addCheckBox(GuiText(lockIcon, iconFont, 20), &m_preventEntityDrag, GuiTheme::TOOL_CHECK_BOX_STYLE);
    scenePane->pack();

    GuiPane* entityPane = debugPane->addPane("Entity", GuiTheme::ORNATE_PANE_STYLE);
    entityPane->moveRightOf(scenePane);
    entityPane->moveBy(10, 0);
    m_entityList = entityPane->addDropDownList("Name");

    // Dock the spline editor
    m_splineEditor = PhysicsFrameSplineEditor::create("Spline Editor", entityPane);
    addWidget(m_splineEditor);
    developerWindow->cameraControlWindow->moveTo(Point2(window()->width() - developerWindow->cameraControlWindow->rect().width(), 0));
    m_splineEditor->moveTo(developerWindow->cameraControlWindow->rect().x0y0() - Vector2(m_splineEditor->rect().width(), 0));
    entityPane->pack();

    GuiPane* infoPane = debugPane->addPane("Info", GuiTheme::ORNATE_PANE_STYLE);
    infoPane->moveRightOf(entityPane);
    infoPane->moveBy(10, 0);

    // Example of how to add debugging controls
    infoPane->addLabel("You can add more GUI controls");
    infoPane->addLabel("in App::onInit().");
    infoPane->addButton("Exit", this, &App::endProgram);
    infoPane->pack();

    // More examples of debugging GUI controls:
    // debugPane->addCheckBox("Use explicit checking", &explicitCheck);
    // debugPane->addTextBox("Name", &myName);
    // debugPane->addNumberBox("height", &height, "m", GuiTheme::LINEAR_SLIDER, 1.0f, 2.5f);
    // button = debugPane->addButton("Run Simulator");

    debugWindow->pack();
    debugWindow->setRect(Rect2D::xywh(0, 0, window()->width(), debugWindow->rect().height()));
}
コード例 #18
0
CameraControlWindow::CameraControlWindow(
    const FirstPersonManipulatorRef&      manualManipulator, 
    const UprightSplineManipulatorRef&    trackManipulator, 
    const Pointer<Manipulator::Ref>&      cameraManipulator,
    const GuiSkinRef&                     skin) : 
    GuiWindow("Camera Control", 
              skin, 
              Rect2D::xywh(5, 54, 200, 0),
              GuiWindow::TOOL_FRAME_STYLE,
              GuiWindow::HIDE_ON_CLOSE),
    trackFileIndex(0),
    cameraManipulator(cameraManipulator),
    manualManipulator(manualManipulator),
    trackManipulator(trackManipulator),
    drawerButton(NULL),
    drawerButtonPane(NULL),
    m_expanded(false)
    {

    manualOperation = manualManipulator->active();

    updateTrackFiles();

    GuiPane* pane = GuiWindow::pane();

    GFontRef iconFont = GFont::fromFile(System::findDataFile("icon.fnt"));
    GFontRef greekFont = GFont::fromFile(System::findDataFile("greek.fnt"));

    // The default G3D textbox label leaves too much space between
    // the box and the label, so we override it.
    pane->addLabel("xyz")->setPosition(5, 2);
    pane->addLabel(GuiCaption("qf", greekFont, 12))->setPosition(24, 2);
    cameraLocationTextBox = pane->addTextBox("", Pointer<std::string>(this, &CameraControlWindow::cameraLocation, &CameraControlWindow::setCameraLocation));
    cameraLocationTextBox->setRect(Rect2D::xywh(-50, 2, 292, 24));
    
    GuiPane* manualPane = pane->addPane();
    manualPane->moveBy(-8, 0);

    manualPane->addCheckBox("Manual Control (F2)", &manualOperation)->moveBy(-2, -1);

    trackLabel = manualPane->addLabel("Path");
    trackLabel->moveBy(0, -3);
    trackList = manualPane->addDropDownList("", &trackFileIndex, &trackFileArray);
    trackList->setRect(Rect2D::xywh(trackList->rect().x0y0() - Vector2(54, 25), Vector2(220, trackList->rect().height())));

    visibleCheckBox = manualPane->addCheckBox("Visible", Pointer<bool>(trackManipulator, &UprightSplineManipulator::showPath, &UprightSplineManipulator::setShowPath));
    visibleCheckBox->moveRightOf(trackList);
    visibleCheckBox->moveBy(6, 0);
    
    Vector2 buttonSize = Vector2(20, 20);
    recordButton = manualPane->addRadioButton
        (GuiCaption::Symbol::record(), 
         UprightSplineManipulator::RECORD_KEY_MODE, 
         trackManipulator.pointer(),
         &UprightSplineManipulator::mode,
         &UprightSplineManipulator::setMode,
         GuiRadioButton::TOOL_STYLE);
    recordButton->moveBy(38, 2);
    recordButton->setSize(buttonSize);
    
    playButton = manualPane->addRadioButton
        (GuiCaption::Symbol::play(), 
         UprightSplineManipulator::PLAY_MODE, 
         trackManipulator.pointer(),
         &UprightSplineManipulator::mode,
         &UprightSplineManipulator::setMode,
         GuiRadioButton::TOOL_STYLE);
    playButton->setSize(buttonSize);
    playButton->moveRightOf(recordButton);

    stopButton = manualPane->addRadioButton
        (GuiCaption::Symbol::stop(), 
         UprightSplineManipulator::INACTIVE_MODE, 
         trackManipulator.pointer(),
         &UprightSplineManipulator::mode,
         &UprightSplineManipulator::setMode,
         GuiRadioButton::TOOL_STYLE);
    stopButton->setSize(buttonSize);
    stopButton->moveRightOf(playButton);

    saveButton = manualPane->addButton("Save...");
    saveButton->moveRightOf(stopButton);
    saveButton->setSize(saveButton->rect().wh() - Vector2(20, 1));
    saveButton->moveBy(8, -3);
    saveButton->setEnabled(false);

    cyclicCheckBox = manualPane->addCheckBox("Cyclic", Pointer<bool>(trackManipulator, &UprightSplineManipulator::cyclic, &UprightSplineManipulator::setCyclic));
    cyclicCheckBox->setPosition(visibleCheckBox->rect().x0(), saveButton->rect().y0() + 1);

#   ifdef G3D_OSX
        manualHelpCaption = GuiCaption("W,A,S,D and shift+left mouse to move.", NULL, 10);
#   else
        manualHelpCaption = GuiCaption("W,A,S,D and right mouse to move.", NULL, 10);
#   endif

    autoHelpCaption = "";
    playHelpCaption = "";

    recordHelpCaption = GuiCaption("Spacebar to place a control point.", NULL, 10);

    helpLabel = manualPane->addLabel(manualHelpCaption);
    helpLabel->moveBy(0, 2);

    manualPane->pack();
    pack();
    // Set the width here so that the client rect is correct below
    setRect(Rect2D::xywh(rect().x0y0(), bigSize));

    // Make the pane width match the window width
    manualPane->setPosition(0, manualPane->rect().y0());
    manualPane->setSize(clientRect().width(), manualPane->rect().height());

    // Have to create the drawerButton last, otherwise the setRect
    // code for moving it to the bottom of the window will cause
    // layout to become broken.
    drawerCollapseCaption = GuiCaption("5", iconFont);
    drawerExpandCaption = GuiCaption("6", iconFont);
    drawerButtonPane = pane->addPane("", 0, GuiPane::NO_FRAME_STYLE);
    drawerButton = drawerButtonPane->addButton(drawerExpandCaption, GuiButton::TOOL_STYLE);
    drawerButton->setRect(Rect2D::xywh(0, 0, 12, 12));
    drawerButtonPane->setSize(12, 12);
    
    // Resize the pane to include the drawer button so that it is not clipped
    pane->setSize(clientRect().wh());

    setRect(Rect2D::xywh(rect().x0y0(), smallSize));
    sync();
}