コード例 #1
0
ファイル: Clock.cpp プロジェクト: orwell-int/server-game
void Clock::tick()
{
	if (m_isRunning)
	{
		tickInternal(boost::posix_time::microsec_clock::local_time());
	}
}
コード例 #2
0
ファイル: Clock.cpp プロジェクト: orwell-int/server-game
void Clock::tickDelta(boost::posix_time::time_duration const & iTickDuration)
{
	if (m_isRunning)
	{
		tickInternal(m_time + iTickDuration);
	}
}
コード例 #3
0
ファイル: BaseInstance.cpp プロジェクト: creepydragon/r2
void BaseInstance::tick(float deltaTime, float interpolation)
{
    pthread_mutex_lock(&m_canTickMutex);

    // Update event input state and get pending actions
    updateEvents(m_actions);

    // Execute callbacks bound to actions
    bool isValid = false;
    uint64 action = m_actions.pop(isValid);
    while(isValid)
    {
        executeAction(action);
        action = m_actions.pop(isValid);
    }

    m_activeScene->tick(deltaTime, interpolation);
    tickInternal(deltaTime, interpolation);

    m_uiManager->tick(deltaTime);

    if(m_debugUI)
    {
        m_debugUI->tick(getKeyCodesCount(), getKeyCodes());
        if(m_debugUI->isInputReady())
        {
            executeConsoleCommand(m_debugUI->consumeInput());
        }
    }

    // Reset keyboard input cache. Make sure to do this after last tick operation.
    resetKeyCodes();

    // Find visible actors only if draw thread is awaiting sync operation. Otherwise it would be a waste of time
    if(pthread_mutex_trylock(&m_canDrawMutex) > 0)
    {
        m_renderQueue.clear();
        m_activeScene->findVisibleActors(m_renderQueue);
        pthread_mutex_unlock(&m_canSyncMutex);
    }
    else
    {
        pthread_mutex_unlock(&m_canDrawMutex);
        pthread_mutex_unlock(&m_canTickMutex);
    }
}