本文整理汇总了C++中CState::Stop方法的典型用法代码示例。如果您正苦于以下问题:C++ CState::Stop方法的具体用法?C++ CState::Stop怎么用?C++ CState::Stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CState
的用法示例。
在下文中一共展示了CState::Stop方法的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: Pop_State
void CStateModule::Pop_State() {
// Get the State obj
CState* pCurState = Get_Current_State();
if( !pCurState ) {
Log(LOG_STATE, "No current state to pop in Pop_State()\n");
return;
}
DLog(LOG_STATE, "Popping State %d\n", pCurState->GetStateID());
// Stop the current State
pCurState->Stop();
// Pop it from the stack and delete
m_StateStack.pop_back();
delete pCurState;
// Get the new current State
pCurState = Get_Current_State();
// Resume it
pCurState->Resume();
}