Exemplo n.º 1
0
void JniHelper::setJavaVM(JavaVM *javaVM)
{
    BEATS_ASSERT(javaVM != NULL, _T("Can't set java vm to null") );
    pthread_t thisthread = pthread_self();
    BEATS_PRINT("JniHelper::setJavaVM(%p), pthread_self() = %ld", javaVM, thisthread);
    _psJavaVM = javaVM;

    pthread_key_create(&g_key, nullptr);
}
Exemplo n.º 2
0
void CSceneManager::SwitchScene(const TString& strFileName)
{
    SceneSwithNotify();
#ifdef DEVELOP_VERSION
    uint32_t uStartTimeMS = (uint32_t)(CTimeMeter::GetCurrUSec() / 1000);
    BEATS_PRINT("Start switch scene at time %u\n", uStartTimeMS);
#endif
    BEATS_ASSERT(GetSwitchSceneState() == false);
    SetSwitchSceneState(true);
    uint32_t uNewSceneFileId = GetSceneFileId(strFileName);
    if (m_loadedScene.find(uNewSceneFileId) == m_loadedScene.end())
    {
        LoadScene(strFileName);
        BEYONDENGINE_CHECK_HEAP;
    }
    SetCurrentScene(m_loadedScene[uNewSceneFileId]);
    SetSwitchSceneState(false);
#ifdef DEVELOP_VERSION
    uint32_t uEndTimeMS = (uint32_t)(CTimeMeter::GetCurrUSec() / 1000);
    BEATS_PRINT("Finish switch scene at time %u, elapsed time :%u\n", uEndTimeMS, uEndTimeMS - uStartTimeMS);
#endif
}
Exemplo n.º 3
0
void CFSM<T>::PrintInfo()
{
    if (m_printInfo)
    {
        static EFSMRunType lastState = eFSMRT_ForceTo32Bit;
        if (lastState != m_runType)
        {
            TString state = m_runType == eFSMRT_Exit ? _T("Exiting") : 
                                m_runType == eFSMRT_Enter ? _T("Entering") : _T("Updating");
            BEATS_PRINT(_T("FSM: State %s is %s. FSM Owner: 0x%x\n"), m_stateNameForPrint.c_str(), state.c_str(), m_pOwner);
            lastState = m_runType;
        }
    }
}
Exemplo n.º 4
0
void CGame::SetTask( ETaskType type)
{
    BEATS_ASSERT(m_tasks.find(type) != m_tasks.end(), _T("Can't find task with type %d"), type);
    if (m_pCurTask != m_tasks[type])
    {
        if(m_pCurTask)
        {
            m_pCurTask->UnInit();
            BEATS_PRINT(_T("Change Game State From %s to %s\n"), TaskName[m_pCurTask->GetType()], TaskName[type]);
        }
        m_pCurTask = m_tasks[type];
        m_pCurTask->Init();
    }
}
Exemplo n.º 5
0
bool CGame::Update()
{
#ifdef _DEBUG
    m_deltaTimeMs = 16.6666f;//default ms for each frame.
    //CDebugTool::GetInstance()->PrintDebugMsg();
#else
    static DWORD lastRunningTime = timeGetTime();
    DWORD runningTime = timeGetTime();
    m_deltaTimeMs = (float)(runningTime - lastRunningTime);
    lastRunningTime = runningTime;
    BEATS_PRINT(_T("delta Time: %f\n"), m_deltaTimeMs);
#endif
    if (m_active)
    {
        ++m_frameCounter;
        BEATS_PERFORMDETECT_START(NBDT::ePT_RuntimePerformance);

        BEATS_PERFORMDETECT_START(NBDT::ePT_Input);
        CInputManager::GetInstance()->Update();
        BEATS_PERFORMDETECT_STOP(NBDT::ePT_Input);

        BEATS_PERFORMDETECT_START(NBDT::ePT_Render);
        CRenderManager::GetInstance()->Update(m_deltaTimeMs);
        BEATS_PERFORMDETECT_STOP(NBDT::ePT_Render);

        BEATS_PERFORMDETECT_START(NBDT::ePT_Physics);
        CPhysicsManager::GetInstance()->Update(m_deltaTimeMs);
        BEATS_PERFORMDETECT_STOP(NBDT::ePT_Physics);

        BEATS_PERFORMDETECT_START(NBDT::ePT_Object);
        CObjectManager::GetInstance()->Update(m_deltaTimeMs);
        BEATS_PERFORMDETECT_STOP(NBDT::ePT_Object);

        BEATS_PERFORMDETECT_START(NBDT::ePT_Task);
        if (m_pCurTask != NULL)
        {
            m_pCurTask->Update();
        }
        BEATS_PERFORMDETECT_STOP(NBDT::ePT_Task);

        BEATS_PERFORMDETECT_STOP(NBDT::ePT_RuntimePerformance);

        BEATS_PERFORMDETECT_RESET();
    }
    return m_active; 
}
Exemplo n.º 6
0
JavaVM* JniHelper::getJavaVM()
{
    pthread_t thisthread = pthread_self();
    BEATS_PRINT("JniHelper::getJavaVM(), pthread_self() = %ld", thisthread);
    return _psJavaVM;
}