void LocationsManager::AddLocations(){

	sfe::RichText titleFont(font);
	titleFont.setCharacterSize(BIG_CHARACTER_SIZE);

	sfe::RichText descriptionFont(font);
	descriptionFont.setCharacterSize(NORMAL_CHARACTER_SIZE);

	/*world->addLocation(GameManager::getLocationName(0), "Descrição Local 1", 
		titleFont << sf::Color::Cyan << GameManager::getLocationName(0), 
		descriptionFont << "This Is a Mindfull place... \nGet ready to fullfill your " << sf::Color::Blue << "Dreams"
		<< sf::Color::White << " as you get to sleep!!!");*/    

	for (size_t i = 0; i < GameManager::locationDatabase.size(); i++){
		world->addLocation(GameManager::getLocationName(i), GameManager::getLocationDescription(i), 
			titleFont << GameManager::getLocationName(i), descriptionFont << GameManager::getLocationDescription(i), GameManager::getLocationLevel(i));

		titleFont.clear();
		descriptionFont.clear();
	}
}
Example #2
0
// Calculates the height of the description text based on widget width
int QCommandLinkButtonPrivate::descriptionHeight(int widgetWidth) const
{
    // Calc width of actual paragraph
    int lineWidth = widgetWidth - textOffset() - rightMargin();

    qreal descriptionheight = 0;
    if (!description.isEmpty()) {
        QTextLayout layout(description);
        layout.setFont(descriptionFont());
        layout.beginLayout();
        while (true) {
            QTextLine line = layout.createLine();
            if (!line.isValid())
                break;
            line.setLineWidth(lineWidth);
            line.setPosition(QPointF(0, descriptionheight));
            descriptionheight += line.height();
        }
        layout.endLayout();
    }
    return qRound(descriptionheight);
}
Example #3
0
EigenPlotDlg::EigenPlotDlg(QWidget* parent) :
   QDialog(parent),
   mpPlot(NULL),
   mpCurve(NULL),
   mpComponentsSpin(NULL)
{
   // Eigen plot
   mpPlot = new QwtPlot(this);
   mpPlot->installEventFilter(this);
   mpPlot->setAutoFillBackground(true);

   QFont ftAxis = QApplication::font();
   ftAxis.setBold(true);
   ftAxis.setPointSize(10);

   QwtText bottomText("Number of Components");
   bottomText.setFont(ftAxis);
   mpPlot->setAxisTitle(QwtPlot::xBottom, bottomText);

   QwtText leftText("Eigen Values");
   leftText.setFont(ftAxis);
   mpPlot->setAxisTitle(QwtPlot::yLeft, leftText);

   QwtScaleEngine* pLinearScale = mpPlot->axisScaleEngine(QwtPlot::xBottom);
   pLinearScale->setAttribute(QwtScaleEngine::Floating);

   QwtLog10ScaleEngine* pLogScale = new QwtLog10ScaleEngine();
   pLogScale->setAttribute(QwtScaleEngine::Floating);
   mpPlot->setAxisScaleEngine(QwtPlot::yLeft, pLogScale);

   QPalette plotPalette = mpPlot->palette();
   plotPalette.setColor(QPalette::Window, Qt::white);
   mpPlot->setPalette(plotPalette);

   QwtPlotCanvas* pPlotCanvas = mpPlot->canvas();
   pPlotCanvas->setFrameStyle(QFrame::NoFrame);

   QwtPlotLayout* pPlotLayout = mpPlot->plotLayout();
   pPlotLayout->setMargin(5);

   QwtPlotGrid* pPlotGrid = new QwtPlotGrid();
   pPlotGrid->setPen(QPen(Qt::DotLine));
   pPlotGrid->attach(mpPlot);
   mpPlot->replot();

   // Number of components
   QLabel* pComponentsLabel = new QLabel("Number of Components:", this);
   mpComponentsSpin = new QSpinBox(this);
   mpComponentsSpin->setFixedWidth(50);
   mpComponentsSpin->setMinimum(1);

   QLabel* pDescriptionLabel = new QLabel("To set, left click in the plot or enter a value.", this);
   pDescriptionLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
   pDescriptionLabel->setWordWrap(true);

   QFont descriptionFont(pDescriptionLabel->font());
   descriptionFont.setItalic(true);
   pDescriptionLabel->setFont(descriptionFont);

   QHBoxLayout* pComponentsLayout = new QHBoxLayout();
   pComponentsLayout->setMargin(0);
   pComponentsLayout->setSpacing(5);
   pComponentsLayout->addWidget(pComponentsLabel);
   pComponentsLayout->addWidget(mpComponentsSpin);
   pComponentsLayout->addWidget(pDescriptionLabel, 10);

   // Horizontal line
   QFrame* pLine = new QFrame(this);
   pLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);

   // Buttons
   QPushButton* pOk = new QPushButton("&OK", this);
   QPushButton* pCancel = new QPushButton("&Cancel", this);
   connect(pOk, SIGNAL(clicked()), this, SLOT(accept()));
   connect(pCancel, SIGNAL(clicked()), this, SLOT(reject()));

   QHBoxLayout* pButtonLayout = new QHBoxLayout();
   pButtonLayout->setMargin(0);
   pButtonLayout->setSpacing(5);
   pButtonLayout->addStretch(10);
   pButtonLayout->addWidget(pOk);
   pButtonLayout->addWidget(pCancel);

   // Layout
   QGridLayout* pGrid = new QGridLayout(this);
   pGrid->setMargin(10);
   pGrid->setSpacing(10);
   pGrid->addWidget(mpPlot, 0, 0);
   pGrid->addLayout(pComponentsLayout, 1, 0);
   pGrid->addWidget(pLine, 2, 0);
   pGrid->addLayout(pButtonLayout, 3, 0);
   pGrid->setRowStretch(0, 10);

   // Initialization
   setWindowTitle("PCA Components");
   setModal(true);
   resize(440, 300);
}