예제 #1
0
파일: mainwindow.cpp 프로젝트: KDE/gluon
void MainWindow::startGame()
{
    GluonCore::GluonObjectFactory::instance()->loadPlugins();
    GluonEngine::GameProject *project = new GluonEngine::GameProject( this );
    project->loadFromFile(m_projectPath);
    GluonEngine::Game::instance()->setGameProject( project );
    GluonEngine::Game::instance()->setCurrentScene( project->entryPoint() );

    GluonEngine::Game::instance()->runGame();
    QApplication::instance()->exit();
}
예제 #2
0
void MainWindow::loadGamesList()
{
    QDir m_dir;
    m_dir.cd( GluonCore::Global::dataDirectory() + "/gluon/games" );
    QStringList gameDirNameList = m_dir.entryList( QStringList() << QString( '*' + GluonEngine::projectSuffix ), QDir::Dirs | QDir::NoDotAndDotDot );
    foreach( const QString & gameDirName, gameDirNameList )
    {
        QDir gameDir = m_dir;
        gameDir.cd( gameDirName );
        QStringList gluonProjectFiles = gameDir.entryList( QStringList( GluonEngine::projectFilename ) );
        if( !gluonProjectFiles.isEmpty() )
        {
            QString projectFileName = gameDir.absoluteFilePath( gluonProjectFiles.at( 0 ) );
            GluonEngine::GameProject project;
            project.loadFromFile( projectFileName );
            d->listWidget->addItem( projectFileName );
        }
    }