TEST_F(GameObjectTest, UpdateTest) { GameObjectComponentMock *component = new GameObjectComponentMock(); EXPECT_CALL(*component, onBeforeFirstUpdate()).Times(1); EXPECT_CALL(*component, onUpdate()).Times(1); gameObject.addComponent(component); gameObject.update(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->goButton, SIGNAL(clicked()), this, SLOT(onUpdate())); }
void WorkflowJSON_Impl::reset() { m_value.removeMember("started_at"); m_value.removeMember("completed_at"); m_value.removeMember("completed_status"); m_value.removeMember("current_step"); onUpdate(); }
void TargetWithSelection::onInit() { InternalMessage("Display","Entering TargetWithSelection::onInit") ; m_target = getObject()->getTrait<Implementation::Target>()->getView<Target>(getViewPoint()) ; m_target->_init() ; onUpdate() ; InternalMessage("Display","Leaving TargetWithSelection::onInit") ; }
void Selection::setSelectionEnd(qint64 time) { end = time; onUpdate(); emit selectionChanged(left, right); }
bool WorkflowJSON_Impl::setRunOptions(const RunOptions& options) { disconnectRunOptions(); m_runOptions = options; connectRunOptions(); onUpdate(); return true; }
void Map::Impl::onStyleImageMissing(const std::string& id, std::function<void()> done) { if (style->getImage(id) == nullptr) { observer.onStyleImageMissing(id); } done(); onUpdate(); }
bool WorkflowJSON_Impl::setWorkflowSteps(const std::vector<WorkflowStep>& workflowSteps) { disconnectSteps(); m_steps = workflowSteps; setMeasureTypes(); connectSteps(); onUpdate(); // onUpdate does not happen in setMeasureTypes return true; }
bool WorkflowJSON_Impl::addMeasurePath(const openstudio::path& path) { if (!m_value.isMember("measure_paths") || !m_value["measure_paths"].isArray()){ m_value["measure_paths"] = Json::Value(Json::arrayValue); } m_value["measure_paths"].append(toString(path)); onUpdate(); return true; }
void WorkflowJSON_Impl::start() { m_value["started_at"] = DateTime::nowUTC().toISO8601(); m_value["current_step"] = 0; for (auto& step : workflowSteps()){ step.resetResult(); } onUpdate(); }
void Entity::updateCurrent(sf::Time dt) { // Update self then update components onUpdate(dt); for (Component* component : components) { component->onUpdate(dt); } }
void Selection::setSelectionBegin(qint64 time) { begin = time; end = time; onUpdate(); emit selectionChanged(left, right); }
bool OpenGLRendererBase::receiveFrame(const VideoFrame& frame) { DPTR_D(OpenGLRendererBase); d.video_frame = frame; d.glv.setCurrentFrame(frame); onUpdate(); //can not call updateGL() directly because no event and paintGL() will in video thread return true; }
void Selection::hide() { if (!isVisible()) return; setVisible(false); onUpdate(); emit selectionChanged(-1, -1); }
void updateItems(Common& common) { for(std::size_t i = 0; i < items.size(); ++i) { std::unique_ptr<ItemBehavior> b(getItemBehavior(common, items[i])); b->onUpdate(*this, items[i]); } onUpdate(); }
void Node::setPosition(Ogre::Vector3 position, Node::RelativeTo rel) { if(mIsUpdatingAfterChange || !mIsEnabled) return; if(rel == PARENT || mParent == nullptr) { mPosition = position; } else { mPosition = mParent->getRotation() * position - mParent->getPosition(SCENE); } onUpdate(0); }
/** * Method is used to update particle system - update all particles. * @param elapsedTime is time between frames. */ void ParticleSystem::updateEffect(const float elapsedTime) { Particle* p = firstParticle; while(p) { //p->velocity += p->accelration * elapsedTime; p->position += p->velocity * elapsedTime; onUpdate(p, elapsedTime); p = p->next; } }
void Entity::update( float timeElapsed ) { // update the state of the entity onUpdate( timeElapsed ); // pass the request down the tree for ( Children::iterator it = m_children.begin(); it != m_children.end(); ++it ) { (*it)->update( timeElapsed ); } }
void Node::setRotation(Ogre::Quaternion rotation, Node::RelativeTo rel) { if(mIsUpdatingAfterChange || !mIsEnabled) return; if(rel == PARENT || mParent == nullptr) { mRotation = rotation; } else { // TODO: implement backward rotation mRotation = mParent->getRotation(SCENE) * (-rotation); } onUpdate(0); }
void Node::setScale(Ogre::Vector3 scale, Node::RelativeTo rel) { if(mIsUpdatingAfterChange || !mIsEnabled) return; if(rel == PARENT || mParent == nullptr) { mScale = scale; } else { Ogre::Vector3 p = mParent->getScale(SCENE); mScale = Ogre::Vector3(scale.x / p.x, scale.y / p.y, scale.z / p.z); } onUpdate(0); }
bool WorkflowJSON_Impl::checkForUpdates() { std::string h1 = hash(); std::string h2 = computeHash(); bool result = (h1 != h2); if (result){ onUpdate(); h2 = computeHash(); // recompute hash after updating timestamps in onUpdate m_value["hash"] = h2; } return result; }
bool WorkflowJSON_Impl::setOswPath(const openstudio::path& path, bool emitChange) { openstudio::path p = canonicalOrAbsolute(path); m_oswFilename = p.filename(); m_oswDir = p.parent_path(); setMeasureTypes(); if (emitChange){ onUpdate(); // onUpdate does not happen in setMeasureTypes } return true; }
void SWGameScene::update() { //! calculate count of fixed rate update tuint fixedCount = 0; m_physicsFrameRate += SWTime.getDeltaTime(); while ( m_physicsFrameRate >= SWPhysics2D.getFixedInterval() ) { m_physicsFrameRate -= SWPhysics2D.getFixedInterval(); fixedCount += 1; } //! fixed rate updates while ( fixedCount-- ) { onFixedRateUpdate(); for ( SWHardRef<SWRefNode> node = m_rootNode() ; node.isValid() ; ) { SWGameObject* go = (SWGameObject*)node()->ref(); node = node()->next(); if ( !go ) continue; if ( go->isActiveSelf() ) go->fixedRateUpdate(); } SWPhysics2D.simulate(); } //! regular updates { onUpdate(); for ( SWHardRef<SWRefNode> node = m_rootNode() ; node.isValid() ; ) { SWGameObject* go = (SWGameObject*)node()->ref(); node = node()->next(); if ( !go ) continue; if ( go->isActiveSelf() ) go->udpate(); } } //! post destroy game objects do { SWObject::Array iterateCopy; iterateCopy = m_destroyGOs; m_destroyGOs.clear(); SWObject::Array::iterator itor = iterateCopy.begin(); for ( ; itor != iterateCopy.end() ; ++itor ) { SWGameObject* go = swrtti_cast<SWGameObject>( (*itor)() ); if ( !go ) continue; go->destroyNow(); } } while ( m_destroyGOs.size() != 0 ); }
void KeyboardManager::onKeyUpdate(const EventCustom* event) { if (_pressedKeys == 0 || onUpdate == nullptr) { return; } for (auto iter = _mapping.begin(); iter != _mapping.end(); ++iter) { auto key = iter->second; if (_pressedKeys & static_cast<Keys>(key)) { onUpdate(key); } } }
//------------------------------------------------------------------------------------------------------------------ CiervaApp::CiervaApp() { mLog = Log::get(); // Inintialize log system Time::init(); // Init timers and delays // Prevent barometer from holding SPI Board::get()->digitalOn(40); // Create imu mImu = new Mpu6000Imu(); mImu ->init(); // mImu->calibrate(3000); // Init control bridge uint8_t deaultOutputChannels[6] = {12, 11, 8, 7, 6, 3}; mPilot = new GroundLiner(mImu); mBridge = new ControlBridge(RadioInput::get(), mPilot, deaultOutputChannels); // Initialize dataflash mDataflash = new Dataflash(); mDataflash->Init(); // Initialize data logger mDataLogger = new DataLogger(mDataflash); mDataLogger->addProvider(new AccelProvider(mImu)); mDataLogger->addProvider(new GyroProvider(mImu)); mDataLogger->addProvider(new RadioProvider()); // Activate 50Hz tasks PeriodicEvent<CiervaApp*>* servoCycle = new PeriodicEvent<CiervaApp*>(20); *servoCycle += mBridge; // Activate 200Hz tasks PeriodicEvent<CiervaApp*>* sampleCycle = new PeriodicEvent<CiervaApp*>(5); *sampleCycle += mDataLogger; //*sampleCycle += mPilot; onUpdate() += servoCycle; onUpdate() += sampleCycle; }
activityLogger::activityLogger(QWidget *parent) : QMainWindow(parent), ui(new Ui::activityLogger){ QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(onUpdate())); timer->start(10); this->setWindowIcon(QIcon(":/icon/icon.ico")); ui->setupUi(this); pause_offset=0; epoch=-1; loadActivities(); loadEntries(); foreach(QListWidgetItem item,activities){ ui->activityList->addItem(new QListWidgetItem(item.text())); }
bool View::update(const InputState & state) { std::list<View*> copy = m_children; copy.sort([](View* v1, View* v2) { return v1->z() > v2->z(); }); for (View* v : copy) { if (v->containsPoint(state.getCursor())) { if (v->update(state)) { return true; } } } return onUpdate(state); }
void System::Update(float dt) { accumulator += dt; if (updatetimer.Stopwatch(1000 / fps)) { // update inherited components onUpdate(accumulator); accumulator = 0; // reset the timer updatetimer.Reset(); } }
void Object::callUpdate(float dt) { if( layoutChanged ) updateLayout(); onUpdate(dt); for(Children::iterator it = children.begin(); it != children.end(); ++it) { Object * object = it->get(); if(object != NULL) object->callUpdate(dt); } }
void ApplicationContext::update() { if (_app_state == ApplicationLifeState::RUNNABLE) { _app_state = ApplicationLifeState::RUNNING; handleEvents(); handleTimers(); if (_app_state == ApplicationLifeState::RUNNING) onUpdate(); if (_app_state == ApplicationLifeState::RUNNING) _app_state = ApplicationLifeState::RUNNABLE; _last_update_time = System::getInstance()->getTime(); } }