本文整理汇总了C++中CState::Start方法的典型用法代码示例。如果您正苦于以下问题:C++ CState::Start方法的具体用法?C++ CState::Start怎么用?C++ CState::Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CState
的用法示例。
在下文中一共展示了CState::Start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Switch_State
// State control funcs
void CStateModule::Switch_State( DC_ID StateID ) {
if( StateID <= DC_INVALID_ID ) {
Log(LOG_STATE, "Invalid State ID to Switch_State(): %d\n", StateID);
return;
}
// Get the State obj
CState* pNewState = Create_State( StateID );
if( !pNewState ) {
Log(LOG_STATE, "Could not create State: %d\n", StateID);
return;
}
DLog(LOG_STATE, "Switching to State: %d\n", StateID);
// If we have a current State, stop it
CState* pCurState = Get_Current_State();
if( pCurState ) {
pCurState->Stop();
// Pop it from the stack
m_StateStack.pop_back();
// Delete the State obj
delete pCurState;
}
// Push the new State on top
m_StateStack.push_back( pNewState );
// Start the new State
pNewState->Start();
}
示例2: Push_State
void CStateModule::Push_State( DC_ID StateID ) {
if( StateID <= DC_INVALID_ID ) {
Log(LOG_STATE, "Invalid State ID to Push_State(): %d\n", StateID);
return;
}
// Get the State obj
CState* pNewState = Create_State( StateID );
if( !pNewState ) {
Log(LOG_STATE, "Could not create State: %d\n", StateID);
return;
}
DLog(LOG_STATE, "Pushing State %d\n", StateID);
// If we have a current State, pause it
CState* pCurState = Get_Current_State();
if( pCurState ) {
pCurState->Pause();
}
// Push the new State on top
m_StateStack.push_back( pNewState );
// Start the new State
pNewState->Start();
}