SceneManage.cpp
上传用户:jalin138
上传日期:2022-02-12
资源大小:5720k
文件大小:1k
- #include "SceneManage.h"
- #include "State.h"
- #define _CRTDBG_MAP_ALLOC
- #include <crtdbg.h>
- #ifdef _DEBUG
- #define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
- #endif
- CSceneManage::CSceneManage(CState *_State)
- {
- int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
- tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
- _CrtSetDbgFlag( tmpFlag );
- m_pState = _State;
- }
- CSceneManage::~CSceneManage(void)
- {
- SAFE_DELETE( m_pState );
- }
- // 逻辑
- bool CSceneManage::Logic(void)
- {
- if ( NULL == m_pState )
- return false;
- if ( m_pState->Logic() )
- {
- return m_pState->Handle( this );
- }
- return false;
- }
- // 渲染
- void CSceneManage::Render(void)
- {
- if ( NULL == m_pState )
- return;
- m_pState->Render();
- }
- // 切换场景
- void CSceneManage::ChangeState(CState *_State)
- {
- //if ( NULL != m_pState )
- SAFE_DELETE( m_pState );
- m_pState = _State;
- }