本文整理汇总了C++中ChangeState函数的典型用法代码示例。如果您正苦于以下问题:C++ ChangeState函数的具体用法?C++ ChangeState怎么用?C++ ChangeState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ChangeState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAccountFromSender
void AccountActionsManager::handleChangeStatusRequested ()
{
auto action = qobject_cast<QAction*> (sender ());
const auto acc = GetAccountFromSender (sender (), Q_FUNC_INFO);
QVariant stateVar = action->property ("Azoth/TargetState");
EntryStatus status;
if (!stateVar.isNull ())
{
const auto state = stateVar.value<State> ();
status = EntryStatus (state, GetStatusText (action, state));
}
else
{
SetStatusDialog ssd (acc->GetAccountID ());
if (ssd.exec () != QDialog::Accepted)
return;
status = EntryStatus (ssd.GetState (), ssd.GetStatusText ());
}
acc->ChangeState (status);
}
示例2: ChangeState
void Engine::Update()
{
DeltaTime = m_DeltaTimer.restart();
TotalDeltaTime += DeltaTime;
if(m_QueuedState != nullptr)
ChangeState();
while(m_DisplayWindow.pollEvent(EventHandle))
{
if(EventHandle.type == sf::Event::KeyPressed && EventHandle.key.code == sf::Keyboard::Return && EventHandle.key.alt)
{
VID_FLAGS ^= sf::Style::Fullscreen;
m_DisplayWindow.create(sf::VideoMode(RESOLUTION.x, RESOLUTION.y), WINDOW_TITLE, VID_FLAGS);
}
if (EventHandle.type == sf::Event::Closed)
Quit();
}
if(m_CurrentState != nullptr)
m_CurrentState->Update(DeltaTime);
}
示例3: __ASSERT_DEBUG
void CBTHidConnection::OfferControlSocket(const TBTDevAddr& aAddress,
RSocket*& aSocket)
{
TRACE_FUNC
(_L("[BTHID]\tCBTHidConnection::OfferControlSocket"));
if (aAddress == iDevice->iAddress)
{
__ASSERT_DEBUG((iConnectionState == ELinkLost) || (iConnectionState == EHIDInitConnecting) ||
(iConnectionState == EHIDReconnecting),
User::Panic(KPanicBTConnection, ESocketsBadState));
// Take ownership of this socket
delete iControlSocket;
iControlSocket = aSocket;
aSocket = 0;
// Mark that the HID Device is reconnecting to us. Skip the state change if an initial connection from HID device.
if (iConnectionState != EHIDInitConnecting)
{
ChangeState(EHIDReconnecting);
}
}
}
示例4: SetDragState
void TCompGuiDrag::Over()
{
if (checkEnabled()) {
if (checkOver()) {
if (controller->IsGuiItemDragged()) {
SetDragState(Clicked);
}
else render_state = RSTATE_OVER;
if (controller->IsLeftPressed()) {
SetValue(value - 0.1f);
notifyValue();
}
else if (controller->IsRightPressed()) {
SetValue(value + 0.1f);
notifyValue();
}
}
else {
ChangeState(STRING(Enabled));
notifyOver(false);
}
}
}
示例5: ChangeState
void MyWorld::TakenTurn()
{
TurnsLeft--;
if (TurnsLeft < 0)
{
// Play end of round music
Audio::PlayMusic("game_over.mp3", false);
// Game over
ChangeState(eGameState_GameOver);
}
else
TurnsLeftChanged = true;
if (HasWon())
{
// Play end of round music
Audio::PlayMusic("end_round.mp3", false);
// Next round
NextRound();
}
}
示例6: if
void CAICoreEvent::Update(float _fTime)
{
if( !m_pCurrState )
return;
if( m_pCurrState->Update(_fTime) )
{
IAIState* pNewState = nullptr;
if( m_pCurrState == &m_cLaserPhase )
{
m_pTower->SetShieldActive(false);
pNewState = &m_cTurretPhase;
}
else if( m_pCurrState == &m_cTurretPhase )
pNewState = &m_cCoreFight;
if( pNewState )
ChangeState(pNewState);
else
CGame::GetInstance()->GetOF()->StopEvent(this);
}
}
示例7: ChangeState
void PhoenixEngine::ToggleLoading(bool bToggle)
{
sf::Context Cont;
if(m_LoadingState != nullptr)
{
if(bToggle)
{
bLoading = true;
m_QueuedState = m_LoadingState;
ChangeState();
m_DisplayWindow.setActive(false); //Give thread access to window context
sf::sleep(sf::milliseconds(100));
m_AsyncThread.launch();
}
else
{
bLoading = false;
m_AsyncThread.wait();
sf::sleep(sf::milliseconds(100));
m_DisplayWindow.setActive(true);
}
}
}
示例8: AddState
void CThrowBomb::onCreate(const TMsgEntityCreated& msg) {
if (statemap.empty()) {
//Specific Bomb nodes
AddState("born", (statehandler)&CThrowBomb::Born);
AddState("idle", (statehandler)&CThrowBomb::Idle);
AddState("throwing", (statehandler)&CThrowBomb::Throwing);
AddState("throwed", (statehandler)&CThrowBomb::Throwed);
AddState("impacted", (statehandler)&CThrowBomb::Impacted);
AddState("explode", (statehandler)&CThrowBomb::Explode);
AddState("dead", (statehandler)&CThrowBomb::Dead);
}
____TIMER_REDEFINE_(t_explode, 2.5f);
ChangeState("born");
#ifdef CALIBRATE_GAME
if (calibrate) {
lmax = lmax_st;
hmax = hmax_st;
speed = speed_st;
t_explode = timer_st;
rad_squared = powf(radius_st, 2.f);
}
#endif
}
示例9: if
void TodoList::on_confirmButton_clicked(){
QString name = ui->nameBox->text();
if(name.size() == 0){
warnAniTime = 30;
return;
}
TodoItem item;
item.SetName(name.toStdString());
item.SetPlace(ui->placeBox->text().toStdString());
item.SetContent(ui->contentBox->toPlainText().toStdString());
item.SetLabel(ui->labelBox->text().toStdString());
item.SetKind(ui->comboBox->currentIndex());
QDateTime dateTime = ui->dateTimeEdit->dateTime();
QDate date = dateTime.date();
QTime ti = dateTime.time();
item.SetTime(Date(date.year(),date.month(),date.day(),ti.hour(),ti.minute()));
item.SetWarnTime(ui->horizontalSlider->value() * 5); //以分为单位
int level = 0;
if (ui->radioButton_1->isChecked()) level = 3;
if (ui->radioButton_2->isChecked()) level = 1;
if (ui->radioButton_3->isChecked()) level = 2;
if (ui->radioButton_4->isChecked()) level = 0;
item.SetLevel(level);
if(state == WINSTATE::EDIT){
pa.AddTodo(item);
}else if(state == WINSTATE::DETAIL){
pa.ChangeTodo(item,selectID,viewDate.year,viewDate.month);
}
ChangeState(WINSTATE::LIST);
}
示例10: newPlaygroup
/**
* \brief determine initial tv state and playgroup for the recording
* \param islivetv: true if recording is livetv
*/
void PlayerContext::SetInitialTVState(bool islivetv)
{
TVState newState = kState_None;
QString newPlaygroup("Default");
LockPlayingInfo(__FILE__, __LINE__);
if (islivetv)
{
SetTVChain(new LiveTVChain());
newState = kState_WatchingLiveTV;
}
else if (playingInfo)
{
int overrecordseconds = gCoreContext->GetNumSetting("RecordOverTime");
QDateTime curtime = MythDate::current();
QDateTime recendts = playingInfo->GetRecordingEndTime()
.addSecs(overrecordseconds);
if (playingInfo->IsRecording())
{
newState = (curtime < recendts) ?
kState_WatchingRecording : kState_WatchingPreRecorded;
}
else if (playingInfo->IsVideoDVD())
newState = kState_WatchingDVD;
else if (playingInfo->IsVideoBD())
newState = kState_WatchingBD;
else
newState = kState_WatchingVideo;
newPlaygroup = playingInfo->GetPlaybackGroup();
}
UnlockPlayingInfo(__FILE__, __LINE__);
ChangeState(newState);
SetPlayGroup(newPlaygroup);
}
示例11: SetupZilla
int
SetupZilla(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u;
ANIMATOR DoActorDecide;
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,ZILLA_RUN_R0,s_ZillaRun[0]);
u->Health = 6000;
}
if (Skill == 0) u->Health = 2000;
if (Skill == 1) u->Health = 4000;
ChangeState(SpriteNum,s_ZillaRun[0]);
u->Attrib = &ZillaAttrib;
DoActorSetSpeed(SpriteNum, NORM_SPEED);
u->StateEnd = s_ZillaDie;
u->Rot = sg_ZillaRun;
EnemyDefaults(SpriteNum, &ZillaActionSet, &ZillaPersonality);
sp->clipdist = (512) >> 2;
sp->xrepeat = 97;
sp->yrepeat = 79;
//SET(u->Flags, SPR_XFLIP_TOGGLE);
return 0;
}
示例12: ChangeState
//*********************************************************************//
// Terminate
// - exit the current state
// - terminate the SGD wrappers
void Game::Terminate( void )
{
// Exit the current state
ChangeState( nullptr );
// Terminate & Deallocate the font
if( m_pFont != nullptr )
{
m_pFont->Terminate();
delete m_pFont;
}
SGD::GraphicsManager::GetInstance()->UnloadTexture(m_hMainMenuBackground);
SGD::GraphicsManager::GetInstance()->UnloadTexture(m_hPlayerImg);
SGD::GraphicsManager::GetInstance()->UnloadTexture(m_hEnemyImg);
// unloads audio
SGD::AudioManager::GetInstance()->UnloadAudio(m_hProjectileSecSfx);
SGD::AudioManager::GetInstance()->UnloadAudio(m_hBackgroundMus);
SGD::AudioManager::GetInstance()->UnloadAudio(m_hEnemyHitSfx);
SGD::AudioManager::GetInstance()->UnloadAudio(m_hGameOverSfx);
SGD::AudioManager::GetInstance()->UnloadAudio(m_hGameWinSfx);
SGD::AudioManager::GetInstance()->UnloadAudio(m_hMenuChangeSfx);
// Terminate the SGD wrappers (in reverse order)
SGD::AudioManager::GetInstance()->Terminate();
SGD::AudioManager::DeleteInstance();
SGD::InputManager::GetInstance()->Terminate();
SGD::InputManager::DeleteInstance();
SGD::GraphicsManager::GetInstance()->Terminate();
SGD::GraphicsManager::DeleteInstance();
}
示例13: ChangeState
void MyCharacter::OnEvent(const irr::SEvent & e)
{
//键盘事件
if (e.EventType == EET_KEY_INPUT_EVENT) {
if (
//按X 切换 站立 攻击准备模式
if (e.KeyInput.Key == KEY_KEY_X && e.KeyInput.PressedDown==false) {
ChangeState();
}
//按R 切换跑步走路 模式
if (e.KeyInput.Key == KEY_KEY_R && e.KeyInput.PressedDown==false) {
ChangeRunMode();
}
//按空格,捡物品
if (e.KeyInput.Key == KEY_SPACE && e.KeyInput.PressedDown==false) {
CollectDropItem();
}
//按Q 使用包裹里的MP恢复药
if (e.KeyInput.Key == KEY_KEY_Q && e.KeyInput.PressedDown==false) {
//请求使用装备包裹里的消耗品
property.cmd=CMD_C2S_Request_UsePackageHPItem;
cnet->SendMsg((char*)&property,sizeof(RoleProperty));
}
}
}
示例14: ELOG1
void CMMAVideoPlayer::CompletePrefetch(TInt aError)
{
ELOG1(EJavaMMAPI, "CMMAVideoPlayer::CompletePrefetch + error = %d",aError);
// Post KNotCompleteVideoError as KErrNone to the Java side, because
// video can be played.
if (aError == KNotCompleteVideoError)
{
LOG(EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch KNotCompleteVideoError ");
// release java
PostActionCompleted(KErrNone);
}
else
{
LOG(EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch CompleteVideoError ");
// release java
PostActionCompleted(aError);
}
if (aError == KErrNone || aError == KNotCompleteVideoError)
{
ChangeState(EPrefetched);
}
LOG(EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch - ");
}
示例15: ChatchChange
//=====================================================================================
//
// * Function : ChatchChange()
// * Description
// 이 함수는 WM_SPOOF에서 List View에 문자열들중 해당구조체가 어느 인덱스를 가지는지
// 출력하는 함수이다.
// 두번째 인자로 받는 포인터에 있는 자료구조의 내용을 사용하고 세번째 인자로
// PSPOOF_L자료구조 링크시스트의 헤더를 받도록 약속되어있다.
//
//=====================================================================================
INT ChatchChange(HWND hWnd, PSPOOF_L ARP_LIST, PSPOOF_L HEAD)
{
INT index=-1;
INT flag = 0;
PSPOOF_L tmp=HEAD;
while(tmp!=NULL)
{
index++;
if(memcmp(ARP_LIST->ipAddr,tmp->ipAddr,4)==0)
break;
tmp=tmp->next;
}
//scan flag changed
ChangeState();
InvalidateRect(hC2,NULL,TRUE);
SendMessage(hC2,WM_PAINT,0,0);
InvalidateRect(hC3,NULL,TRUE);
SendMessage(hC3,WM_PAINT,0,0);
return index;
}