📄 updateao.cpp
字号:
/*
* ============================================================================
* Name : CUpdateAO from UpdateAO.cpp
* Part of : Mopoid
* Created : 16.01.2004 by Andreas Jakl / Mopius - http://www.mopius.com/
* Description:
* Regularly updates the game view (if the game is active).
* Version : 1.02
* Copyright:
* 'Mopoid' is free software; you can redistribute
* it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 'Mopoid' is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with 'Mopoid'; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* ============================================================================
*/
#include "UpdateAO.h"
CUpdateAO::CUpdateAO(MUpdateAOCallback &aOwningObj, TInt aPriority)
: CActive(aPriority), iOwningObj(aOwningObj)
{
}
CUpdateAO::~CUpdateAO()
{
Cancel();
}
CUpdateAO* CUpdateAO::NewL(MUpdateAOCallback &owningObj, TInt aPriority)
{
CUpdateAO * self = new (ELeave) CUpdateAO(owningObj, aPriority);
CActiveScheduler::Add(self);
return(self);
}
void CUpdateAO::Start(void)
{
// reactivate in ActiveScheduler queue
Reactivate();
}
void CUpdateAO::Reactivate(void)
{
if (!IsActive())
{
// User::After(0); shouldn't be necessary -- basically gives other Active Objs a chance
SetActive();
// The following two lines simulate a request completion
// as if it were generated by a server. This completion will
// be processed by the active scheduler. If other events have
// completed belonging to higher-priority active objects, those
// will get processed first. Otherwise, our RunL() function
// will get called, allowing us to perform the next step in
// the calculation.
TRequestStatus* status = &iStatus; // iStatus inherited from CActive
User::RequestComplete(status, KErrNone);
}
}
void CUpdateAO::RunL(void)
{
// do main loop!
TBool callAgain = iOwningObj.RepeatedAction();
// reinsert in ActiveScheduler queue
if (callAgain)
Reactivate();
}
void CUpdateAO::DoCancel(void)
{
iOwningObj.CancelAsyncs();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -