void CDummyVideoPlayer::Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) { if (g_advancedSettings.m_videoUseTimeSeeking && GetTotalTime() > 2000*g_advancedSettings.m_videoTimeSeekForwardBig) { int seek = 0; if (bLargeStep) seek = bPlus ? g_advancedSettings.m_videoTimeSeekForwardBig : g_advancedSettings.m_videoTimeSeekBackwardBig; else seek = bPlus ? g_advancedSettings.m_videoTimeSeekForward : g_advancedSettings.m_videoTimeSeekBackward; // do the seek SeekTime(GetTime() + seek * 1000); } else { float percent = GetPercentage(); if (bLargeStep) percent += bPlus ? g_advancedSettings.m_videoPercentSeekForwardBig : g_advancedSettings.m_videoPercentSeekBackwardBig; else percent += bPlus ? g_advancedSettings.m_videoPercentSeekForward : g_advancedSettings.m_videoPercentSeekBackward; if (percent >= 0 && percent <= 100) { // should be modified to seektime SeekPercentage(percent); } } }
void PAPlayer::Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) { if (!CanSeek()) return; __int64 seek; if (g_advancedSettings.m_musicUseTimeSeeking && GetTotalTime() > 2 * g_advancedSettings.m_musicTimeSeekForwardBig) { if (bLargeStep) seek = bPlus ? g_advancedSettings.m_musicTimeSeekForwardBig : g_advancedSettings.m_musicTimeSeekBackwardBig; else seek = bPlus ? g_advancedSettings.m_musicTimeSeekForward : g_advancedSettings.m_musicTimeSeekBackward; seek *= 1000; seek += GetTime(); } else { float percent; if (bLargeStep) percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForwardBig : (float)g_advancedSettings.m_musicPercentSeekBackwardBig; else percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForward : (float)g_advancedSettings.m_musicPercentSeekBackward; seek = (__int64)(GetTotalTime64() * (GetPercentage() + percent) / 100); } SeekTime(seek); }
void PAPlayer::Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) { if (!CanSeek()) return; long long seek; if (g_advancedSettings.m_musicUseTimeSeeking && m_playerGUIData.m_totalTime > 2 * g_advancedSettings.m_musicTimeSeekForwardBig) { if (bLargeStep) seek = bPlus ? g_advancedSettings.m_musicTimeSeekForwardBig : g_advancedSettings.m_musicTimeSeekBackwardBig; else seek = bPlus ? g_advancedSettings.m_musicTimeSeekForward : g_advancedSettings.m_musicTimeSeekBackward; seek *= 1000; seek += m_playerGUIData.m_time; } else { float percent; if (bLargeStep) percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForwardBig : (float)g_advancedSettings.m_musicPercentSeekBackwardBig; else percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForward : (float)g_advancedSettings.m_musicPercentSeekBackward; seek = static_cast<long long>(GetTotalTime64() * (GetPercentage() + percent) / 100); } SeekTime(seek); }
void GridLayeringDinf::BuildMultiFlowOutAngleArray(int*& compressed_dir, int*& connect_count, float*& p_output) { p_output[0] = CVT_FLT(n_valid_cells_); int counter = 1; for (int i = 0; i < n_rows_; i++) { for (int j = 0; j < n_cols_; j++) { int index = i * n_cols_ + j; if (pos_index_[index] < 0) continue; /// flow in cell's number p_output[counter++] = CVT_FLT(connect_count[index]); /// accumulated flow in directions int acc_flowin_dir = compressed_dir[index]; /// append the compressed index of flow in cells if (acc_flowin_dir & 1) { if (j != n_cols_ - 1 && compressed_dir[index + 1] != dir_nodata_) { p_output[counter++] = GetPercentage(angle_[index + 1], 0, 1);; } } if (acc_flowin_dir & 2) { if (i != n_rows_ - 1 && j != n_cols_ - 1 && compressed_dir[index + n_cols_ + 1] != dir_nodata_) { p_output[counter++] = GetPercentage(angle_[index + n_cols_ + 1], 1, 1); } } if (acc_flowin_dir & 4) { if (i != n_rows_ - 1 && compressed_dir[index + n_cols_] != dir_nodata_) { p_output[counter++] = GetPercentage(angle_[index + n_cols_], 1, 0); } } if (acc_flowin_dir & 8) { if (i != n_rows_ - 1 && j != 0 && compressed_dir[index + n_cols_ - 1] != dir_nodata_) { p_output[counter++] = GetPercentage(angle_[index + n_cols_ - 1], 1, -1); } } if (acc_flowin_dir & 16) { if (j != 0 && compressed_dir[index - 1] != dir_nodata_) { p_output[counter++] = GetPercentage(angle_[index - 1], 0, -1); } } if (acc_flowin_dir & 32) { if (i != 0 && j != 0 && compressed_dir[index - n_cols_ - 1] != dir_nodata_) { p_output[counter++] = GetPercentage(angle_[index - n_cols_ - 1], -1, -1); } } if (acc_flowin_dir & 64) { if (i != 0 && compressed_dir[index - n_cols_] != dir_nodata_) { p_output[counter++] = GetPercentage(angle_[index - n_cols_], -1, 0); } } if (acc_flowin_dir & 128) { if (i != 0 && j != n_cols_ - 1 && compressed_dir[index - n_cols_ + 1] != dir_nodata_) { p_output[counter++] = GetPercentage(angle_[index - n_cols_ + 1], -1, 1); } } } } }
// ======================================== GET INTERFACE VALUES ================================================== void TpartEditForm::GetValues() { def.sprite_tag = GetTag( 11801 ); def.ambient_sound_tag = GetTag( 11805 ); def.splash_local_projectile_group_tag = GetTag( 11807 ); def.minimum_view_distance = GetWorldDistance( 11809 ); def.transparency_rolloff_point = GetWorldDistance( 11810 ); def.transparency_cutoff_point = GetWorldDistance( 11811 ); def.number_of_particles = GetInt( 11812 ); def.scale = GetShortFixed( 11813 ); def.box_bottom_height = GetShortWorldDistance( 11901 ); def.box_top_height = GetShortWorldDistance( 11902 ); def.flags = 0; if(GetFlag( 11814 )) def.flags |= _particle_system_states_last_indefinitely_flag; if(GetFlag( 11815 )) def.flags |= _particle_system_does_not_affect_projectiles_flag; if(GetFlag( 11816 )) def.flags |= _particle_system_transparency_varies_with_distance_flag; if(GetFlag( 11900 )) def.flags |= _particle_system_aligns_to_direction_flag; def.y1_particle_number = GetShortFixed( 11817 ); def.x1_particle_number = GetShortFixed( 11818 ); def.x0_particle_number = GetShortFixed( 11819 ); def.y0_particle_number = GetShortFixed( 11820 ); def.velocity_lower_bound.i = GetFixed( 11821 ); def.velocity_delta.i = GetFixed( 11822) - def.velocity_lower_bound.i; def.velocity_lower_bound.j = GetFixed( 11823 ); def.velocity_delta.j = GetFixed( 11824 ) - def.velocity_lower_bound.j; def.velocity_lower_bound.k = GetFixed( 11825 ); def.velocity_delta.k = GetFixed( 11826 ) - def.velocity_lower_bound.k; def.state[_not_snowing].duration_lower_bound = GetInt( 11827 ) * TICKS_PER_SECOND; def.state[_not_snowing].duration_delta = (GetInt( 11828 ) * TICKS_PER_SECOND) - def.state[_not_snowing].duration_lower_bound; def.state[_not_snowing].value_lower_bound = GetPercentage( 11829 ); def.state[_not_snowing].value_delta = GetPercentage( 11830 ) - def.state[_not_snowing].value_lower_bound; def.state[_not_snowing].transition_lower_bound = GetInt( 11831 ) * TICKS_PER_SECOND; def.state[_not_snowing].transition_delta = (GetInt( 11832 ) * TICKS_PER_SECOND) - def.state[_not_snowing].transition_lower_bound; def.state[_snowing].duration_lower_bound = GetInt( 11833 ) * TICKS_PER_SECOND; def.state[_snowing].duration_delta = (GetInt( 11834 ) * TICKS_PER_SECOND) - def.state[_snowing].duration_lower_bound; def.state[_snowing].value_lower_bound = GetPercentage( 11835 ); def.state[_snowing].value_delta = GetPercentage( 11836 ) - def.state[_snowing].value_lower_bound; def.state[_snowing].transition_lower_bound = GetInt( 11837 ) * TICKS_PER_SECOND; def.state[_snowing].transition_delta = (GetInt( 11838 ) * TICKS_PER_SECOND) - def.state[_snowing].transition_lower_bound; }
float CGUISliderControl::GetProportion(RangeSelector selector /* = RangeSelectorLower */) const { if (m_iType == SPIN_CONTROL_TYPE_FLOAT) return (GetFloatValue(selector) - m_fStart) / (m_fEnd - m_fStart); else if (m_iType == SPIN_CONTROL_TYPE_INT) return (float)(GetIntValue(selector) - m_iStart) / (float)(m_iEnd - m_iStart); return 0.01f * GetPercentage(selector); }
void CGUISliderControl::SetFromPosition(const CPoint &point, bool guessSelector /* = false */) { float fPercent; if (m_orientation == HORIZONTAL) fPercent = (point.x - m_guiBackground.GetXPosition()) / m_guiBackground.GetWidth(); else fPercent = (m_guiBackground.GetYPosition() + m_guiBackground.GetHeight() - point.y) / m_guiBackground.GetHeight(); if (fPercent < 0) fPercent = 0; if (fPercent > 1) fPercent = 1; if (m_rangeSelection && guessSelector) { // choose selector which value is closer to value calculated from position if (fabs(GetPercentage(RangeSelectorLower) - 100 * fPercent) <= fabs(GetPercentage(RangeSelectorUpper) - 100 * fPercent)) m_currentSelector = RangeSelectorLower; else m_currentSelector = RangeSelectorUpper; } switch (m_iType) { case SLIDER_CONTROL_TYPE_FLOAT: { float fValue = m_fStart + (m_fEnd - m_fStart) * fPercent; SetFloatValue(fValue, m_currentSelector, true); break; } case SLIDER_CONTROL_TYPE_INT: { int iValue = (int)(m_iStart + (float)(m_iEnd - m_iStart) * fPercent + 0.49f); SetIntValue(iValue, m_currentSelector, true); break; } case SLIDER_CONTROL_TYPE_PERCENTAGE: default: { SetPercentage(fPercent * 100, m_currentSelector, true); break; } } SendClick(); }
void IDownloadTask::FireDownloadProgressUpdateEvent() { DownloadUpdateEventArgs args; IDownloader::GetInstance()->FireDownloadProgressUpdateEvent(GetType(), GetState(), GetPercentage(), GetOrigUrlID(), IsUploadTask()); }
bool Builder::BuildCoreLib(void) { if (QFileInfo(coreLib).exists()) { return true; } map <QString, BoardDef>::const_iterator board = config.boards.find(project->boardName); map <QString, BuildDef>::const_iterator bld = config.builds.find(board->second.build_core); if (bld == config.builds.end()) { msg.Add("Error getting build configuration for board " + project->boardName, mtError); return false; } //buildType = 1; progress->SetPhase(BuildWindowTypes::linkingCore); int oldPercent = GetPercentage(); SetPercentage(0); QString linkerPath = config.avrPath + "/avr-ar"; msg.AddOutput("Linking core lib for board :" + project->boardName, false); QStringList coreFiles = bld->second.coreLibs.split(";"); qDebug() << "Core Libs:" << bld->second.coreLibs; bool ok = true; for (int i=0; i < coreFiles.size(); i++) { coreFiles[i] = coreFiles[i].trimmed(); if (coreFiles[i] == "") { continue; } QString inputFile = config.DecodeMacros(coreFiles.at(i), project); if (GetCancel()) { msg.Add("Build cancelled by the user!", mtRegular); ok = false; break; } ok = ok && CompileFile (inputFile, false, false);//, true); if (ok) { QString outputFile = MangleFileName(inputFile); QStringList arguments; arguments << "rcs" << coreLib; arguments << outputFile; msg.buildStage = 2; ok = launcher->RunCommand(linkerPath, arguments); } SetPercentage(100 * i / coreFiles.size()); } SetPercentage(oldPercent); progress->SetPhase(BuildWindowTypes::compiling); //buildType = 0; return ok; }
void Slider::Update() { if(!mLocked) { mButton->Update(); // Keep the button in bounds if(mButton->GetCollisionBox().y < mFillRect.y - mButton->GetCollisionBox().h/2) mButton->SetY(mFillRect.y - mButton->GetCollisionBox().h/2); if(mButton->GetCollisionBox().y > mFillRect.y + mFillRect.h - mButton->GetCollisionBox().h/2) mButton->SetY(mFillRect.y + mFillRect.h - mButton->GetCollisionBox().h/2); GetPercentage(); } }
std::string ProgressBar::PrintProgress(double elapsed) { double remaining = ElapsedToRemaining(elapsed); std::string remaining_string = FormatRemaining(remaining); std::stringstream ss; ss << " " << message_ << ": " << progress_ << "/" << max_ << " (" << std::fixed << std::setprecision(2) << GetPercentage() << "%%), remaining: " << remaining_string << "."; std::string progress_bar = ProgressBarString(); size_t num_backspaces = bar_length_ + last_message_length_; printf("%s", std::string(num_backspaces, '\b').c_str()); printf("%s", progress_bar.c_str()); printf("%s", ss.str().c_str()); last_message_length_ = ss.str().length(); return ss.str(); }
/** Calculate tic percentages of total elapsed tics. Parameters: tic_delta - Difference of old and new value of the counter Parameters: tot_delta - Difference of old and new value of the total counter Parameters: inverse - Inverse the calculation Returns: Number of percent tic has taken of tot Created: 2007-06-11 09:15:00 Wraps the percentage calculation from scxmath in order to ignore border cases like when counter wraps or first time used in the provider. */ scxulong CPUInstance::GetPercentageSafe(const scxulong tic_delta, const scxulong tot_delta, const bool inverse /* = false */) const { return GetPercentage(0, tic_delta, 0, tot_delta, inverse); }