コード例 #1
0
ファイル: querytester.cpp プロジェクト: adenexter/libqtsparql
void QueryTester::startQueries()
{
    initResources();
    for (int i=0;i<numQueries;i++) {
        QPair<int, int> resultRange;
        QString filter;
        if (i % 10 == 0) {
            // Override every 10th result to read all
            resultRange = qMakePair(1, testDataSize);
            filter = ". }";
        }
        else {
            resultRange  = randomRangeIn(testDataSize);
            filter = QString("FILTER ( ?t >=%1 && ?t <=%2 ) }").arg(resultRange.first).arg(resultRange.second);
        }
        QSparqlQuery select(QString("select ?u ?t {?u a nmm:MusicPiece; "
                                    "nmm:trackNumber ?t; "
                                    "nie:isLogicalPartOf <qsparql-tracker-direct-tests-concurrency-stress> "
                                    + filter));
        QSparqlQueryOptions queryOptions;
        queryOptions.setForwardOnly(forwardOnly);
        QSparqlResult *result = connection->exec(select, queryOptions);
        resultChecker->append(result, resultRange);
    }
}
コード例 #2
0
ファイル: sonic.cpp プロジェクト: kevL/xoreos
void SonicEngine::init() {
	// Force to the screen size of the Nintendo DS (2 screens of 256x192)
	WindowMan.setWindowSize(kScreenWidth, 2 * kScreenHeight);

	LoadProgress progress(8);

	progress.step("Declare languages");
	declareLanguages();

	if (evaluateLanguage(true, _language))
		status("Setting the language to %s", LangMan.getLanguageName(_language).c_str());
	else
		warning("Failed to detect this game's language");

	progress.step("Loading user game config");
	initConfig();

	initResources(progress);
	if (EventMan.quitRequested())
		return;

	progress.step("Initializing internal game config");
	initGameConfig();

	progress.step("Successfully initialized the engine");
}
コード例 #3
0
ファイル: witcher.cpp プロジェクト: Supermanu/xoreos
void WitcherEngine::init() {
	LoadProgress progress(15);

	progress.step("Declare languages");
	declareLanguages();

	if (evaluateLanguage(true, _languageText, _languageVoice))
		status("Setting the language to %s text + %s voices",
				LangMan.getLanguageName(_languageText).c_str(),
				LangMan.getLanguageName(_languageVoice).c_str());
	else
		throw Common::Exception("Failed to detect this game's language");

	progress.step("Loading user game config");
	initConfig();

	initResources(progress);
	if (EventMan.quitRequested())
		return;

	progress.step("Loading game cursors");
	initCursors();
	if (EventMan.quitRequested())
		return;

	progress.step("Initializing internal game config");
	initGameConfig();

	progress.step("Initializing Lua subsystem");
	initLua();

	progress.step("Successfully initialized the engine");
}
コード例 #4
0
ファイル: nwn.cpp プロジェクト: cc9cii/xoreos
void NWNEngine::init() {
	LoadProgress progress(21);

	progress.step("Detecting game version");
	detectVersion();

	progress.step("Loading user game config");
	initConfig();
	checkConfig();

	if (EventMan.quitRequested())
		return;

	progress.step("Declare string encodings");
	declareEncodings();

	initResources(progress);

	if (EventMan.quitRequested())
		return;

	progress.step("Loading game cursors");
	initCursors();

	if (EventMan.quitRequested())
		return;

	progress.step("Initializing internal game config");
	initGameConfig();

	progress.step("Starting script system");
	_scriptFuncs = new ScriptFunctions();

	progress.step("Successfully initialized the engine");
}
コード例 #5
0
ファイル: nwn2.cpp プロジェクト: clone2727/xoreos
void NWN2Engine::init() {
	LoadProgress progress(21);

	progress.step("Declare languages");
	declareLanguages();

	if (evaluateLanguage(true, _language))
		status("Setting the language to %s", LangMan.getLanguageName(_language).c_str());
	else
		warning("Failed to detect this game's language");

	LangMan.setCurrentLanguage(_language);

	progress.step("Loading user game config");
	initConfig();

	initResources(progress);
	if (EventMan.quitRequested())
		return;

	progress.step("Loading game cursors");
	initCursors();
	if (EventMan.quitRequested())
		return;

	progress.step("Initializing internal game config");
	initGameConfig();

	progress.step("Successfully initialized the engine");
}
コード例 #6
0
Service_impl::Service_impl (char* devMgr_ior, char* _name) :
    component_running_mutex(),
    component_running(&component_running_mutex)
{
    LOG_TRACE(Service_impl, "Constructing Device")
    initResources(devMgr_ior, _name);
    LOG_TRACE(Service_impl, "Done Constructing Device")
}
コード例 #7
0
ファイル: qeglfsintegration.cpp プロジェクト: James-intern/Qt
QT_BEGIN_NAMESPACE

QEglFSIntegration::QEglFSIntegration()
{
    mDisableInputHandlers = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISABLE_INPUT");

    initResources();
}
コード例 #8
0
BaseFileManager::BaseFileManager(Common::Language lang, bool detectionMode) {
	_detectionMode = detectionMode;
	_language = lang;
	_resources = nullptr;
	initResources();
	initPaths();
	registerPackages();
}
コード例 #9
0
QWaylandMaterialDecoration::QWaylandMaterialDecoration()
        : QWaylandAbstractDecoration(), m_clicking(None), m_backgroundColor("#455a64"),
          m_iconColor("#b4ffffff"), m_textColor("#ffffff")
{
    initResources();

    QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter);
    option.setWrapMode(QTextOption::NoWrap);
    m_windowTitle.setTextOption(option);
}
コード例 #10
0
void QQuickHandlersModule::defineModule()
{
    initResources();

    const char uri[] = "Qt.labs.handlers";
    int majorVersion = 1;
    int minorVersion = 0;

    qt_quickhandlers_defineModule(uri, majorVersion, minorVersion);
}
コード例 #11
0
Common::Error Parallaction_br::init() {

	_screenWidth = 640;
	_screenHeight = 400;

	if (getPlatform() == Common::kPlatformPC) {
		if (getFeatures() & GF_DEMO) {
			_disk = new DosDemoDisk_br(this);
		} else {
			_disk = new DosDisk_br(this);
		}
		_disk->setLanguage(2);					// NOTE: language is now hardcoded to English. Original used command-line parameters.
		MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
		MidiDriver *driver = MidiDriver::createMidi(dev);
		_soundManI = new DosSoundMan_br(this, driver);
	} else {
		_disk = new AmigaDisk_br(this);
		_disk->setLanguage(2);					// NOTE: language is now hardcoded to English. Original used command-line parameters.
		_soundManI = new AmigaSoundMan_br(this);
	}

	_disk->init();
	_soundMan = new SoundMan(_soundManI);

	initResources();
	initFonts();
	_locationParser = new LocationParser_br(this);
	_locationParser->init();
	_programParser = new ProgramParser_br(this);
	_programParser->init();

	_cmdExec = new CommandExec_br(this);
	_programExec = new ProgramExec_br(this);

	_walker = new PathWalker_BR;

	_part = -1;
	_nextPart = -1;

	_subtitle[0] = 0;
	_subtitle[1] = 0;

	memset(_zoneFlags, 0, sizeof(_zoneFlags));

	_countersNames = 0;

	_saveLoad = new SaveLoad_br(this, _saveFileMan);

	initInventory();
	setupBalloonManager();

	Parallaction::init();

	return Common::kNoError;
}
コード例 #12
0
ファイル: plugin.cpp プロジェクト: JDSquared/QtQuickVcp
void MachinekitHalRemoteControlsPlugin::registerTypes(const char *uri)
{
    initResources();

    // @uri Machinekit.HalRemote.Controls
    Q_ASSERT(uri == QLatin1String("Machinekit.HalRemote.Controls"));
    const QString filesLocation = fileLocation();
    for (int i = 0; i < int(sizeof(qmldir)/sizeof(qmldir[0])); i++) {
        qmlRegisterType(QUrl(filesLocation + "/" + qmldir[i].type + ".qml"), uri, qmldir[i].major, qmldir[i].minor, qmldir[i].type);
        }
}
コード例 #13
0
QT_BEGIN_NAMESPACE

