void Display::update() { for(auto &iter : tileChanges_) { m_map[iter.first]=iter.second; /*if(isSeen_[iter.first]==true) no vision yet { mapSeen_[iter.first]=iter.second; updatePos(iter.first); }*/ updatePos(iter.first); } tileChanges_.clear(); for (auto &iter : m_map) { iter.second.update(); } if(reloadAll_) { for(auto &iter : m_map) { updatePos(iter.first); reloadAll_=false; } } }
bool EPGItem::setData( const vlc_epg_event_t *data ) { QDateTime newtime = QDateTime::fromTime_t( data->i_start ); QString newname = qfu( data->psz_name ); QString newdesc = qfu( data->psz_description ); QString newshortdesc = qfu( data->psz_short_description ); if ( m_start != newtime || m_name != newname || m_description != newdesc || m_shortDescription != newshortdesc || m_duration != data->i_duration ) { m_start = newtime; m_name = newname; setToolTip( newname ); m_description = newdesc; m_shortDescription = newshortdesc; setDuration( data->i_duration ); setRating( data->i_rating ); m_descitems.clear(); for( int i=0; i<data->i_description_items; i++ ) { m_descitems.append(QPair<QString, QString>( QString(data->description_items[i].psz_key), QString(data->description_items[i].psz_value))); } updatePos(); prepareGeometryChange(); return true; } return false; }
void ConnectorLine::sSetP2( QPoint point ) { prepareGeometryChange(); m_p2X = point.x(); m_p2Y = point.y(); updatePos(); }
void IGraphicsItem::restoreDefaultSize() { setAspectRatioMode(Qt::KeepAspectRatio); setSize(nativeSize()); update(); updatePos(); }
void IGraphicsItem::onWheelEvent(QGraphicsSceneWheelEvent *event) { if(!item_->isSelected()) return; int d = event->delta(); int w_delta; if(d >= 120) { w_delta = 10; } else if(d <= -120) { w_delta = -10; } else { return; } QSize s = size(); int w, h; if(aspectRatioMode() == Qt::KeepAspectRatio) { QSize n = nativeSize(); w = s.width() + w_delta; h = (w * n.height() + n.width()/2)/ n.width(); } else { w = s.width() + w_delta; h = (w * s.height() + s.width()/2)/ s.width(); } setSize(QSize(w, h)); update(); updatePos(); setGrabbersPosition(item_->boundingRect()); }
void updatePos(Node &node){ //std::cout << "call"; int xRes,yRes; Directions dir = node.dir; if(node.next != nullptr){ updatePos(*node.next); }else{ xRes = node.x; yRes = node.y; } switch(dir){ case UP: node.y += 1; break; case DOWN: node.y -= 1; break; case LEFT: node.x -= 1; break; case RIGHT: node.x += 1; break; } }
void Character::update() { // if close to target, snap to it and stop moving if (m_move && fabs(m_angle - m_tAngle) <= fabs(m_speed)) { m_angle = m_tAngle; m_move = false; updatePos(); } else if (m_move) { m_angle += m_speed; resetAngle(); updatePos(); } }
/* updates values needed from driver, pathfinder, etc. the are stored here, that we don't need to compute them several times or pass tons of parameters. */ void MyCar::update(TrackDesc* track, tCarElt* car, tSituation *situation) { updatePos(); updateDir(); updateSpeedSqr(); updateSpeed(); /* update currentsegment and destination segment id's */ int searchrange = MAX((int) ceil(situation->deltaTime*speed+1.0) * 2, 4); currentsegid = destsegid = pf->getCurrentSegment(car, searchrange); double l = 0.0; while (l < 2.0 * wheelbase) { l = l + pf->getPathSeg(destsegid)->getLength(); destsegid = (destsegid + 1 + pf->getnPathSeg()) % pf->getnPathSeg(); } currentseg = track->getSegmentPtr(currentsegid); destseg = track->getSegmentPtr(destsegid); currentpathseg = pf->getPathSeg(currentsegid); updateDError(); int lookahead = (destsegid + (int) (MIN(LOOKAHEAD_MAX_ERROR,derror)*speed*LOOKAHEAD_FACTOR)) % pf->getnPathSeg(); destpathseg = pf->getPathSeg(lookahead); mass = carmass + car->priv.fuel; trtime += situation->deltaTime; deltapitch = MAX(-track->getSegmentPtr(currentsegid)->getKgamma() - me->_pitch, 0.0); }
nsUISpacer* nsUISpacer::setup(){ p_lt_local=p_lt; p_lt_local.x+=space; updatePos(stroke_width); generateDraw(); return this; }
void GanttWidget::collapsed(const QModelIndex &index) { GanttInfoNode * node = m_model->nodeForIndex(index); node->setIsExpanded(false); return updatePos(node); }
bool CEnemy::update(float time_elapsed_ms,CNode * nodes) { if(!isDead()) { //update position updatePos(time_elapsed_ms); //if at each waypoint if(DistanceCheck()) { setCurrNode(&nodes[getNodeIndex()+1]); setNodeIndex(getNodeIndex()+1); //special check for end waypoint //if at the end waypoint if(getNodeIndex() == ENDNODE) { if(!isDead()) { setDead(true); } return true; //life minuses here //reset mob //change to wavemanager later // enemyArray[i].spawn(currType,currLevel); // enemyArray[i].setNodeIndex(0); // enemyArray[i].setPos(NodeArray[0].getPos()); } } } return false; }
void DutyUnit::resetCounters(const unsigned long oldCc) { if (nextPosUpdate == COUNTER_DISABLED) return; updatePos(oldCc); nextPosUpdate -= COUNTER_MAX; SoundUnit::resetCounters(oldCc); }
/*----------------------------------------------------------------------------- name : find description : find integer and decimal tokens, keep track of line and column parameters : ofstream& in, char* text, int token return : / exceptions : / algorithm : trivial -----------------------------------------------------------------------------*/ void ConstantsFinder::find( ofstream& out, char* lexText, int lexToken ){ string lexStr; lexStr += lexText; if( ( lexToken == integer ) || ( lexToken == decimal ) ){ out << "constant: '" << lexStr << "' at line " << getLine() << ", col " << getCol() << endl; } updatePos( lexStr ); }
void DutyUnit::resetCounters(unsigned long const oldCc) { if (nextPosUpdate_ == counter_disabled) return; updatePos(oldCc); nextPosUpdate_ -= counter_max; setCounter(); }
void DutyUnit::saveState(SaveState::SPU::Duty &dstate, unsigned long const cc) { updatePos(cc); setCounter(); dstate.nextPosUpdate = nextPosUpdate_; dstate.nr3 = freq() & 0xFF; dstate.pos = pos_; dstate.high = high_; }
void BubbleChatBox::setText(const QString &text) { chatLabel->setHtml(text); QString plainText = chatLabel->toPlainText(); if (plainText.isEmpty()) { return; } QFontMetrics fontMetrics(chatLabel->font()); int imageCount = text.count("</img>"); int width = qAbs(fontMetrics.width(plainText)) + imageCount * ChatFaceWidth; int lineCount = 1; if (width > PixelsPerLine) { lineCount = width / PixelsPerLine; if (lineCount >= MaxLineCount) { lineCount = MaxLineCount; } else if (width % PixelsPerLine != 0) { ++lineCount; } width = PixelsPerLine; } int boxWidth = width + fontMetrics.maxWidth(); if (boxWidth <= BoxMinWidth) { boxWidth = BoxMinWidth; chatLabel->setAlignment(Qt::AlignHCenter); } else { chatLabel->setAlignment(Qt::AlignLeft); } chatLabel->setTextWidth(boxWidth); QRectF oldRect = rect; int height = fontMetrics.lineSpacing() + fontMetrics.xHeight(); rect.setSize(QSize(boxWidth + BoxRightFrameWidth, height * lineCount + BoxFrameHeight)); chatLabel->setPos(QPointF(BoxLeftFrameWidth, rect.center().y() - (height * lineCount) + (lineCount - 1) * (height / 2) - (imageCount > 0 ? 1 : 0))); chatLabel->setBoundingRect(QRectF(0, 0, boxWidth, height * lineCount + (MaxLineCount - lineCount) * 1)); updatePos(); if (opacity() != 1) { appearAndDisappear->setDirection(QAbstractAnimation::Forward); appearAndDisappear->start(); } if (oldRect.width() > rect.width()) { QRectF sceneRect = mapRectToScene(oldRect); scene()->update(sceneRect); } else { update(); } timer.start(Config.BubbleChatBoxKeepSeconds * 1000 - AnimationDuration); }
bool User::teleport(double x, double y, double z) { buffer << (sint8)PACKET_PLAYER_POSITION_AND_LOOK << x << y << (double)0.0 << z << (float)0.f << (float)0.f << (sint8)0; //Also update pos for other players updatePos(x, y, z, 0); return true; }
void BWCombatLayer::update(float dt) { _fCombatTime += dt; updatePos(dt); BWUnitManager::shareBWUnitManager()->update(dt); updateBg(dt); updateCreateNpc(dt); }
void OtherCar::update() { updatePos(); updateDir(); updateSpeedSqr(); updateSpeed(); int searchrange = MAX((int) ceil(dt*speed+1.0) * 2, 4); currentsegid = track->getCurrentSegment(getCarPtr(), currentsegid, searchrange); }
bool QTrackerDirectSyncResult::next() { if (!cursor) { // The cursor may have been unreferenced because the connection was deleted // and now the user is calling next(), so set the row here updatePos(QSparql::AfterLastRow); return false; } GError * error = 0; const gboolean active = tracker_sparql_cursor_next(cursor, 0, &error); // if this is an ask query, get the result if (isBool() && active && tracker_sparql_cursor_get_value_type(cursor, 0) == TRACKER_SPARQL_VALUE_TYPE_BOOLEAN) { const gboolean value = tracker_sparql_cursor_get_boolean(cursor, 0); setBoolValue(value != FALSE); } if (error) { setLastError(QSparqlError(QString::fromUtf8(error->message), errorCodeToType(error->code), error->code)); g_error_free(error); qWarning() << "QTrackerDirectSyncResult:" << lastError() << query(); g_object_unref(cursor); cursor = 0; return false; } if (!active) { g_object_unref(cursor); cursor = 0; updatePos(QSparql::AfterLastRow); return false; } const int oldPos = pos(); if (oldPos == QSparql::BeforeFirstRow) updatePos(0); else updatePos(oldPos + 1); return true; }
// ********************************************************************************************************* void CDisplayerVisual::onPreActChanged() { //H_AUTO(R2_CDisplayerVisual_onPreActChanged) updatePos(); if (!isActiveInCurrentAct()) { if (getActive()) { setActive(false); } } }
// ********************************************************************************************************* void CDisplayerVisual::onActChanged() { //H_AUTO(R2_CDisplayerVisual_onActChanged) updatePos(); if (isActiveInCurrentAct()) { if (!getActive()) { setActive(true); } } }
// Updates Text status (such as position) void WinnerText::update() { // Update text position updatePos(); // Update text color updateColor(); // Recalculate verts if needed if (dirty) recalcVerts(); }
void TransparentScrollBarH::onResize(QResizeEvent* _e) { const auto x = Utils::scale_value(L::backgroundUpMargin_dip); const auto y = _e->size().height() - height() - Utils::scale_value(L::backgroundRightMargin_dip); const auto h = height(); const auto w = _e->size().width() - 2* Utils::scale_value(L::backgroundDownMargin_dip); move(x, y); resize(w, h); updatePos(); }
void OtherCar::init(TrackDesc* itrack, tCarElt* car, tSituation *situation) { track = itrack; dt = situation->deltaTime; setCarPtr(car); currentsegid = track->getCurrentSegment(car); initCGh(); updatePos(); updateDir(); updateSpeedSqr(); updateSpeed(); }
// 攻击状态 与 抢夺箱子状态要分离 // 控制敌方的位置 void Enemy::updateEnemyPos(float delta) { //AttackState::getInstance()->Execute(this); auto isBox = isBoxHere(); if (!isBox) { updateAvoidDrop(); updatePos(); } else { updateCloseToBox(); } }
void CTimeOSD::update(int position, int duration) { if(!visible) return; int percent = 0; if(duration > 100) percent = (unsigned char) (position / (duration / 100)); if(m_mode == CTimeOSD::MODE_ASC) update(position /* / 1000*/); else update((duration - position)/* / 1000 */); updatePos(percent); }
void SeekSlider::processReleasedButton() { if ( !isSliding && !isJumping ) return; isSliding = false; bool b_seekPending = seekLimitTimer->isActive(); seekLimitTimer->stop(); /* We're not sliding anymore: only last seek on release */ if ( isJumping ) { isJumping = false; return; } if( b_seekPending && isEnabled() ) updatePos(); }
void Enemy::update() { if (!m_atTargetNode) { updatePos(); //When close, jump to next node if (fabs(length(m_pos - m_targetNode)) <= m_speed) { m_pos = m_targetNode; m_atTargetNode = true; } } }
void Item::processTick(const Move* move) { Parent::processTick(move); // if (mCollisionObject && !--mCollisionTimeout) mCollisionObject = 0; // Warp to catch up to server if (delta.warpTicks > 0) { delta.warpTicks--; // Set new pos. MatrixF mat = mObjToWorld; mat.getColumn(3,&delta.pos); delta.pos += delta.warpOffset; mat.setColumn(3,delta.pos); Parent::setTransform(mat); // Backstepping delta.posVec.x = -delta.warpOffset.x; delta.posVec.y = -delta.warpOffset.y; delta.posVec.z = -delta.warpOffset.z; } else { if (isServerObject() && mAtRest && (mStatic == false && mDataBlock->sticky == false)) { if (++mAtRestCounter > csmAtRestTimer) { mAtRest = false; mAtRestCounter = 0; setMaskBits(PositionMask); } } if (!mStatic && !mAtRest && isHidden() == false) { updateVelocity(TickSec); updateWorkingCollisionSet(isGhost() ? sClientCollisionMask : sServerCollisionMask, TickSec); updatePos(isGhost() ? sClientCollisionMask : sServerCollisionMask, TickSec); } else { // Need to clear out last updatePos or warp interpolation delta.posVec.set(0,0,0); } } }