Beispiel #1
0
void Drawboard::updateTool(const QPoint& pos)
{
    if (pos != lastToolPos)
    {
        updateTool();
        lastToolPos = pos;
        updateTool();
    }
}
Beispiel #2
0
void Drawboard::setTool(tool::Tool tool)
{
    if (tool == currentTool)
    {
        return;
    }

    updateTool();
    currentTool = tool;
    updateTool();
    emit changedTool(currentTool);
}
Beispiel #3
0
EditorUI::EditorUI()
	:	mFile(0)
{
	setupUi(this);
	actNew->setIcon(style()->standardIcon(QStyle::SP_FileIcon));
	actOpen->setIcon(style()->standardIcon(QStyle::SP_DirOpenIcon));
	actSave->setIcon(style()->standardIcon(QStyle::SP_DriveFDIcon));

	CommWindow *comm = new CommWindow(CommDock);
	CommDock->setWidget(comm);
	CommDock->setVisible(false);

	mGame = new EditorGame(comm);
	mBp = new EditorBlueprint(mGame, this);
	setCentralWidget(mBp);
	connect(mBp, SIGNAL(zoomChanged(float)), this, SLOT(zoomChanged(float)));
	connect(mBp, SIGNAL(dropEntity(Math::Point)), this, SLOT(dropEntity(Math::Point)));
	connect(mGame, SIGNAL(worldUpdated()), mBp, SLOT(repaint()));

	toolSelect = new QButtonGroup(this);
	toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actPanTool), EditorBlueprint::pan);
	toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actMoveTool), EditorBlueprint::move);
	toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actBuildTool), EditorBlueprint::build);
	connect(actMoveTool, SIGNAL(triggered()), this, SLOT(updateTool()));
	connect(actPanTool, SIGNAL(triggered()), this, SLOT(updateTool()));
	connect(actBuildTool, SIGNAL(triggered()), this, SLOT(updateTool()));

	entityBox = new QComboBox(this);
	entityBox->addItem("");
	entityBox->addItems(FactoryManager::instance()->types());
	toolBar->addSeparator();
	toolBar->addWidget(entityBox);

	zoomLabel = new QLabel;
	statusbar->addPermanentWidget(zoomLabel);
	zoomChanged(mBp->zoom());


	connect(actNew, SIGNAL(triggered()), this, SLOT(New()));
	connect(actOpen, SIGNAL(triggered()), this, SLOT(open()));
	connect(actSave, SIGNAL(triggered()), this, SLOT(save()));
	connect(actSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()));
	connect(actShowNavmesh, SIGNAL(triggered(bool)), mBp, SLOT(setShowNavmesh(bool)));
	connect(actPopulate, SIGNAL(triggered()), this, SLOT(populate()));
	connect(actReset, SIGNAL(triggered()), this, SLOT(reset()));
	connect(actStartStop, SIGNAL(triggered()), this, SLOT(startStop()));
	connect(actGenNavmesh, SIGNAL(triggered()), this, SLOT(generateNavmesh()));

	New();
}
Beispiel #4
0
void Drawboard::showTool(bool show)
{
    if (toolVisible != show)
    {
        if (show)
        {
            toolVisible = show;
            updateTool();
        }
        else
        {
            updateTool();
            toolVisible = show;
        }
    }
}
Beispiel #5
0
void Drawboard::mouseMoveEvent(QMouseEvent* event)
{
    if (rect().contains(event->pos()))
    {
        draw(lastDraw, event->pos());
        lastDraw = event->pos();
        updateTool(event->pos());
    }
}
Beispiel #6
0
void Drawboard::mousePressEvent(QMouseEvent* event)
{
    showTool(true);
    if (rect().contains(event->pos()))
    {
        draw(event->pos(), event->pos());
        lastDraw = event->pos();
        updateTool(event->pos());
    }
}
Beispiel #7
0
void Tool::update(const PlayerController &event)
{
    updateTool(event);
    if(event.pressed(SELECT) && isInside(event.mousePos()))
    {
        if(m_selected)
            m_player = (m_player+1)%m_players.size();
        else
        {
            select();
        }
    }
}
void CompartmentMapWidget::loadAtlas()
{
    //QString atlasfile(":/atlas/flybraincompartmentmap.v3ds"); // .qrc
    QString flybrainatlas("flybraincompartmentmap.v3ds");

    QString atlasfile;

    if(QFile::exists(QDir::currentPath().append("/").append(flybrainatlas)))
    {
        atlasfile = QDir::currentPath().append("/").append(flybrainatlas);
    }
    else if(QFile::exists(QDir::homePath().append("/").append(flybrainatlas)))
    {
        atlasfile = QDir::homePath().append("/").append(flybrainatlas);
    }
    else if(QFile::exists(QDir::rootPath().append("/").append(flybrainatlas)))
    {
        atlasfile = QDir::rootPath().append("/").append(flybrainatlas);
    }
    else if(QFile::exists(QDir::tempPath().append("/").append(flybrainatlas)))
    {
        atlasfile = QDir::tempPath().append("/").append(flybrainatlas);
    }
    else if(QFile::exists(qApp->applicationDirPath().append("/").append(flybrainatlas)))
    {
        atlasfile = qApp->applicationDirPath().append("/").append(flybrainatlas);
    }
    else if(QFile::exists(qApp->applicationDirPath().append("/../../../").append(flybrainatlas)))
    {
        atlasfile = qApp->applicationDirPath().append("/../../../").append(flybrainatlas);
    }

    if(QFile::exists(atlasfile))
    {
        ((Renderer_gl1 *)renderer)->loadV3DSFile(atlasfile);
        //((Renderer_gl1 *)renderer)->loadObjectFromFile(atlasfile.toStdString().c_str());

        updateTool();
        //renderer->paint(); //POST_updateGL();
        //update();
    }
}