void QQuickItemsModule::defineModule()
{
    initResources();

    QByteArray name = "QtQuick";
    int majorVersion = 2;
    int minorVersion = 0;

    qt_quickitems_defineModule(name, majorVersion, minorVersion);
}
コード例 #14
0
/*!
    \class Qt3D::QRenderAspectPrivate
    \internal
*/
QRenderAspectPrivate::QRenderAspectPrivate(QRenderAspect::RenderType type)
    : QAbstractAspectPrivate()
    , m_renderer(new Render::Renderer(type))
    , m_surfaceEventFilter(new Render::PlatformSurfaceFilter(m_renderer))
    , m_surface(Q_NULLPTR)
    , m_time(0)
    , m_initialized(false)
    , m_shuttingDown(false)
{
    initResources();
    m_aspectType = QAbstractAspect::AspectRenderer;
}
コード例 #15
0
QT_BEGIN_NAMESPACE

QEglFSIntegration::QEglFSIntegration()
    : m_display(EGL_NO_DISPLAY),
      m_inputContext(0),
      m_fontDb(new QGenericUnixFontDatabase),
      m_services(new QGenericUnixServices),
      m_kbdMgr(0),
      m_disableInputHandlers(false)
{
    m_disableInputHandlers = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISABLE_INPUT");

    initResources();
}
コード例 #16
0
QT_BEGIN_NAMESPACE

