void EditEffectDialog::onRangeButtonClicked (MyGUI::Widget* sender) { mEffect.mRange = (mEffect.mRange+1)%3; if (mEffect.mRange == ESM::RT_Self) mRangeButton->setCaptionWithReplacing ("#{sRangeSelf}"); else if (mEffect.mRange == ESM::RT_Target) mRangeButton->setCaptionWithReplacing ("#{sRangeTarget}"); else if (mEffect.mRange == ESM::RT_Touch) mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}"); // cycle through range types until we find something that's allowed if (mEffect.mRange == ESM::RT_Target && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTarget)) onRangeButtonClicked(sender); if (mEffect.mRange == ESM::RT_Self && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastSelf)) onRangeButtonClicked(sender); if (mEffect.mRange == ESM::RT_Touch && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch)) onRangeButtonClicked(sender); if(mEffect.mRange == ESM::RT_Self) { mAreaSlider->setScrollPosition(0); onAreaChanged(mAreaSlider,0); } updateBoxes(); eventEffectModified(mEffect); }
void EditEffectDialog::onRangeButtonClicked (MyGUI::Widget* sender) { mEffect.mRange = (mEffect.mRange+1)%3; // cycle through range types until we find something that's allowed // does not handle the case where nothing is allowed (this should be prevented before opening the Add Effect dialog) bool allowSelf = (mMagicEffect->mData.mFlags & ESM::MagicEffect::CastSelf) != 0; bool allowTouch = (mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch) && !mConstantEffect; bool allowTarget = (mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTarget) && !mConstantEffect; if (mEffect.mRange == ESM::RT_Self && !allowSelf) mEffect.mRange = (mEffect.mRange+1)%3; if (mEffect.mRange == ESM::RT_Touch && !allowTouch) mEffect.mRange = (mEffect.mRange+1)%3; if (mEffect.mRange == ESM::RT_Target && !allowTarget) mEffect.mRange = (mEffect.mRange+1)%3; if(mEffect.mRange == ESM::RT_Self) { mAreaSlider->setScrollPosition(0); onAreaChanged(mAreaSlider,0); } if (mEffect.mRange == ESM::RT_Self) mRangeButton->setCaptionWithReplacing ("#{sRangeSelf}"); else if (mEffect.mRange == ESM::RT_Target) mRangeButton->setCaptionWithReplacing ("#{sRangeTarget}"); else if (mEffect.mRange == ESM::RT_Touch) mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}"); updateBoxes(); eventEffectModified(mEffect); }
bool RenderObject::updateObjectState() { // Falls sich das Objekt verändert hat, muss der interne Zustand neu berechnet werden und evtl. Update-Regions für den nächsten Frame // registriert werden. if ((calcBoundingBox() != _oldBbox) || (_visible != _oldVisible) || (_x != _oldX) || (_y != _oldY) || (_z != _oldZ) || _refreshForced) { // Renderrang des Objektes neu bestimmen, da sich dieser verändert haben könnte if (_parentPtr.isValid()) _parentPtr->signalChildChange(); // Die Bounding-Box neu berechnen und Update-Regions registrieren. updateBoxes(); // Änderungen Validieren validateObject(); } // Dann muss der Objektstatus der Kinder aktualisiert werden. RENDEROBJECT_ITER it = _children.begin(); for (; it != _children.end(); ++it) if (!(*it)->updateObjectState()) return false; return true; }
void CLSValueSetpointEditor::setInputType(InputType newType) { if (type_ != newType) { type_ = newType; emit inputTypeChanged(type_); } updateBoxes(); }
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect) { mEffectImage->setImageTexture(MWBase::Environment::get().getWindowManager()->correctIconPath(effect->mIcon)); mEffectName->setCaptionWithReplacing("#{"+ESM::MagicEffect::effectIdToString (effect->mIndex)+"}"); mEffect.mEffectID = effect->mIndex; mMagicEffect = effect; updateBoxes(); }
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect) { mEffectImage->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon)); mEffectName->setCaptionWithReplacing("#{"+ESM::MagicEffect::effectIdToString (effect->mIndex)+"}"); mEffect.mEffectID = effect->mIndex; mMagicEffect = effect; updateBoxes(); }
void Player::updatePlayer() { float healthClock = clock.GetElapsedTime(); if(healthClock > 1) { // printf("HEALTH DOWN\n"); playerHealth -= 2; cout << playerHealth <<endl; clock.Reset(); } gravity(); getInput(); sprite.SetPosition(position); updateBoxes(); }
Player::Player(sf::Vector2f position,sf::RenderWindow* app) : Object(app)//custom constructor for the Player. { this->position= position; velocity.x = 0; velocity.y = 0; setSpriteImage("images/Player.png"); collideFloor = false; sprite.SetPosition(position); prevPosition = position; Object::objectInitialise(position); setCollisions(); updateBoxes(); exitHit=false; playerHealth=10; superJump=false; }
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect) { std::string icon = effect->mIcon; icon[icon.size()-3] = 'd'; icon[icon.size()-2] = 'd'; icon[icon.size()-1] = 's'; icon = "icons\\" + icon; mEffectImage->setImageTexture (icon); mEffectName->setCaptionWithReplacing("#{"+ESM::MagicEffect::effectIdToString (effect->mIndex)+"}"); mEffect.mEffectID = effect->mIndex; mMagicEffect = effect; updateBoxes(); }
void Player::move(float delta, std::vector<LevelObject*> levelObjects) { m_delta = delta; m_groundMarked = false; m_yVel += getGravityDistance(delta); float m_yMove = delta * m_yVel; m_yPos += m_yMove; updateBoxes(); for(unsigned int a = 0; a < levelObjects.size(); a++) { if(collidesWith(levelObjects[a])) { m_yPos -= m_yMove; if(m_yMove > 0.0f) { m_isOnGround = true; m_groundMarked = true; m_jumping = false; } updateBoxes(); m_yVel = 0.0f; break; } } if(!m_groundMarked) { m_isOnGround = false; } /* Set the x-speed */ if(m_knockedBack) { if(m_direction == DIR_LEFT) { m_xVel -= delta * SettingsManager::getSettings()->PLAYER_KNOCKBACK_SPEED_X_DECREASE; if(m_xVel <= 0.0f) { m_xVel = 0.0f; m_knockedBack = false; } } else if(m_direction == DIR_RIGHT) { m_xVel += delta * SettingsManager::getSettings()->PLAYER_KNOCKBACK_SPEED_X_DECREASE; if(m_xVel >= 0.0f) { m_xVel = 0.0f; m_knockedBack = false; } } float m_xMove = delta * m_xVel; m_xPos += m_xMove; for(unsigned int a = 0; a < levelObjects.size(); a++) { if(m_xVel == 0) { while(collidesWith(levelObjects[a])) { if(m_direction == DIR_LEFT) { m_xPos -= 1; } else if(m_direction == DIR_RIGHT) { m_xPos += 1; } updateBoxes(); } } else if(collidesWith(levelObjects[a])) { m_xPos -= m_xMove; m_xVel = 0.0f; updateBoxes(); break; } } updateBoxes(); } else { if(m_markedForHalt && !m_isBlocking) { if(m_xVel > 0.0f) { m_xVel -= SettingsManager::getSettings()->PLAYER_SPEED_SIDE_HALTING * delta; if(m_xVel < 0.0f){m_xVel = 0.0f;} float m_xMove = delta * m_xVel; m_xPos += m_xMove; updateBoxes(); for(unsigned int a = 0; a < levelObjects.size(); a++) { if(collidesWith(levelObjects[a])) { m_xPos -= m_xMove; m_xVel = 0.0f; updateBoxes(); break; } } } else { m_xVel += SettingsManager::getSettings()->PLAYER_SPEED_SIDE_HALTING * delta; if(m_xVel > 0.0f){m_xVel = 0.0f;} float m_xMove = delta * m_xVel; m_xPos += m_xMove; updateBoxes(); for(unsigned int a = 0; a < levelObjects.size(); a++) { if(collidesWith(levelObjects[a])) { m_xPos -= m_xMove; m_xVel = 0.0f; updateBoxes(); break; } } } } else if(!m_isBlocking) { float m_xMove = delta * m_xVel; m_xPos += m_xMove; updateBoxes(); for(unsigned int a = 0; a < levelObjects.size(); a++) { if(collidesWith(levelObjects[a])) { m_xPos -= m_xMove; m_xVel = 0.0f; updateBoxes(); break; } } } } updateBoxes(); }
void FITSHistogram::constructHistogram(int hist_width, int hist_height) { int id; double fits_w=0, fits_h=0; FITSImage *image_data = tab->getImage()->getImageData(); float *buffer = image_data->getImageBuffer(); image_data->getSize(&fits_w, &fits_h); image_data->getMinMax(&fits_min, &fits_max); int pixel_range = (int) (fits_max - fits_min); #ifdef HIST_LOG qDebug() << "fits MIN: " << fits_min << " - fits MAX: " << fits_max << " - pixel range: " << pixel_range; #endif if (hist_width > histArray.size()) histArray.resize(hist_width); cumulativeFreq.resize(histArray.size()); for (int i=0; i < hist_width; i++) { histArray[i] = 0; cumulativeFreq[i] = 0; } binWidth = ((double) hist_width / (double) pixel_range); //binRoundSize = (int) floor(binSize); #ifdef HIST_LOG qDebug() << "Hist Array is now " << hist_width << " wide..., pixel range is " << pixel_range << " Bin width is " << binWidth << endl; #endif if (binWidth == 0 || buffer == NULL) return; for (int i=0; i < fits_w * fits_h ; i++) { id = (int) round((buffer[i] - fits_min) * binWidth); if (id >= hist_width) id = hist_width - 1; //histArray[id]++; histArray[id]++; } // Cumuliative Frequency for (int i=0; i < histArray.size(); i++) for (int j=0; j <= i; j++) cumulativeFreq[i] += histArray[j]; mean = (image_data->getAverage()-fits_min)*binWidth; mean_p_std = (image_data->getAverage()-fits_min+image_data->getStdDev()*3)*binWidth; // Indicator of information content of an image in a typical star field. JMIndex = mean_p_std - mean; #ifdef HIST_LOG qDebug() << "Mean " << mean << " , mean plus std " << mean_p_std << " JMIndex " << JMIndex << endl; #endif // if (mean == 0) // JMIndex = 0; // Reject diffuse images by setting JMIndex to zero. if (mean && image_data->getMode() == FITS_NORMAL && mean_p_std / mean < 2) JMIndex =0; #ifdef HIST_LOG qDebug() << "Final JMIndex " << JMIndex << endl; #endif // Normalize histogram height. i.e. the maximum value will take the whole height of the widget histFactor = ((double) hist_height) / ((double) findMax(hist_width)); histogram_height = hist_height; histogram_width = hist_width; updateBoxes(fits_min, fits_max); ui->histFrame->update(); }
void HAlbumContext::setUserPlayCount(int a) { s_cachedUserPlayCount=a; updateBoxes(); }
void HAlbumContext::setListenerCount(int a) { s_cachedListenerCount=a; updateBoxes(); }