void Camera::keyMove() { m_mouseMove.flush(); //rMessage() << "keymove... "; float time_seconds = m_keycontrol_timer.elapsed_msec() / static_cast<float>(msec_per_sec); m_keycontrol_timer.start(); if (time_seconds > 0.05f) { time_seconds = 0.05f; // 20fps } keyControl(time_seconds * 5.0f); m_update(); GlobalCamera().movedNotify(); }
void CryptoManager::KeyHolderPlugins::attach(Attachment* att, Config* config) { MutexLockGuard g(holdersMutex, FB_FUNCTION); for (GetPlugins<IKeyHolderPlugin> keyControl(PluginType::KeyHolder, FB_KEYHOLDER_PLUGIN_VERSION, upInfo, config); keyControl.hasData(); keyControl.next()) { IKeyHolderPlugin* keyPlugin = keyControl.plugin(); LocalStatus st; if (keyPlugin->keyCallback(&st, att->att_crypt_callback) == 1) { // holder accepted attachment's key HolderAttachments* ha = NULL; for (unsigned i = 0; i < knownHolders.getCount(); ++i) { if (knownHolders[i] == keyPlugin) { ha = &knownHolders[i]; break; } } if (!ha) { ha = &(knownHolders.add()); ha->setPlugin(keyPlugin); } ha->registerAttachment(att); break; // Do not need >1 key from attachment to single DB } else if (!st.isSuccess()) { status_exception::raise(st.get()); } } }
void EventsManager::pollEvents(bool skipTimers) { if (checkForNextFrameCounter()) { nextFrame(); } if (checkForNextTimerUpdate() && !skipTimers) nextTimer(); _vm->_sound->checkSoundQueue(); _wheelUp = _wheelDown = false; Common::Event event; while (g_system->getEventManager()->pollEvent(event)) { switch (event.type) { case Common::EVENT_QUIT: case Common::EVENT_RTL: return; case Common::EVENT_KEYDOWN: // Check for debugger if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) { // Attach to the debugger _vm->_debugger->attach(); _vm->_debugger->onFrame(); } else { keyControl(event.kbd.keycode, true); } return; case Common::EVENT_KEYUP: keyControl(event.kbd.keycode, false); return; case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; _mouseCol = _mousePos.x / 8; _mouseRow = _mousePos.y / 8; break; case Common::EVENT_LBUTTONDOWN: _leftButton = true; return; case Common::EVENT_LBUTTONUP: _leftButton = false; return; case Common::EVENT_RBUTTONDOWN: _rightButton = true; return; case Common::EVENT_RBUTTONUP: _rightButton = false; return; case Common::EVENT_MBUTTONDOWN: _middleButton = true; return; case Common::EVENT_MBUTTONUP: _middleButton = false; return; case Common::EVENT_WHEELUP: _wheelUp = true; return; case Common::EVENT_WHEELDOWN: _wheelDown = true; return; default: break; } } }
void playScene01::update(void) { gameNode::update(); //키 조작 keyControl(); //페이즈에 따른 맵 이동 & 캐릭터 이동 phaseMove(_background.phase); //유닛 Y위치에 따른 정렬 std::sort(_vUnit.begin(), _vUnit.end(), compare); //! 아이템 정렬 std::sort(_vItem.begin(), _vItem.end(), icompare); for (int i = 0; i < _vUnit.size(); i++) { if (_vUnit[i]->getKind() == KIND_USER) _unitNum = i; } //유닛 업데이트 for (_viUnit = _vUnit.begin(); _viUnit != _vUnit.end(); ++_viUnit) { (*_viUnit)->update(); (*_viUnit)->setTarget(_vUnit[_unitNum]->getShadowX(), _vUnit[_unitNum]->getShadowY()); } //_unit->update(); if (_background.broken) _background.img = IMAGEMANAGER->findImage("background01_broken"); if (alpha < 255) alpha += 3; if (text) textChange(); //캐릭터 제거 for (_viUnit = _vUnit.begin(); _viUnit != _vUnit.end(); ++_viUnit) { if ((*_viUnit)->getHp() <= 0) { (*_viUnit)->remove(); _unitNum = 0; break; } } for (int i = 0; i < _vUnit.size(); i++) { if (_vUnit[i]->getKind() == KIND_USER) _unitNum = i; if (_vUnit[i]->getRemove() >= 100) { //죽으면 게임오버씬으로 if (_vUnit[i]->getKind()==KIND_USER) SCENEMANAGER->changeScene("gameOver"); //아이템 생성 if (_vUnit[i]->getX()>0 && _vUnit[i]->getX() < WINSIZEX) { item* it = new item; it->init(_vUnit[i]->getShadowX(), _vUnit[i]->getShadowY()); _vItem.push_back(it); } _vUnit.erase(_vUnit.begin() + i); } if (_background.phase == PHASE_02&&_vUnit[i]->getKind() == KIND_BOSS&&_vUnit[i]->getX() > WINSIZEX + 50) { _vUnit.erase(_vUnit.begin() + i); } } //! 아이템 업데이트 && 사라지게 for (_viItem = _vItem.begin(); _viItem != _vItem.end(); ++_viItem) { (*_viItem)->update(); } getItem(); if (_vItem.size() != 0) { for (int i = 0; i < _vItem.size(); i++) { if (_vItem[i]->removeItem()) _vItem.erase(_vItem.begin() + i); break; } } collision(); }