void QQuickParticlesModule::defineModule()
{
    initResources();

    const char* uri = "QtQuick.Particles";

    qmlRegisterType<QQuickParticleSystem>(uri, 2, 0, "ParticleSystem");
    qmlRegisterType<QQuickParticleGroup>(uri, 2, 0, "ParticleGroup");

    qmlRegisterType<QQuickImageParticle>(uri, 2, 0, "ImageParticle");
    qmlRegisterType<QQuickCustomParticle>(uri, 2, 0, "CustomParticle");
    qmlRegisterType<QQuickItemParticle>(uri, 2, 0, "ItemParticle");

    qmlRegisterType<QQuickParticleEmitter>(uri, 2, 0, "Emitter");
    qmlRegisterType<QQuickTrailEmitter>(uri, 2, 0, "TrailEmitter");

    qmlRegisterType<QQuickEllipseExtruder>(uri, 2, 0, "EllipseShape");
    qmlRegisterType<QQuickRectangleExtruder>(uri, 2, 0, "RectangleShape");
    qmlRegisterType<QQuickLineExtruder>(uri, 2, 0, "LineShape");
    qmlRegisterType<QQuickMaskExtruder>(uri, 2, 0, "MaskShape");

    qmlRegisterType<QQuickPointDirection>(uri, 2, 0, "PointDirection");
    qmlRegisterType<QQuickAngleDirection>(uri, 2, 0, "AngleDirection");
    qmlRegisterType<QQuickTargetDirection>(uri, 2, 0, "TargetDirection");
    qmlRegisterType<QQuickCumulativeDirection>(uri, 2, 0, "CumulativeDirection");

    qmlRegisterType<QQuickCustomAffector>(uri, 2, 0, "Affector");
    qmlRegisterType<QQuickWanderAffector>(uri, 2, 0, "Wander");
    qmlRegisterType<QQuickFrictionAffector>(uri, 2, 0, "Friction");
    qmlRegisterType<QQuickAttractorAffector>(uri, 2, 0, "Attractor");
    qmlRegisterType<QQuickGravityAffector>(uri, 2, 0, "Gravity");
    qmlRegisterType<QQuickAgeAffector>(uri, 2, 0, "Age");
    qmlRegisterType<QQuickSpriteGoalAffector>(uri, 2, 0, "SpriteGoal");
    qmlRegisterType<QQuickGroupGoalAffector>(uri, 2, 0, "GroupGoal");
    qmlRegisterType<QQuickTurbulenceAffector>(uri, 2, 0 , "Turbulence");

    //Exposed just for completeness
    qmlRegisterUncreatableType<QQuickParticleAffector>(uri, 2, 0, "ParticleAffector",
                                                    QStringLiteral("Abstract type. Use one of the inheriting types instead."));
    qmlRegisterUncreatableType<QQuickParticlePainter>(uri, 2, 0, "ParticlePainter",
                                                   QStringLiteral("Abstract type. Use one of the inheriting types instead."));
    qmlRegisterUncreatableType<QQuickParticleExtruder>(uri, 2, 0, "ParticleExtruder",
                                                    QStringLiteral("Abstract type. Use one of the inheriting types instead."));
    qmlRegisterUncreatableType<QQuickDirection>(uri, 2, 0, "NullVector",
                                             QStringLiteral("Abstract type. Use one of the inheriting types instead."));
}
コード例 #17
0
ファイル: main.c プロジェクト: maryilyina/Doodle-Underwater
int main ( )
{	
	int main_ret = 0;
	struct Game game;

	assert (initResources (&game) == 0);
	SDL_Log ("All game resources initialised\n`");

	while (!game.should_exit)
	{
		game.game_state_processors [game.game_state] (&game);
	}

	close (&game);
	return 0;
}
コード例 #18
0
void  OgreWidget::initOgreSystem()
{
  m_ogreRoot = new Ogre::Root();

  Ogre::RenderSystem * renderSystem = m_ogreRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
  m_ogreRoot->setRenderSystem(renderSystem);
  m_ogreRoot->initialise(false);

  m_sceneManager = m_ogreRoot->createSceneManager(Ogre::ST_GENERIC);

  Ogre::NameValuePairList viewConfig;
  Ogre::String widgetHandle;

#ifdef Q_WS_WIN
  widgetHandle = Ogre::StringConverter::toString((size_t)winId());
  viewConfig["externalWindowHandle"] = widgetHandle;
#else
  QX11Info xInfo = x11Info();

  widgetHandle = Ogre::StringConverter::toString(reinterpret_cast<unsigned long>(xInfo.display())) +
      ":" + Ogre::StringConverter::toString(static_cast<unsigned int>(xInfo.screen())) +
      ":" + Ogre::StringConverter::toString(static_cast<unsigned long>(parentWidget()->winId()));
  viewConfig["parentWindowHandle"] = widgetHandle;
#endif

  m_renderWindow = m_ogreRoot->createRenderWindow("Ogre rendering window", width(), height(), false, &viewConfig);

#ifndef Q_WS_WIN
  WId window_id;
  m_renderWindow->getCustomAttribute("WINDOW", &window_id);
  create(window_id);
#endif

  m_camera = new Camera(m_sceneManager->createCamera("myCamera"));

  m_camera->reset();
  m_camera->getCamera()->setAspectRatio(Ogre::Real(width()) / Ogre::Real(height()));
  m_camera->getCamera()->setNearClipDistance(Ogre::Real(0.1));

  m_viewport = m_renderWindow->addViewport(m_camera->getCamera());
  m_viewport->setBackgroundColour(Ogre::ColourValue(0.5, 0.5, 0.5));

  m_selectionBuffer = new SelectionBuffer(m_sceneManager, m_renderWindow);

  initResources();
  initScene();
}
コード例 #19
0
ファイル: age_widget.cpp プロジェクト: Anehta/AGE-lua
void AWidget::initializeGL()
{
    setCurrentScene(NULL);
    initializeGLFunctions();

    qglClearColor(Qt::black);

    //glEnable(GL_DEPTH_TEST);

    glEnable(GL_CULL_FACE);

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    initDefalutShaderProgram();
    initResources();
    m_timer.start(15, this);
}
コード例 #20
0
ファイル: stage.cpp プロジェクト: Aleem21/project479
int stage::run() {
    //Initialize GLFW
    if(!glfwInit())
        throw std::runtime_error("glfwInit failed");
    
    //Create Window
    window = glfwCreateWindow(screen_width, screen_height, "Renderer", NULL, NULL);
    if (!window) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    
    //Enable V-Sync
    glfwSwapInterval(1);
    
    //Initialize GLEW
    glewExperimental = GL_TRUE;
    GLenum glew_status = glewInit();
    if (glew_status != GLEW_OK) {
        fprintf(stderr, "Error: %s\n", glewGetErrorString(glew_status));
        return 1;
    }
    if (!GLEW_VERSION_2_0) {
        fprintf(stderr, "Error: your graphic card does not support OpenGL 2.0\n");
        return 1;
    }
    
    //Begin Process
    if(initResources()) {
        linkUniforms();
        
        init_glSettings();
        
        update_loop();
    }
    
    freeResources();
    glfwDestroyWindow(window);
    glfwTerminate();

    return 0;
}
コード例 #21
0
ファイル: kotor.cpp プロジェクト: jjardon/eos
void KotOREngine::init() {
	initConfig();
	checkConfig();

	if (EventMan.quitRequested())
		return;

	initResources();

	if (EventMan.quitRequested())
		return;

	initCursors();

	if (EventMan.quitRequested())
		return;

	initGameConfig();
}
コード例 #22
0
ファイル: qtquick2.cpp プロジェクト: CodeDJ/qt5-hidpi
void QQmlQtQuick2Module::defineModule()
{
    initResources();

    QQuick_initializeProviders();

    QQuickUtilModule::defineModule();
    QQmlEnginePrivate::defineQtQuick2Module();
    QQuickItemsModule::defineModule();

    qmlRegisterUncreatableType<QQuickApplication>("QtQuick",2,0,"Application", QQuickApplication::tr("Application is an abstract class"));

    QQuickValueTypes::registerValueTypes();

    if (QQmlEngineDebugService::isDebuggingEnabled()) {
        QQmlEngineDebugService::instance()->setStatesDelegate(
                    new QQmlQtQuick2DebugStatesDelegate);
    }
}
コード例 #23
0
ファイル: plugin.cpp プロジェクト: xjohncz/qt5
void QtQuickControlsPlugin::registerTypes(const char *uri)
{
    initResources();
    qmlRegisterType<QQuickAction>(uri, 1, 0, "Action");
    qmlRegisterType<QQuickExclusiveGroup>(uri, 1, 0, "ExclusiveGroup");
    qmlRegisterType<QQuickMenu>(uri, 1, 0, "MenuPrivate");
    qmlRegisterType<QQuickMenuBar>(uri, 1, 0, "MenuBarPrivate");
    qmlRegisterType<QQuickMenuItem>(uri, 1, 0, "MenuItem");
    qmlRegisterUncreatableType<QQuickMenuItemType>(uri, 1, 0, "MenuItemType",
                                                   QLatin1String("Do not create objects of type MenuItemType"));
    qmlRegisterType<QQuickMenuSeparator>(uri, 1, 0, "MenuSeparator");
    qmlRegisterUncreatableType<QQuickMenuBase>(uri, 1, 0, "MenuBase",
                                               QLatin1String("Do not create objects of type MenuBase"));

    qmlRegisterUncreatableType<QQuickStack>(uri, 1, 0, "Stack", QLatin1String("Do not create objects of type Stack"));
    qmlRegisterUncreatableType<QQuickSelectionMode>(uri, 1, 1, "SelectionMode", QLatin1String("Do not create objects of type SelectionMode"));

    const QString filesLocation = fileLocation();
    for (int i = 0; i < int(sizeof(qmldir)/sizeof(qmldir[0])); i++)
        qmlRegisterType(QUrl(filesLocation + "/" + qmldir[i].type + ".qml"), uri, qmldir[i].major, qmldir[i].minor, qmldir[i].type);
}
コード例 #24
0
ファイル: nwn.cpp プロジェクト: gitter-badger/xoreos
void NWNEngine::init() {
	initConfig();
	checkConfig();

	if (EventMan.quitRequested())
		return;

	initResources();

	if (EventMan.quitRequested())
		return;

	initCursors();

	if (EventMan.quitRequested())
		return;

	initGameConfig();

	_scriptFuncs = new ScriptFunctions();
}
コード例 #25
0
ファイル: plugin.cpp プロジェクト: the-snowwhite/QtQuickVcp
void MachinekitApplicationPlugin::registerTypes(const char *uri)
{
    initResources();

    // Verify that the version of the library that we linked against is
    // compatible with the version of the headers we compiled against.
    GOOGLE_PROTOBUF_VERIFY_VERSION;

    // @uri Machinekit.Application
    qmlRegisterType<QApplicationConfig>(uri, 1, 0, "ApplicationConfig");
    qmlRegisterType<QApplicationConfigItem>(uri, 1, 0, "ApplicationConfigItem");
    qmlRegisterType<QApplicationConfigFilter>(uri, 1, 0, "ApplicationConfigFilter");
    qmlRegisterType<QApplicationDescription>(uri, 1, 0, "ApplicationDescription");
    qmlRegisterType<QApplicationStatus>(uri, 1, 0, "ApplicationStatus");
    qmlRegisterType<QApplicationCommand>(uri, 1, 0, "ApplicationCommand");
    qmlRegisterType<QApplicationError>(uri, 1, 0, "ApplicationError");
    qmlRegisterType<QApplicationFile>(uri, 1, 0, "ApplicationFile");
    qmlRegisterType<QLocalSettings>(uri, 1, 0, "LocalSettings");

    const QString filesLocation = fileLocation();
    for (int i = 0; i < int(sizeof(qmldir)/sizeof(qmldir[0])); i++) {
        qmlRegisterType(QUrl(filesLocation + "/" + qmldir[i].type + ".qml"), uri, qmldir[i].major, qmldir[i].minor, qmldir[i].type);
    }
}
コード例 #26
0
QT_BEGIN_NAMESPACE

/*!
    \class QDesignerComponents
    \brief The QDesignerComponents class provides a central resource for the various components
    used in the \QD user interface.
    \inmodule QtDesigner
    \internal

    The QDesignerComponents class is a factory for each of the standard components present
    in the \QD user interface. It is mostly useful for developers who want to implement
    a standalone form editing environment using \QD's components, or who need to integrate
    \QD's components into an existing integrated development environment (IDE).

    \sa QDesignerFormEditorInterface, QDesignerObjectInspectorInterface,
        QDesignerPropertyEditorInterface, QDesignerWidgetBoxInterface
*/

/*!
    Initializes the resources used by the components.*/
void QDesignerComponents::initializeResources()
{
    initResources();
}
コード例 #27
0
ファイル: Engine.cpp プロジェクト: silentlamb/ld33-entry
void Engine::exec()
{
    LOGME_CALL("Engine::exec");

    LOGME_DEBUG("Initializing window");
    if(!initWindow()) {
        throw std::runtime_error("Window initialization failed");
    }

    LOGME_DEBUG("Initializing engine state stack");
    if (!initStateStack()) {
        throw std::runtime_error("State stack initialization failed");
    }

    LOGME_DEBUG("Initializing resources");
    if (!initResources()) {
        throw std::runtime_error("Resource initialization failed");
    }

#ifdef MVE_LUA_ENABLED
    LOGME_DEBUG("Initializing LUA scripts");
    if(!initScripts()) {
        throw std::runtime_error("Script initialization failed");
    }
#endif

    if (!initEngine()) {
        throw std::runtime_error("Engine initialization failed");
    }

    LOGME_DEBUG("Initialization success");

    sf::Clock   clock;
    sf::Time    timeSinceLastUpdate(sf::Time::Zero);
    sf::Event   event;

    sf::Text    debugFpsText;
    sf::Time    debugUpdateTime(sf::Time::Zero);
    std::size_t debugFramesCount(0);

    // TODO: Find nice font on a good licence terms for debug purposes

    sf::Font font;
    if (!font.loadFromFile("assets/GRUPO3.ttf")) {
        throw std::runtime_error("Cannot load font");
    }

    // TODO: Magic numbers
    debugFpsText.setFont(font);
    debugFpsText.setCharacterSize(14);
    debugFpsText.setColor(sf::Color::White);
    debugFpsText.setPosition(5.f, 5.f);
    debugFpsText.setString("");

    sf::RenderWindow& window = getWindow();
    mve::StateStack& stateStack = getStateStack();


    // TODO: API to set pixel scale factor
    // TODO: API to have multiple views managed by Engine or some its component
//    sf::View scaledView(window.getDefaultView());
    sf::View scaledView(sf::Vector2f(160, 120), sf::Vector2f(320, 240));

    // Main loop
    onLoopStarted();
    while (window.isOpen())
    {
        window.setView(scaledView);
        sf::Time dt = clock.restart();
        timeSinceLastUpdate += dt;

        // We need to catch up with logic and input handling first
        while (timeSinceLastUpdate > TimePerFrame) {
            timeSinceLastUpdate -= TimePerFrame;

            // Process input
            while (window.pollEvent(event)) {
                if (!onEventHandle(event)) {
                    continue;
                }
                stateStack.handleEvent(event);
                if (event.type == sf::Event::Closed) {
                    stateStack.clearRequest();
                }
            }

            // Update logic by the constant time TimePerFrame
            onLogicUpdate(TimePerFrame);
            stateStack.update(TimePerFrame);

            // No state on the stack means no client to handle the logic
            if (stateStack.isEmpty()) {
                window.close();
            }
        }

        const bool displayFps = getDisplayFps();

        if (displayFps) {
            debugUpdateTime += dt;
            ++debugFramesCount;

            if (debugUpdateTime >= sf::seconds(1.f)) {
                onFpsUpdate(debugFramesCount);
                debugFpsText.setString("FPS: " + utils::toString(debugFramesCount));
                debugUpdateTime -= sf::seconds(1.f);
                debugFramesCount = 0;
            }


        }

        window.clear(mBgColor);

        onRenderStarted();
        stateStack.draw();

        window.setView(window.getDefaultView());
        if (displayFps) {
            window.draw(debugFpsText);
        }

        onRenderFinished();
        window.display();
    }
    onLoopFinished();
}
コード例 #28
0
ファイル: frame.cpp プロジェクト: hackorama/tag-video
HRESULT
Frame::CheckMediaType(const CMediaType *media ) 
{
	vi = (VIDEOINFO *)media->Format();
	if(!vi) return E_FAIL;
	if(!IsEqualGUID( *media->Subtype(), MEDIASUBTYPE_RGB24)) return E_FAIL;
	bmih 	   = vi->bmiHeader;
	pixelbytes = vi->bmiHeader.biBitCount / 8;
	v_width    = vi->bmiHeader.biWidth;
	v_height   = vi->bmiHeader.biHeight;

	if( config->V_WIN_WIDTH < v_width ){
        /*float scale = (float)v_width / (float)config->V_WIN_WIDTH;
        v_display_width  = config->V_WIN_WIDTH;
        v_display_height = (int) ((float)v_height/scale);
		if(v_display_height%2) v_display_height++; //multiple of two*/
		config->FUZZY->sizeFrame(	&v_display_width, &v_display_height, 
					config->V_WIN_WIDTH, config->V_WIN_HEIGHT, 
					v_width, v_height, 1);
    }else{
        v_display_width  = v_width;
        v_display_height = v_height;
    }

	w_width  = v_display_width < config->V_WIN_WIDTH-(2*config->V_WIN_BORDER) ? 
				config->V_WIN_WIDTH  :
				v_display_width  + (2*config->V_WIN_BORDER);
	w_height = v_display_height < config->V_WIN_HEIGHT-(2*config->V_WIN_BORDER)-config->V_MSG_STRIP_SIZE ? 
				config->V_WIN_HEIGHT : 
				v_display_height + (2*config->V_WIN_BORDER) + config->V_MSG_STRIP_SIZE ;
	
	w_width  += ( 2 * GetSystemMetrics(SM_CYFRAME) );
	w_height += ( 2 * GetSystemMetrics(SM_CYMENU)) + 
				( 2 * GetSystemMetrics(SM_CYFRAME)) +
				GetSystemMetrics(SM_CYCAPTION);

	SetWindowPos(hwnd,0,CW_USEDEFAULT, CW_USEDEFAULT, w_width, w_height, SWP_NOZORDER|SWP_NOMOVE);

	if(debug) { 
		printf("Frame::CheckMediaType xoffset = %d, yoffset = %d\n",  
					GetSystemMetrics(SM_CXFRAME) * 2,
	 				GetSystemMetrics(SM_CYMENU) + 
					GetSystemMetrics(SM_CYFRAME) + 
					GetSystemMetrics(SM_CYCAPTION) );	
		printf("Frame::CheckMediaType Video  %dx%d (bytes per pixel rgb %d )\n", v_width, v_height, pixelbytes);
		printf("Frame::CheckMediaType Window %dx%d \n", w_width, w_height);
	}

	RECT r;
	GetClientRect(hwnd, &r);
	c_width = r.right - r.left;
	c_height = r.bottom - r.top;

	if(debug) { 
		printf("Frame::CheckMediaType Client %dx%d \n", c_width, c_height);
		printf("Frame::CheckMediaType Client %d,%d %d,%d\n", r.right, r.left, r.bottom, r.top);
	}

	initResources();

	return  S_OK;
}
コード例 #29
0
QDesignerFormEditorInterface::QDesignerFormEditorInterface(QObject *parent)
    : QObject(parent),
      d(new QDesignerFormEditorInterfacePrivate())
{
    initResources();
}
コード例 #30
0
ファイル: parallaction_ns.cpp プロジェクト: CatalystG/scummvm
Common::Error Parallaction_ns::init() {

	_screenWidth = 320;
	_screenHeight = 200;

	if (getPlatform() == Common::kPlatformPC) {
		_disk = new DosDisk_ns(this);
	} else {
		if (getFeatures() & GF_DEMO) {
			strcpy(_location._name, "fognedemo");
		}
		_disk = new AmigaDisk_ns(this);
	}

	_disk->init();

	if (getPlatform() == Common::kPlatformPC) {
		_soundManI = new DosSoundMan_ns(this);
		_soundManI->setMusicVolume(ConfMan.getInt("music_volume"));
	} else {
		_soundManI = new AmigaSoundMan_ns(this);
	}

	_soundMan = new SoundMan(_soundManI);

	initResources();
	initFonts();
	_locationParser = new LocationParser_ns(this);
	_locationParser->init();
	_programParser = new ProgramParser_ns(this);
	_programParser->init();

	_cmdExec = new CommandExec_ns(this);
	_programExec = new ProgramExec_ns(this);

	_walker = new PathWalker_NS(this);

	_sarcophagusDeltaX = 0;
	_movingSarcophagus = false;
	_freeSarcophagusSlotX = INITIAL_FREE_SARCOPHAGUS_SLOT_X;

	num_foglie = 0;

	_intro = false;
	_inTestResult = false;

	_location._animations.push_front(_char._ani);

	_saveLoad = new SaveLoad_ns(this, _saveFileMan);

	initInventory();
	setupBalloonManager();

	_score = 1;

	_testResultLabels[0] = 0;
	_testResultLabels[1] = 0;

	Parallaction::init();

	return Common::kNoError;
}