mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Changed most increment and decrement operators from postfix to prefix for es-core.
This commit is contained in:
parent
dd0f36f82b
commit
af52d9b0ac
|
@ -59,7 +59,7 @@ void AudioManager::init()
|
|||
sRequestedAudioFormat.callback = mixAudio;
|
||||
sRequestedAudioFormat.userdata = nullptr;
|
||||
|
||||
for (int i = 0; i < SDL_GetNumAudioDevices(0); i++) {
|
||||
for (int i = 0; i < SDL_GetNumAudioDevices(0); ++i) {
|
||||
LOG(LogInfo) << "Detected playback device: " << SDL_GetAudioDeviceName(i, 0);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ void AudioManager::mixAudio(void* /*unused*/, Uint8* stream, int len)
|
|||
sound->setPosition(sound->getPosition() + restLength);
|
||||
}
|
||||
// Advance to next sound.
|
||||
soundIt++;
|
||||
++soundIt;
|
||||
}
|
||||
|
||||
// Process video stream audio generated by VideoFFmpegComponent.
|
||||
|
@ -217,7 +217,7 @@ void AudioManager::registerSound(std::shared_ptr<Sound> sound)
|
|||
|
||||
void AudioManager::unregisterSound(std::shared_ptr<Sound> sound)
|
||||
{
|
||||
for (unsigned int i = 0; i < sSoundVector.size(); i++) {
|
||||
for (unsigned int i = 0; i < sSoundVector.size(); ++i) {
|
||||
if (sSoundVector.at(i) == sound) {
|
||||
sSoundVector[i]->stop();
|
||||
sSoundVector.erase(sSoundVector.cbegin() + i);
|
||||
|
@ -236,7 +236,7 @@ void AudioManager::play()
|
|||
void AudioManager::stop()
|
||||
{
|
||||
// Stop playing all Sounds.
|
||||
for (unsigned int i = 0; i < sSoundVector.size(); i++) {
|
||||
for (unsigned int i = 0; i < sSoundVector.size(); ++i) {
|
||||
if (sSoundVector.at(i)->isPlaying())
|
||||
sSoundVector[i]->stop();
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ CECInput::CECInput()
|
|||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < numAdapters; i++)
|
||||
for (int i = 0; i < numAdapters; ++i)
|
||||
LOG(LogDebug) << "CEC adapter: " << i << " path: " << adapters[i].strComPath
|
||||
<< " name: " << adapters[i].strComName;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ GuiComponent::GuiComponent(Window* window)
|
|||
, mEnabled(true)
|
||||
, mTransform(Renderer::getIdentity())
|
||||
{
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; i++)
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; ++i)
|
||||
mAnimationMap[i] = nullptr;
|
||||
}
|
||||
|
||||
|
@ -46,13 +46,13 @@ GuiComponent::~GuiComponent()
|
|||
if (mParent)
|
||||
mParent->removeChild(this);
|
||||
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->setParent(nullptr);
|
||||
}
|
||||
|
||||
bool GuiComponent::input(InputConfig* config, Input input)
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++) {
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i) {
|
||||
if (getChild(i)->input(config, input))
|
||||
return true;
|
||||
}
|
||||
|
@ -62,13 +62,13 @@ bool GuiComponent::input(InputConfig* config, Input input)
|
|||
|
||||
void GuiComponent::updateSelf(int deltaTime)
|
||||
{
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; i++)
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; ++i)
|
||||
advanceAnimation(i, deltaTime);
|
||||
}
|
||||
|
||||
void GuiComponent::updateChildren(int deltaTime)
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->update(deltaTime);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ void GuiComponent::render(const glm::mat4& parentTrans)
|
|||
|
||||
void GuiComponent::renderChildren(const glm::mat4& transform) const
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->render(transform);
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ void GuiComponent::removeChild(GuiComponent* cmp)
|
|||
|
||||
cmp->setParent(nullptr);
|
||||
|
||||
for (auto i = mChildren.cbegin(); i != mChildren.cend(); i++) {
|
||||
for (auto i = mChildren.cbegin(); i != mChildren.cend(); ++i) {
|
||||
if (*i == cmp) {
|
||||
mChildren.erase(i);
|
||||
return;
|
||||
|
@ -179,7 +179,7 @@ void GuiComponent::setOpacity(unsigned char opacity)
|
|||
return;
|
||||
|
||||
mOpacity = opacity;
|
||||
for (auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
|
||||
for (auto it = mChildren.cbegin(); it != mChildren.cend(); ++it)
|
||||
(*it)->setOpacity(opacity);
|
||||
}
|
||||
|
||||
|
@ -216,8 +216,8 @@ const glm::mat4& GuiComponent::getTransform()
|
|||
|
||||
void GuiComponent::textInput(const std::string& text)
|
||||
{
|
||||
for (auto iter = mChildren.cbegin(); iter != mChildren.cend(); iter++)
|
||||
(*iter)->textInput(text);
|
||||
for (auto it = mChildren.cbegin(); it != mChildren.cend(); ++it)
|
||||
(*it)->textInput(text);
|
||||
}
|
||||
|
||||
void GuiComponent::setAnimation(Animation* anim,
|
||||
|
@ -299,13 +299,13 @@ bool GuiComponent::advanceAnimation(unsigned char slot, unsigned int time)
|
|||
|
||||
void GuiComponent::stopAllAnimations()
|
||||
{
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; i++)
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; ++i)
|
||||
stopAnimation(i);
|
||||
}
|
||||
|
||||
void GuiComponent::cancelAllAnimations()
|
||||
{
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; i++)
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; ++i)
|
||||
cancelAnimation(i);
|
||||
}
|
||||
|
||||
|
@ -370,60 +370,60 @@ void GuiComponent::updateHelpPrompts()
|
|||
|
||||
void GuiComponent::onShow()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onShow();
|
||||
}
|
||||
|
||||
void GuiComponent::onHide()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onHide();
|
||||
}
|
||||
|
||||
void GuiComponent::onStopVideo()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onStopVideo();
|
||||
}
|
||||
|
||||
void GuiComponent::onPauseVideo()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onPauseVideo();
|
||||
}
|
||||
|
||||
void GuiComponent::onUnpauseVideo()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onUnpauseVideo();
|
||||
}
|
||||
|
||||
void GuiComponent::onScreensaverActivate()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onScreensaverActivate();
|
||||
}
|
||||
|
||||
void GuiComponent::onScreensaverDeactivate()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onScreensaverDeactivate();
|
||||
}
|
||||
|
||||
void GuiComponent::onGameLaunchedActivate()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onGameLaunchedActivate();
|
||||
}
|
||||
|
||||
void GuiComponent::onGameLaunchedDeactivate()
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->onGameLaunchedDeactivate();
|
||||
}
|
||||
|
||||
void GuiComponent::topWindow(bool isTop)
|
||||
{
|
||||
for (unsigned int i = 0; i < getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < getChildCount(); ++i)
|
||||
getChild(i)->topWindow(isTop);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ std::string HttpReq::urlEncode(const std::string& s)
|
|||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~";
|
||||
|
||||
std::string escaped = "";
|
||||
for (size_t i = 0; i < s.length(); i++) {
|
||||
for (size_t i = 0; i < s.length(); ++i) {
|
||||
if (unreserved.find_first_of(s[i]) != std::string::npos) {
|
||||
escaped.push_back(s[i]);
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ std::vector<unsigned char> ImageIO::loadFromMemoryRGBA32(const unsigned char* da
|
|||
// Loop through scanlines and add all pixel data to the return vector.
|
||||
// This is necessary, because width*height*bpp might not be == pitch.
|
||||
unsigned char* tempData = new unsigned char[width * height * 4];
|
||||
for (size_t i = 0; i < height; i++) {
|
||||
for (size_t i = 0; i < height; ++i) {
|
||||
const BYTE* scanLine = FreeImage_GetScanLine(fiBitmap, static_cast<int>(i));
|
||||
memcpy(tempData + (i * width * 4), scanLine, width * 4);
|
||||
}
|
||||
// Convert from BGRA to RGBA.
|
||||
for (size_t i = 0; i < width * height; i++) {
|
||||
for (size_t i = 0; i < width * height; ++i) {
|
||||
RGBQUAD bgra = reinterpret_cast<RGBQUAD*>(tempData)[i];
|
||||
RGBQUAD rgba;
|
||||
rgba.rgbBlue = bgra.rgbRed;
|
||||
|
@ -83,8 +83,8 @@ void ImageIO::flipPixelsVert(unsigned char* imagePx, const size_t& width, const
|
|||
{
|
||||
unsigned int temp;
|
||||
unsigned int* arr = reinterpret_cast<unsigned int*>(imagePx);
|
||||
for (size_t y = 0; y < height / 2; y++) {
|
||||
for (size_t x = 0; x < width; x++) {
|
||||
for (size_t y = 0; y < height / 2; ++y) {
|
||||
for (size_t x = 0; x < width; ++x) {
|
||||
temp = arr[x + (y * width)];
|
||||
arr[x + (y * width)] = arr[x + (height * width) - ((y + 1) * width)];
|
||||
arr[x + (height * width) - ((y + 1) * width)] = temp;
|
||||
|
|
|
@ -50,7 +50,7 @@ InputType InputConfig::stringToInputType(const std::string& type)
|
|||
|
||||
std::string InputConfig::toLower(std::string str)
|
||||
{
|
||||
for (unsigned int i = 0; i < str.length(); i++)
|
||||
for (unsigned int i = 0; i < str.length(); ++i)
|
||||
str[i] = static_cast<char>(tolower(str[i]));
|
||||
|
||||
return str;
|
||||
|
@ -121,8 +121,8 @@ std::vector<std::string> InputConfig::getMappedTo(Input input)
|
|||
std::vector<std::string> maps;
|
||||
|
||||
typedef std::map<std::string, Input>::const_iterator it_type;
|
||||
for (it_type iterator = mNameMap.cbegin(); iterator != mNameMap.cend(); iterator++) {
|
||||
Input chk = iterator->second;
|
||||
for (it_type it = mNameMap.cbegin(); it != mNameMap.cend(); ++it) {
|
||||
Input chk = it->second;
|
||||
|
||||
if (!chk.configured)
|
||||
continue;
|
||||
|
@ -130,10 +130,10 @@ std::vector<std::string> InputConfig::getMappedTo(Input input)
|
|||
if (chk.device == input.device && chk.type == input.type && chk.id == input.id) {
|
||||
if (input.type == TYPE_AXIS) {
|
||||
if (input.value == 0 || chk.value == input.value)
|
||||
maps.push_back(iterator->first);
|
||||
maps.push_back(it->first);
|
||||
}
|
||||
else {
|
||||
maps.push_back(iterator->first);
|
||||
maps.push_back(it->first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,14 +205,14 @@ void InputConfig::writeToXML(pugi::xml_node& parent)
|
|||
cfg.append_attribute("deviceGUID") = mDeviceGUID.c_str();
|
||||
|
||||
typedef std::map<std::string, Input>::const_iterator it_type;
|
||||
for (it_type iterator = mNameMap.cbegin(); iterator != mNameMap.cend(); iterator++) {
|
||||
if (!iterator->second.configured)
|
||||
for (it_type it = mNameMap.cbegin(); it != mNameMap.cend(); ++it) {
|
||||
if (!it->second.configured)
|
||||
continue;
|
||||
|
||||
pugi::xml_node input = cfg.append_child("input");
|
||||
input.append_attribute("name") = iterator->first.c_str();
|
||||
input.append_attribute("type") = inputTypeToString(iterator->second.type).c_str();
|
||||
input.append_attribute("id").set_value(iterator->second.id);
|
||||
input.append_attribute("value").set_value(iterator->second.value);
|
||||
input.append_attribute("name") = it->first.c_str();
|
||||
input.append_attribute("type") = inputTypeToString(it->second.type).c_str();
|
||||
input.append_attribute("id").set_value(it->second.id);
|
||||
input.append_attribute("value").set_value(it->second.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,11 +107,11 @@ void InputManager::init()
|
|||
int numJoysticks = SDL_NumJoysticks();
|
||||
|
||||
// Make sure that every joystick is actually supported by the GameController API.
|
||||
for (int i = 0; i < numJoysticks; i++)
|
||||
for (int i = 0; i < numJoysticks; ++i)
|
||||
if (!SDL_IsGameController(i))
|
||||
numJoysticks--;
|
||||
--numJoysticks;
|
||||
|
||||
for (int i = 0; i < numJoysticks; i++)
|
||||
for (int i = 0; i < numJoysticks; ++i)
|
||||
addControllerByDeviceIndex(nullptr, i);
|
||||
|
||||
SDL_USER_CECBUTTONDOWN = SDL_RegisterEvents(2);
|
||||
|
@ -126,7 +126,7 @@ void InputManager::deinit()
|
|||
if (!initialized())
|
||||
return;
|
||||
|
||||
for (auto it = mControllers.cbegin(); it != mControllers.cend(); it++)
|
||||
for (auto it = mControllers.cbegin(); it != mControllers.cend(); ++it)
|
||||
SDL_GameControllerClose(it->second);
|
||||
|
||||
mControllers.clear();
|
||||
|
@ -283,15 +283,15 @@ std::string InputManager::getTemporaryConfigPath()
|
|||
int InputManager::getNumConfiguredDevices()
|
||||
{
|
||||
int num = 0;
|
||||
for (auto it = mInputConfigs.cbegin(); it != mInputConfigs.cend(); it++)
|
||||
for (auto it = mInputConfigs.cbegin(); it != mInputConfigs.cend(); ++it)
|
||||
if (it->second->isConfigured())
|
||||
num++;
|
||||
++num;
|
||||
|
||||
if (mKeyboardInputConfig->isConfigured())
|
||||
num++;
|
||||
++num;
|
||||
|
||||
if (mCECInputConfig->isConfigured())
|
||||
num++;
|
||||
++num;
|
||||
|
||||
return num;
|
||||
}
|
||||
|
@ -663,10 +663,10 @@ void InputManager::addControllerByDeviceIndex(Window* window, int deviceIndex)
|
|||
int numAxes = SDL_JoystickNumAxes(joy);
|
||||
int numButtons = SDL_JoystickNumButtons(joy);
|
||||
|
||||
for (int axis = 0; axis < numAxes; axis++)
|
||||
for (int axis = 0; axis < numAxes; ++axis)
|
||||
mPrevAxisValues[std::make_pair(joyID, axis)] = 0;
|
||||
|
||||
for (int button = 0; button < numButtons; button++)
|
||||
for (int button = 0; button < numButtons; ++button)
|
||||
mPrevButtonValues[std::make_pair(joyID, button)] = -1;
|
||||
}
|
||||
|
||||
|
@ -691,7 +691,7 @@ void InputManager::removeControllerByJoystickID(Window* window, SDL_JoystickID j
|
|||
|
||||
// Delete mPrevAxisValues for the device.
|
||||
int axisEntries = static_cast<int>(mPrevAxisValues.size());
|
||||
for (int i = 0; i < axisEntries; i++) {
|
||||
for (int i = 0; i < axisEntries; ++i) {
|
||||
auto entry = mPrevAxisValues.find(std::make_pair(joyID, i));
|
||||
if (entry != mPrevAxisValues.end()) {
|
||||
mPrevAxisValues.erase(entry);
|
||||
|
@ -700,7 +700,7 @@ void InputManager::removeControllerByJoystickID(Window* window, SDL_JoystickID j
|
|||
|
||||
// Delete mPrevButtonValues for the device.
|
||||
int buttonEntries = static_cast<int>(mPrevButtonValues.size());
|
||||
for (int i = 0; i < buttonEntries; i++) {
|
||||
for (int i = 0; i < buttonEntries; ++i) {
|
||||
auto entry = mPrevButtonValues.find(std::make_pair(joyID, i));
|
||||
if (entry != mPrevButtonValues.end()) {
|
||||
mPrevButtonValues.erase(entry);
|
||||
|
|
|
@ -37,9 +37,9 @@ namespace Scripting
|
|||
if (Utils::FileSystem::exists(scriptDir))
|
||||
scriptDirList.push_back(scriptDir);
|
||||
|
||||
for (auto dirIt = scriptDirList.cbegin(); dirIt != scriptDirList.cend(); dirIt++) {
|
||||
for (auto dirIt = scriptDirList.cbegin(); dirIt != scriptDirList.cend(); ++dirIt) {
|
||||
std::list<std::string> scripts = Utils::FileSystem::getDirContent(*dirIt);
|
||||
for (auto it = scripts.cbegin(); it != scripts.cend(); it++) {
|
||||
for (auto it = scripts.cbegin(); it != scripts.cend(); ++it) {
|
||||
std::string arg1Quotation;
|
||||
std::string arg2Quotation;
|
||||
// Add quotation marks around the arguments as long as these are not already
|
||||
|
|
|
@ -312,16 +312,16 @@ void Settings::setDefaults()
|
|||
template <typename K, typename V>
|
||||
void saveMap(pugi::xml_document& doc, std::map<K, V>& map, const std::string& type)
|
||||
{
|
||||
for (auto iter = map.cbegin(); iter != map.cend(); iter++) {
|
||||
for (auto it = map.cbegin(); it != map.cend(); ++it) {
|
||||
// Key is on the "don't save" list, so don't save it.
|
||||
if (std::find(settingsSkipSaving.cbegin(), settingsSkipSaving.cend(), iter->first) !=
|
||||
if (std::find(settingsSkipSaving.cbegin(), settingsSkipSaving.cend(), it->first) !=
|
||||
settingsSkipSaving.cend()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pugi::xml_node node = doc.append_child(type.c_str());
|
||||
node.append_attribute("name").set_value(iter->first.c_str());
|
||||
node.append_attribute("value").set_value(iter->second.second);
|
||||
node.append_attribute("name").set_value(it->first.c_str());
|
||||
node.append_attribute("value").set_value(it->second.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,10 +337,10 @@ void Settings::saveFile()
|
|||
saveMap<std::string, std::pair<int, int>>(doc, mIntMap, "int");
|
||||
saveMap<std::string, std::pair<float, float>>(doc, mFloatMap, "float");
|
||||
|
||||
for (auto iter = mStringMap.cbegin(); iter != mStringMap.cend(); iter++) {
|
||||
for (auto it = mStringMap.cbegin(); it != mStringMap.cend(); ++it) {
|
||||
pugi::xml_node node = doc.append_child("string");
|
||||
node.append_attribute("name").set_value(iter->first.c_str());
|
||||
node.append_attribute("value").set_value(iter->second.second.c_str());
|
||||
node.append_attribute("name").set_value(it->first.c_str());
|
||||
node.append_attribute("value").set_value(it->second.second.c_str());
|
||||
}
|
||||
|
||||
#if defined(_WIN64)
|
||||
|
|
|
@ -378,7 +378,7 @@ void ThemeData::parseVariables(const pugi::xml_node& root)
|
|||
if (!variables)
|
||||
return;
|
||||
|
||||
for (pugi::xml_node_iterator it = variables.begin(); it != variables.end(); it++) {
|
||||
for (pugi::xml_node_iterator it = variables.begin(); it != variables.end(); ++it) {
|
||||
std::string key = it->name();
|
||||
std::string val = it->text().as_string();
|
||||
|
||||
|
@ -641,7 +641,7 @@ std::vector<GuiComponent*> ThemeData::makeExtras(const std::shared_ptr<ThemeData
|
|||
return comps;
|
||||
|
||||
for (auto it = viewIt->second.orderedKeys.cbegin(); // Line break.
|
||||
it != viewIt->second.orderedKeys.cend(); it++) {
|
||||
it != viewIt->second.orderedKeys.cend(); ++it) {
|
||||
ThemeElement& elem = viewIt->second.elements.at(*it);
|
||||
if (elem.extra) {
|
||||
GuiComponent* comp = nullptr;
|
||||
|
@ -684,14 +684,14 @@ std::map<std::string, ThemeSet> ThemeData::getThemeSets()
|
|||
Utils::FileSystem::getHomePath() + "/.emulationstation/themes"
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < pathCount; i++) {
|
||||
for (size_t i = 0; i < pathCount; ++i) {
|
||||
if (!Utils::FileSystem::isDirectory(paths[i]))
|
||||
continue;
|
||||
|
||||
Utils::FileSystem::stringList dirContent = Utils::FileSystem::getDirContent(paths[i]);
|
||||
|
||||
for (Utils::FileSystem::stringList::const_iterator it = dirContent.cbegin();
|
||||
it != dirContent.cend(); it++) {
|
||||
it != dirContent.cend(); ++it) {
|
||||
if (Utils::FileSystem::isDirectory(*it)) {
|
||||
ThemeSet set = {*it};
|
||||
sets[set.getName()] = set;
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
void setFiles(const std::deque<std::string>& deque)
|
||||
{
|
||||
*this << "From theme \"" << deque.front() << "\"";
|
||||
for (auto it = deque.cbegin() + 1; it != deque.cend(); it++)
|
||||
for (auto it = deque.cbegin() + 1; it != deque.cend(); ++it)
|
||||
*this << " -> \"" << (*it) << "\"";
|
||||
}
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ void Window::pushGui(GuiComponent* gui)
|
|||
|
||||
void Window::removeGui(GuiComponent* gui)
|
||||
{
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++) {
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); ++it) {
|
||||
if (*it == gui) {
|
||||
it = mGuiStack.erase(it);
|
||||
|
||||
|
@ -143,7 +143,7 @@ bool Window::init()
|
|||
void Window::deinit()
|
||||
{
|
||||
// Hide all GUI elements on uninitialisation - this disable.
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++)
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); ++it)
|
||||
(*it)->onHide();
|
||||
|
||||
#if defined(USE_OPENGL_21)
|
||||
|
@ -310,7 +310,7 @@ void Window::update(int deltaTime)
|
|||
}
|
||||
|
||||
mFrameTimeElapsed += deltaTime;
|
||||
mFrameCountElapsed++;
|
||||
++mFrameCountElapsed;
|
||||
if (mFrameTimeElapsed > 500) {
|
||||
mAverageDeltaTime = mFrameTimeElapsed / mFrameCountElapsed;
|
||||
|
||||
|
@ -646,7 +646,7 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
|
|||
|
||||
std::map<std::string, bool> inputSeenMap;
|
||||
std::map<std::string, int> mappedToSeenMap;
|
||||
for (auto it = prompts.cbegin(); it != prompts.cend(); it++) {
|
||||
for (auto it = prompts.cbegin(); it != prompts.cend(); ++it) {
|
||||
// Only add it if the same icon hasn't already been added.
|
||||
if (inputSeenMap.emplace(it->first, true).second) {
|
||||
// This symbol hasn't been seen yet, what about the action name?
|
||||
|
@ -697,7 +697,7 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
|
|||
aVal = i;
|
||||
if (b.first == map[i])
|
||||
bVal = i;
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
|
||||
return aVal > bVal;
|
||||
|
@ -727,7 +727,7 @@ void Window::startScreensaver()
|
|||
{
|
||||
if (mScreensaver && !mRenderScreensaver) {
|
||||
// Tell the GUI components the screensaver is starting.
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++)
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); ++it)
|
||||
(*it)->onScreensaverActivate();
|
||||
|
||||
setAllowTextScrolling(false);
|
||||
|
@ -744,7 +744,7 @@ bool Window::stopScreensaver()
|
|||
setAllowTextScrolling(true);
|
||||
|
||||
// Tell the GUI components the screensaver has stopped.
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++) {
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); ++it) {
|
||||
(*it)->onScreensaverDeactivate();
|
||||
// If the menu is open, pause the video so it won't start playing beneath the menu.
|
||||
if (mGuiStack.front() != mGuiStack.back())
|
||||
|
@ -799,9 +799,9 @@ void Window::closeLaunchScreen()
|
|||
mRenderLaunchScreen = false;
|
||||
}
|
||||
|
||||
void Window::increaseVideoPlayerCount() { mVideoPlayerCount++; }
|
||||
void Window::increaseVideoPlayerCount() { ++mVideoPlayerCount; }
|
||||
|
||||
void Window::decreaseVideoPlayerCount() { mVideoPlayerCount--; }
|
||||
void Window::decreaseVideoPlayerCount() { --mVideoPlayerCount; }
|
||||
|
||||
int Window::getVideoPlayerCount()
|
||||
{
|
||||
|
@ -813,7 +813,7 @@ int Window::getVideoPlayerCount()
|
|||
void Window::setLaunchedGame()
|
||||
{
|
||||
// Tell the GUI components that a game has been launched.
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++)
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); ++it)
|
||||
(*it)->onGameLaunchedActivate();
|
||||
|
||||
mGameLaunchedState = true;
|
||||
|
@ -822,7 +822,7 @@ void Window::setLaunchedGame()
|
|||
void Window::unsetLaunchedGame()
|
||||
{
|
||||
// Tell the GUI components that the user is back in ES-DE again.
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++)
|
||||
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); ++it)
|
||||
(*it)->onGameLaunchedDeactivate();
|
||||
|
||||
mGameLaunchedState = false;
|
||||
|
|
|
@ -24,7 +24,7 @@ void AnimatedImageComponent::load(const AnimationDef* def)
|
|||
|
||||
assert(def->frameCount >= 1);
|
||||
|
||||
for (size_t i = 0; i < def->frameCount; i++) {
|
||||
for (size_t i = 0; i < def->frameCount; ++i) {
|
||||
if (def->frames[i].path != "" &&
|
||||
!ResourceManager::getInstance()->fileExists(def->frames[i].path)) {
|
||||
LOG(LogError) << "Missing animation frame " << i << " (\"" << def->frames[i].path
|
||||
|
@ -54,7 +54,7 @@ void AnimatedImageComponent::reset()
|
|||
|
||||
void AnimatedImageComponent::onSizeChanged()
|
||||
{
|
||||
for (auto it = mFrames.cbegin(); it != mFrames.cend(); it++) {
|
||||
for (auto it = mFrames.cbegin(); it != mFrames.cend(); ++it) {
|
||||
it->first->setResize(mSize.x, mSize.y);
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ void AnimatedImageComponent::update(int deltaTime)
|
|||
mFrameAccumulator += deltaTime;
|
||||
|
||||
while (mFrames.at(mCurrentFrame).second <= mFrameAccumulator) {
|
||||
mCurrentFrame++;
|
||||
++mCurrentFrame;
|
||||
|
||||
if (mCurrentFrame == static_cast<int>(mFrames.size())) {
|
||||
if (mLoop) {
|
||||
|
@ -76,7 +76,7 @@ void AnimatedImageComponent::update(int deltaTime)
|
|||
}
|
||||
else {
|
||||
// Done, stop at last frame.
|
||||
mCurrentFrame--;
|
||||
--mCurrentFrame;
|
||||
mEnabled = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ ComponentGrid::ComponentGrid(Window* window, const glm::ivec2& gridDimensions)
|
|||
mColWidths = new float[gridDimensions.x];
|
||||
mRowHeights = new float[gridDimensions.y];
|
||||
|
||||
for (int x = 0; x < gridDimensions.x; x++)
|
||||
for (int x = 0; x < gridDimensions.x; ++x)
|
||||
mColWidths[x] = 0;
|
||||
for (int y = 0; y < gridDimensions.y; y++)
|
||||
for (int y = 0; y < gridDimensions.y; ++y)
|
||||
mRowHeights[y] = 0;
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,10 @@ float ComponentGrid::getColWidth(int col)
|
|||
// Calculate automatic width.
|
||||
float freeWidthPerc = 1;
|
||||
int between = 0;
|
||||
for (int x = 0; x < mGridSize.x; x++) {
|
||||
for (int x = 0; x < mGridSize.x; ++x) {
|
||||
freeWidthPerc -= mColWidths[x]; // If it's 0 it won't do anything.
|
||||
if (mColWidths[x] == 0)
|
||||
between++;
|
||||
++between;
|
||||
}
|
||||
|
||||
return (freeWidthPerc * mSize.x) / static_cast<float>(between);
|
||||
|
@ -65,10 +65,10 @@ float ComponentGrid::getRowHeight(int row)
|
|||
// Calculate automatic height.
|
||||
float freeHeightPerc = 1;
|
||||
int between = 0;
|
||||
for (int y = 0; y < mGridSize.y; y++) {
|
||||
for (int y = 0; y < mGridSize.y; ++y) {
|
||||
freeHeightPerc -= mRowHeights[y]; // If it's 0 it won't do anything.
|
||||
if (mRowHeights[y] == 0)
|
||||
between++;
|
||||
++between;
|
||||
}
|
||||
|
||||
return (freeHeightPerc * mSize.y) / static_cast<float>(between);
|
||||
|
@ -122,7 +122,7 @@ void ComponentGrid::setEntry(const std::shared_ptr<GuiComponent>& comp,
|
|||
|
||||
bool ComponentGrid::removeEntry(const std::shared_ptr<GuiComponent>& comp)
|
||||
{
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++) {
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||
if (it->component == comp) {
|
||||
removeChild(comp.get());
|
||||
mCells.erase(it);
|
||||
|
@ -137,9 +137,9 @@ void ComponentGrid::updateCellComponent(const GridEntry& cell)
|
|||
{
|
||||
// Size.
|
||||
glm::vec2 size{0.0f};
|
||||
for (int x = cell.pos.x; x < cell.pos.x + cell.dim.x; x++)
|
||||
for (int x = cell.pos.x; x < cell.pos.x + cell.dim.x; ++x)
|
||||
size.x += getColWidth(x);
|
||||
for (int y = cell.pos.y; y < cell.pos.y + cell.dim.y; y++)
|
||||
for (int y = cell.pos.y; y < cell.pos.y + cell.dim.y; ++y)
|
||||
size.y += getRowHeight(y);
|
||||
|
||||
if (cell.resize && size != glm::vec2{} && cell.component->getSize() != size)
|
||||
|
@ -147,9 +147,9 @@ void ComponentGrid::updateCellComponent(const GridEntry& cell)
|
|||
|
||||
// Find top left corner.
|
||||
glm::vec3 pos{};
|
||||
for (int x = 0; x < cell.pos.x; x++)
|
||||
for (int x = 0; x < cell.pos.x; ++x)
|
||||
pos.x += getColWidth(x);
|
||||
for (int y = 0; y < cell.pos.y; y++)
|
||||
for (int y = 0; y < cell.pos.y; ++y)
|
||||
pos.y += getRowHeight(y);
|
||||
|
||||
// Center component.
|
||||
|
@ -168,20 +168,20 @@ void ComponentGrid::updateSeparators()
|
|||
glm::vec2 pos;
|
||||
glm::vec2 size;
|
||||
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++) {
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||
if (!it->border && !drawAll)
|
||||
continue;
|
||||
|
||||
// Find component position + size.
|
||||
pos = glm::vec2{};
|
||||
size = glm::vec2{};
|
||||
for (int x = 0; x < it->pos.x; x++)
|
||||
for (int x = 0; x < it->pos.x; ++x)
|
||||
pos[0] += getColWidth(x);
|
||||
for (int y = 0; y < it->pos.y; y++)
|
||||
for (int y = 0; y < it->pos.y; ++y)
|
||||
pos[1] += getRowHeight(y);
|
||||
for (int x = it->pos.x; x < it->pos.x + it->dim.x; x++)
|
||||
for (int x = it->pos.x; x < it->pos.x + it->dim.x; ++x)
|
||||
size[0] += getColWidth(x);
|
||||
for (int y = it->pos.y; y < it->pos.y + it->dim.y; y++)
|
||||
for (int y = it->pos.y; y < it->pos.y + it->dim.y; ++y)
|
||||
size[1] += getRowHeight(y);
|
||||
|
||||
if (size == glm::vec2{})
|
||||
|
@ -224,7 +224,7 @@ void ComponentGrid::updateSeparators()
|
|||
|
||||
void ComponentGrid::onSizeChanged()
|
||||
{
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it)
|
||||
updateCellComponent(*it);
|
||||
|
||||
updateSeparators();
|
||||
|
@ -234,7 +234,7 @@ const ComponentGrid::GridEntry* ComponentGrid::getCellAt(int x, int y) const
|
|||
{
|
||||
assert(x >= 0 && x < mGridSize.x && y >= 0 && y < mGridSize.y);
|
||||
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++) {
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||
int xmin = it->pos.x;
|
||||
int xmax = xmin + it->dim.x;
|
||||
int ymin = it->pos.y;
|
||||
|
@ -281,7 +281,7 @@ void ComponentGrid::resetCursor()
|
|||
if (!mCells.size())
|
||||
return;
|
||||
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++) {
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||
if (it->canFocus) {
|
||||
glm::ivec2 origCursor = mCursor;
|
||||
mCursor = it->pos;
|
||||
|
@ -414,7 +414,7 @@ void ComponentGrid::update(int deltaTime)
|
|||
{
|
||||
// Update everything.
|
||||
const GridEntry* cursorEntry = getCellAt(mCursor);
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++) {
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||
if (it->updateType == UPDATE_ALWAYS ||
|
||||
(it->updateType == UPDATE_WHEN_SELECTED && cursorEntry == &(*it))) {
|
||||
it->component->update(deltaTime);
|
||||
|
@ -429,7 +429,7 @@ void ComponentGrid::render(const glm::mat4& parentTrans)
|
|||
renderChildren(trans);
|
||||
|
||||
// Draw cell separators.
|
||||
for (size_t i = 0; i < mSeparators.size(); i++) {
|
||||
for (size_t i = 0; i < mSeparators.size(); ++i) {
|
||||
Renderer::setMatrix(trans);
|
||||
Renderer::drawRect(mSeparators[i][0], mSeparators[i][1], mSeparators[i][2],
|
||||
mSeparators[i][3], 0xC6C7C6FF, 0xC6C7C6FF);
|
||||
|
@ -458,7 +458,7 @@ void ComponentGrid::onCursorMoved(glm::ivec2 from, glm::ivec2 to)
|
|||
|
||||
void ComponentGrid::setCursorTo(const std::shared_ptr<GuiComponent>& comp)
|
||||
{
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++) {
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||
if (it->component == comp) {
|
||||
glm::ivec2 oldCursor{mCursor};
|
||||
mCursor = it->pos;
|
||||
|
|
|
@ -44,7 +44,7 @@ void ComponentList::addRow(const ComponentListRow& row, bool setCursorHere)
|
|||
this->add(e);
|
||||
|
||||
for (auto it = mEntries.back().data.elements.cbegin();
|
||||
it != mEntries.back().data.elements.cend(); it++)
|
||||
it != mEntries.back().data.elements.cend(); ++it)
|
||||
addChild(it->component.get());
|
||||
|
||||
updateElementSize(mEntries.back().data);
|
||||
|
@ -58,7 +58,7 @@ void ComponentList::addRow(const ComponentListRow& row, bool setCursorHere)
|
|||
|
||||
void ComponentList::onSizeChanged()
|
||||
{
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); it++) {
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it) {
|
||||
updateElementSize(it->data);
|
||||
updateElementPosition(it->data);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ void ComponentList::update(int deltaTime)
|
|||
|
||||
// Update our currently selected row.
|
||||
for (auto it = mEntries.at(mCursor).data.elements.cbegin();
|
||||
it != mEntries.at(mCursor).data.elements.cend(); it++) {
|
||||
it != mEntries.at(mCursor).data.elements.cend(); ++it) {
|
||||
it->component->update(deltaTime);
|
||||
rowWidth += it->component->getSize().x;
|
||||
}
|
||||
|
@ -214,14 +214,14 @@ void ComponentList::onCursorChanged(const CursorState& state)
|
|||
// Update the selector bar position.
|
||||
// In the future this might be animated.
|
||||
mSelectorBarOffset = 0;
|
||||
for (int i = 0; i < mCursor; i++)
|
||||
for (int i = 0; i < mCursor; ++i)
|
||||
mSelectorBarOffset += getRowHeight(mEntries.at(i).data);
|
||||
|
||||
updateCameraOffset();
|
||||
|
||||
// This is terribly inefficient but we don't know what we came from so...
|
||||
if (size()) {
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it)
|
||||
it->data.elements.back().component->onFocusLost();
|
||||
|
||||
mEntries.at(mCursor).data.elements.back().component->onFocusGained();
|
||||
|
@ -261,7 +261,7 @@ void ComponentList::updateCameraOffset()
|
|||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (mCameraOffset < oldCameraOffset &&
|
||||
|
@ -305,7 +305,7 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
|||
// Draw our entries.
|
||||
std::vector<GuiComponent*> drawAfterCursor;
|
||||
bool drawAll;
|
||||
for (size_t i = 0; i < mEntries.size(); i++) {
|
||||
for (size_t i = 0; i < mEntries.size(); ++i) {
|
||||
|
||||
if (mLoopRows && mFocused && mLoopOffset > 0) {
|
||||
loopTrans =
|
||||
|
@ -314,7 +314,7 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
|||
|
||||
auto& entry = mEntries.at(i);
|
||||
drawAll = !mFocused || i != static_cast<unsigned int>(mCursor);
|
||||
for (auto it = entry.data.elements.cbegin(); it != entry.data.elements.cend(); it++) {
|
||||
for (auto it = entry.data.elements.cbegin(); it != entry.data.elements.cend(); ++it) {
|
||||
if (drawAll || it->invert_when_selected) {
|
||||
auto renderLoopFunc = [&]() {
|
||||
// Needed to avoid flickering when returning to the start position.
|
||||
|
@ -392,7 +392,7 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
|||
Renderer::Blend::ONE);
|
||||
}
|
||||
|
||||
for (auto it = drawAfterCursor.cbegin(); it != drawAfterCursor.cend(); it++)
|
||||
for (auto it = drawAfterCursor.cbegin(); it != drawAfterCursor.cend(); ++it)
|
||||
(*it)->render(trans);
|
||||
|
||||
// Reset matrix if one of these components changed it.
|
||||
|
@ -402,7 +402,7 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
|||
|
||||
// Draw separators.
|
||||
float y = 0;
|
||||
for (unsigned int i = 0; i < mEntries.size(); i++) {
|
||||
for (unsigned int i = 0; i < mEntries.size(); ++i) {
|
||||
Renderer::drawRect(0.0f, y, std::ceil(mSize.x), 1.0f * Renderer::getScreenHeightModifier(),
|
||||
0xC6C7C6FF, 0xC6C7C6FF, false, opacity, trans);
|
||||
y += getRowHeight(mEntries.at(i).data);
|
||||
|
@ -417,7 +417,7 @@ float ComponentList::getRowHeight(const ComponentListRow& row) const
|
|||
{
|
||||
// Returns the highest component height found in the row.
|
||||
float height = 0;
|
||||
for (unsigned int i = 0; i < row.elements.size(); i++) {
|
||||
for (unsigned int i = 0; i < row.elements.size(); ++i) {
|
||||
if (row.elements.at(i).component->getSize().y > height)
|
||||
height = row.elements.at(i).component->getSize().y;
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ float ComponentList::getRowHeight(const ComponentListRow& row) const
|
|||
float ComponentList::getTotalRowHeight() const
|
||||
{
|
||||
float height = 0;
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it)
|
||||
height += getRowHeight(it->data);
|
||||
|
||||
return height;
|
||||
|
@ -437,14 +437,14 @@ float ComponentList::getTotalRowHeight() const
|
|||
void ComponentList::updateElementPosition(const ComponentListRow& row)
|
||||
{
|
||||
float yOffset = 0;
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend() && &it->data != &row; it++)
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend() && &it->data != &row; ++it)
|
||||
yOffset += getRowHeight(it->data);
|
||||
|
||||
// Assumes updateElementSize has already been called.
|
||||
float rowHeight = getRowHeight(row);
|
||||
float x = mHorizontalPadding / 2.0f;
|
||||
|
||||
for (unsigned int i = 0; i < row.elements.size(); i++) {
|
||||
for (unsigned int i = 0; i < row.elements.size(); ++i) {
|
||||
const auto comp = row.elements.at(i).component;
|
||||
|
||||
// Center vertically.
|
||||
|
@ -458,7 +458,7 @@ void ComponentList::updateElementSize(const ComponentListRow& row)
|
|||
float width = mSize.x - mHorizontalPadding;
|
||||
std::vector<std::shared_ptr<GuiComponent>> resizeVec;
|
||||
|
||||
for (auto it = row.elements.cbegin(); it != row.elements.cend(); it++) {
|
||||
for (auto it = row.elements.cbegin(); it != row.elements.cend(); ++it) {
|
||||
if (it->resize_width)
|
||||
resizeVec.push_back(it->component);
|
||||
else
|
||||
|
@ -467,7 +467,7 @@ void ComponentList::updateElementSize(const ComponentListRow& row)
|
|||
|
||||
// Redistribute the "unused" width equally among the components with resize_width set to true.
|
||||
width = width / resizeVec.size();
|
||||
for (auto it = resizeVec.cbegin(); it != resizeVec.cend(); it++)
|
||||
for (auto it = resizeVec.cbegin(); it != resizeVec.cend(); ++it)
|
||||
(*it)->setSize(width, (*it)->getSize().y);
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ std::vector<HelpPrompt> ComponentList::getHelpPrompts()
|
|||
|
||||
if (size() > 1) {
|
||||
bool addMovePrompt = true;
|
||||
for (auto it = prompts.cbegin(); it != prompts.cend(); it++) {
|
||||
for (auto it = prompts.cbegin(); it != prompts.cend(); ++it) {
|
||||
if (it->first == "up/down" || it->first == "up/down/left/right") {
|
||||
addMovePrompt = false;
|
||||
break;
|
||||
|
|
|
@ -124,17 +124,17 @@ bool DateTimeEditComponent::input(InputConfig* config, Input input)
|
|||
}
|
||||
|
||||
if (mTime != 0 && config->isMappedLike("right", input) && input.value) {
|
||||
mEditIndex++;
|
||||
++mEditIndex;
|
||||
if (mEditIndex >= static_cast<int>(mCursorBoxes.size()))
|
||||
mEditIndex--;
|
||||
--mEditIndex;
|
||||
mKeyRepeatDir = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mTime != 0 && config->isMappedLike("left", input) && input.value) {
|
||||
mEditIndex--;
|
||||
--mEditIndex;
|
||||
if (mEditIndex < 0)
|
||||
mEditIndex++;
|
||||
++mEditIndex;
|
||||
mKeyRepeatDir = 0;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -162,8 +162,8 @@ void FlexboxComponent::computeLayout()
|
|||
|
||||
// Lay out the grid.
|
||||
if (mDirection == "row") {
|
||||
for (int y = 0; y < grid.y; y++) {
|
||||
for (int x = 0; x < grid.x; x++) {
|
||||
for (int y = 0; y < grid.y; ++y) {
|
||||
for (int x = 0; x < grid.x; ++x) {
|
||||
itemPositions.emplace_back(
|
||||
glm::vec2{(x * (maxItemSize.x + mItemMargin.x) + alignRightComp),
|
||||
y * (rowHeight + mItemMargin.y)});
|
||||
|
@ -171,16 +171,16 @@ void FlexboxComponent::computeLayout()
|
|||
}
|
||||
}
|
||||
else if (mDirection == "column" && !alignRight) {
|
||||
for (int x = 0; x < grid.x; x++) {
|
||||
for (int y = 0; y < grid.y; y++) {
|
||||
for (int x = 0; x < grid.x; ++x) {
|
||||
for (int y = 0; y < grid.y; ++y) {
|
||||
itemPositions.emplace_back(glm::vec2{(x * (maxItemSize.x + mItemMargin.x)),
|
||||
y * (rowHeight + mItemMargin.y)});
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // Right-aligned.
|
||||
for (int x = 0; x < grid.x; x++) {
|
||||
for (int y = 0; y < grid.y; y++) {
|
||||
for (int x = 0; x < grid.x; ++x) {
|
||||
for (int y = 0; y < grid.y; ++y) {
|
||||
itemPositions.emplace_back(
|
||||
glm::vec2{(mSize.x - (x * (maxItemSize.x + mItemMargin.x)) - maxItemSize.x),
|
||||
y * (rowHeight + mItemMargin.y)});
|
||||
|
@ -233,8 +233,8 @@ void FlexboxComponent::computeLayout()
|
|||
// This rasterizes the SVG images so they look nice and smooth.
|
||||
item.baseImage.setResize(item.baseImage.getSize());
|
||||
|
||||
itemsOnLastRow++;
|
||||
pos++;
|
||||
++itemsOnLastRow;
|
||||
++pos;
|
||||
}
|
||||
|
||||
// Apply right-align to the items if we're using row mode.
|
||||
|
|
|
@ -170,7 +170,7 @@ void HelpComponent::assignIcons()
|
|||
}
|
||||
}
|
||||
}
|
||||
it++;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ void HelpComponent::updateGrid()
|
|||
// State variable indicating whether gui is dimmed.
|
||||
bool isDimmed = mWindow->isBackgroundDimmed();
|
||||
|
||||
for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); it++) {
|
||||
for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); ++it) {
|
||||
auto icon = std::make_shared<ImageComponent>(mWindow);
|
||||
icon->setImage(getIconTexture(it->first.c_str()), false);
|
||||
icon->setColorShift(isDimmed ? mStyle.iconColorDimmed : mStyle.iconColor);
|
||||
|
@ -242,7 +242,7 @@ void HelpComponent::updateGrid()
|
|||
|
||||
mGrid->setSize(width, height);
|
||||
|
||||
for (unsigned int i = 0; i < icons.size(); i++) {
|
||||
for (unsigned int i = 0; i < icons.size(); ++i) {
|
||||
const int col = i * 4;
|
||||
mGrid->setColWidthPerc(col, icons.at(i)->getSize().x / width);
|
||||
mGrid->setColWidthPerc(
|
||||
|
@ -285,7 +285,7 @@ void HelpComponent::setOpacity(unsigned char opacity)
|
|||
{
|
||||
GuiComponent::setOpacity(opacity);
|
||||
|
||||
for (unsigned int i = 0; i < mGrid->getChildCount(); i++)
|
||||
for (unsigned int i = 0; i < mGrid->getChildCount(); ++i)
|
||||
mGrid->getChild(i)->setOpacity(opacity);
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ public:
|
|||
// Returns true if successful (select is in our list), false if not.
|
||||
bool setCursor(const UserData& obj)
|
||||
{
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); it++) {
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it) {
|
||||
if ((*it).object == obj) {
|
||||
mCursor = static_cast<int>(it - mEntries.cbegin());
|
||||
onCursorChanged(CURSOR_STOPPED);
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
|
||||
bool remove(const UserData& obj)
|
||||
{
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); it++) {
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it) {
|
||||
if ((*it).object == obj) {
|
||||
remove(it);
|
||||
return true;
|
||||
|
@ -206,7 +206,7 @@ protected:
|
|||
void remove(typename std::vector<Entry>::const_iterator& it)
|
||||
{
|
||||
if (mCursor > 0 && it - mEntries.cbegin() <= mCursor) {
|
||||
mCursor--;
|
||||
--mCursor;
|
||||
onCursorChanged(CURSOR_STOPPED);
|
||||
}
|
||||
|
||||
|
@ -267,18 +267,18 @@ protected:
|
|||
int scrollCount = 0;
|
||||
while (mScrollCursorAccumulator >= mTierList.tiers[mScrollTier].scrollDelay) {
|
||||
mScrollCursorAccumulator -= mTierList.tiers[mScrollTier].scrollDelay;
|
||||
scrollCount++;
|
||||
++scrollCount;
|
||||
}
|
||||
|
||||
// Should we go to the next scrolling tier?
|
||||
while (mScrollTier < mTierList.count - 1 &&
|
||||
mScrollTierAccumulator >= mTierList.tiers[mScrollTier].length) {
|
||||
mScrollTierAccumulator -= mTierList.tiers[mScrollTier].length;
|
||||
mScrollTier++;
|
||||
++mScrollTier;
|
||||
}
|
||||
|
||||
// Actually perform the scrolling.
|
||||
for (int i = 0; i < scrollCount; i++)
|
||||
for (int i = 0; i < scrollCount; ++i)
|
||||
scroll(mScrollVelocity);
|
||||
}
|
||||
|
||||
|
|
|
@ -353,16 +353,16 @@ void ImageComponent::updateVertices()
|
|||
updateColors();
|
||||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
mVertices[i].pos = glm::round(mVertices[i].pos);
|
||||
|
||||
if (mFlipX) {
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
mVertices[i].tex[0] = px - mVertices[i].tex[0];
|
||||
}
|
||||
|
||||
if (mFlipY) {
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
mVertices[i].tex[1] = py - mVertices[i].tex[1];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ template <typename T> void ImageGridComponent<T>::update(int deltaTime)
|
|||
GuiComponent::update(deltaTime);
|
||||
listUpdate(deltaTime);
|
||||
|
||||
for (auto it = mTiles.begin(); it != mTiles.end(); it++)
|
||||
for (auto it = mTiles.begin(); it != mTiles.end(); ++it)
|
||||
(*it)->update(deltaTime);
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ template <typename T> void ImageGridComponent<T>::render(const glm::mat4& parent
|
|||
|
||||
// Render all the tiles but the selected one.
|
||||
std::shared_ptr<GridTileComponent> selectedTile = nullptr;
|
||||
for (auto it = mTiles.begin(); it != mTiles.end(); it++) {
|
||||
for (auto it = mTiles.begin(); it != mTiles.end(); ++it) {
|
||||
std::shared_ptr<GridTileComponent> tile = (*it);
|
||||
// If it's the selected image, keep it for later, otherwise render it now.
|
||||
if (tile->isSelected())
|
||||
|
@ -336,7 +336,7 @@ void ImageGridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
|
||||
// mEntries are already loaded at this point, so we need to update them with
|
||||
// the new game image texture.
|
||||
for (auto it = mEntries.begin(); it != mEntries.end(); it++) {
|
||||
for (auto it = mEntries.begin(); it != mEntries.end(); ++it) {
|
||||
if ((*it).data.texturePath == oldDefaultGameTexture)
|
||||
(*it).data.texturePath = mDefaultGameTexture;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ void ImageGridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
|
||||
// mEntries are already loaded at this point, so we need to update them with
|
||||
// the new folder image texture.
|
||||
for (auto it = mEntries.begin(); it != mEntries.end(); it++) {
|
||||
for (auto it = mEntries.begin(); it != mEntries.end(); ++it) {
|
||||
if ((*it).data.texturePath == oldDefaultFolderTexture)
|
||||
(*it).data.texturePath = mDefaultFolderTexture;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ template <typename T> void ImageGridComponent<T>::onCursorChanged(const CursorSt
|
|||
if (newIdx >= 0 && newIdx < static_cast<int>(mTiles.size()))
|
||||
newTile = mTiles[newIdx];
|
||||
|
||||
for (auto it = mTiles.begin(); it != mTiles.end(); it++) {
|
||||
for (auto it = mTiles.begin(); it != mTiles.end(); ++it) {
|
||||
if ((*it)->isSelected() && *it != oldTile && *it != newTile) {
|
||||
startPos = 0;
|
||||
(*it)->setSelected(false, false, nullptr);
|
||||
|
@ -553,8 +553,8 @@ template <typename T> void ImageGridComponent<T>::buildTiles()
|
|||
int Y;
|
||||
|
||||
// Layout tile size and position.
|
||||
for (int y = 0; y < (vert ? mGridDimension.y : mGridDimension.x); y++) {
|
||||
for (int x = 0; x < (vert ? mGridDimension.x : mGridDimension.y); x++) {
|
||||
for (int y = 0; y < (vert ? mGridDimension.y : mGridDimension.x); ++y) {
|
||||
for (int x = 0; x < (vert ? mGridDimension.x : mGridDimension.y); ++x) {
|
||||
// Create tiles.
|
||||
auto tile = std::make_shared<GridTileComponent>(mWindow);
|
||||
|
||||
|
@ -589,7 +589,7 @@ void ImageGridComponent<T>::updateTiles(bool ascending,
|
|||
|
||||
// Stop updating the tiles at highest scroll speed.
|
||||
if (mScrollTier == 3) {
|
||||
for (int ti = 0; ti < static_cast<int>(mTiles.size()); ti++) {
|
||||
for (int ti = 0; ti < static_cast<int>(mTiles.size()); ++ti) {
|
||||
std::shared_ptr<GridTileComponent> tile = mTiles.at(ti);
|
||||
|
||||
tile->setSelected(false);
|
||||
|
@ -601,7 +601,7 @@ void ImageGridComponent<T>::updateTiles(bool ascending,
|
|||
|
||||
// Temporarily store the previous textures so that they can't be unloaded.
|
||||
std::vector<std::shared_ptr<TextureResource>> previousTextures;
|
||||
for (int ti = 0; ti < static_cast<int>(mTiles.size()); ti++) {
|
||||
for (int ti = 0; ti < static_cast<int>(mTiles.size()); ++ti) {
|
||||
std::shared_ptr<GridTileComponent> tile = mTiles.at(ti);
|
||||
previousTextures.push_back(tile->getTexture());
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ void MenuComponent::save()
|
|||
if (!mSaveFuncs.size())
|
||||
return;
|
||||
|
||||
for (auto it = mSaveFuncs.cbegin(); it != mSaveFuncs.cend(); it++)
|
||||
for (auto it = mSaveFuncs.cbegin(); it != mSaveFuncs.cend(); ++it)
|
||||
(*it)();
|
||||
|
||||
if (mNeedsSaving) {
|
||||
|
@ -108,7 +108,7 @@ void MenuComponent::updateSize()
|
|||
height += rowHeight;
|
||||
else
|
||||
break;
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,11 +164,11 @@ std::shared_ptr<ComponentGrid> makeButtonGrid(
|
|||
// Initialize to padding.
|
||||
float buttonGridWidth = BUTTON_GRID_HORIZ_PADDING * buttons.size();
|
||||
|
||||
for (int i = 0; i < static_cast<int>(buttons.size()); i++) {
|
||||
for (int i = 0; i < static_cast<int>(buttons.size()); ++i) {
|
||||
buttonGrid->setEntry(buttons.at(i), glm::ivec2{i, 0}, true, false);
|
||||
buttonGridWidth += buttons.at(i)->getSize().x;
|
||||
}
|
||||
for (unsigned int i = 0; i < buttons.size(); i++)
|
||||
for (unsigned int i = 0; i < buttons.size(); ++i)
|
||||
buttonGrid->setColWidthPerc(i, (buttons.at(i)->getSize().x + BUTTON_GRID_HORIZ_PADDING) /
|
||||
buttonGridWidth);
|
||||
|
||||
|
|
|
@ -39,10 +39,10 @@ void NinePatchComponent::updateColors()
|
|||
const unsigned int edgeColor = Renderer::convertRGBAToABGR(mEdgeColor);
|
||||
const unsigned int centerColor = Renderer::convertRGBAToABGR(mCenterColor);
|
||||
|
||||
for (int i = 0; i < 6 * 9; i++)
|
||||
for (int i = 0; i < 6 * 9; ++i)
|
||||
mVertices[i].col = edgeColor;
|
||||
|
||||
for (int i = 6 * 4; i < 6; i++)
|
||||
for (int i = 6 * 4; i < 6; ++i)
|
||||
mVertices[(6 * 4) + i].col = centerColor;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ void NinePatchComponent::buildVertices()
|
|||
|
||||
int v = 0;
|
||||
|
||||
for (int slice = 0; slice < 9; slice++) {
|
||||
for (int slice = 0; slice < 9; ++slice) {
|
||||
const int sliceX{slice % 3};
|
||||
const int sliceY{slice / 3};
|
||||
const glm::vec2 imgPos{imgPosX[sliceX], imgPosY[sliceY]};
|
||||
|
@ -113,7 +113,7 @@ void NinePatchComponent::buildVertices()
|
|||
// clang-format on
|
||||
|
||||
// Round vertices.
|
||||
for (int i = 1; i < 5; i++)
|
||||
for (int i = 1; i < 5; ++i)
|
||||
mVertices[v + i].pos = glm::round(mVertices[v + i].pos);
|
||||
|
||||
// Make duplicates of first and last vertex so this can be rendered as a triangle strip.
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
std::vector<T> getSelectedObjects()
|
||||
{
|
||||
std::vector<T> ret;
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); it++) {
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it) {
|
||||
if (it->selected)
|
||||
ret.push_back(it->object);
|
||||
}
|
||||
|
@ -219,14 +219,14 @@ public:
|
|||
|
||||
void selectAll()
|
||||
{
|
||||
for (unsigned int i = 0; i < mEntries.size(); i++)
|
||||
for (unsigned int i = 0; i < mEntries.size(); ++i)
|
||||
mEntries.at(i).selected = true;
|
||||
onSelectedChanged();
|
||||
}
|
||||
|
||||
void selectNone()
|
||||
{
|
||||
for (unsigned int i = 0; i < mEntries.size(); i++)
|
||||
for (unsigned int i = 0; i < mEntries.size(); ++i)
|
||||
mEntries.at(i).selected = false;
|
||||
onSelectedChanged();
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
unsigned int getSelectedId()
|
||||
{
|
||||
assert(mMultiSelect == false);
|
||||
for (unsigned int i = 0; i < mEntries.size(); i++) {
|
||||
for (unsigned int i = 0; i < mEntries.size(); ++i) {
|
||||
if (mEntries.at(i).selected)
|
||||
return i;
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ private:
|
|||
}
|
||||
else {
|
||||
// Display the selected entry and left/right option arrows.
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); it++) {
|
||||
for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it) {
|
||||
if (it->selected) {
|
||||
if (it->maxNameLength > 0.0f &&
|
||||
Font::get(FONT_SIZE_MEDIUM)->sizeText(Utils::String::toUpper(it->name)).x >
|
||||
|
@ -441,7 +441,7 @@ private:
|
|||
std::vector<ImageComponent*> checkBoxes;
|
||||
std::vector<TextComponent*> textEntries;
|
||||
|
||||
for (auto it = mParent->mEntries.begin(); it != mParent->mEntries.end(); it++) {
|
||||
for (auto it = mParent->mEntries.begin(); it != mParent->mEntries.end(); ++it) {
|
||||
row.elements.clear();
|
||||
auto textComponent = std::make_shared<TextComponent>(
|
||||
mWindow, Utils::String::toUpper(it->name), font, 0x777777FF);
|
||||
|
@ -481,7 +481,7 @@ private:
|
|||
// When selecting a row and the exclusive selection flag has been set,
|
||||
// gray out and disable all other rows.
|
||||
if (mParent->mMultiExclusiveSelect) {
|
||||
for (unsigned int i = 0; i < mParent->mEntries.size(); i++) {
|
||||
for (unsigned int i = 0; i < mParent->mEntries.size(); ++i) {
|
||||
|
||||
bool isSelected = mParent->mEntries[cursorId].selected;
|
||||
|
||||
|
@ -529,7 +529,7 @@ private:
|
|||
if (mParent->mMultiSelect) {
|
||||
if (!mParent->mMultiExclusiveSelect) {
|
||||
mMenu.addButton("SELECT ALL", "select all", [this, checkBoxes] {
|
||||
for (unsigned int i = 0; i < mParent->mEntries.size(); i++) {
|
||||
for (unsigned int i = 0; i < mParent->mEntries.size(); ++i) {
|
||||
mParent->mEntries.at(i).selected = true;
|
||||
checkBoxes.at(i)->setImage(CHECKED_PATH);
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ private:
|
|||
}
|
||||
|
||||
mMenu.addButton("SELECT NONE", "select none", [this, checkBoxes, textEntries] {
|
||||
for (unsigned int i = 0; i < mParent->mEntries.size(); i++) {
|
||||
for (unsigned int i = 0; i < mParent->mEntries.size(); ++i) {
|
||||
mParent->mEntries.at(i).selected = false;
|
||||
checkBoxes.at(i)->setImage(UNCHECKED_PATH);
|
||||
if (mParent->mMultiExclusiveSelect) {
|
||||
|
|
|
@ -136,7 +136,7 @@ void RatingComponent::updateColors()
|
|||
{
|
||||
const unsigned int color = Renderer::convertRGBAToABGR(mColorShift);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
mVertices[i].col = color;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ void RatingComponent::render(const glm::mat4& parentTrans)
|
|||
if (mUnfilledTexture->bind()) {
|
||||
if (mUnfilledColor != mColorShift) {
|
||||
const unsigned int color = Renderer::convertRGBAToABGR(mUnfilledColor);
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
mVertices[i].col = color;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,14 +76,14 @@ public:
|
|||
void setFont(const std::shared_ptr<Font>& font)
|
||||
{
|
||||
mFont = font;
|
||||
for (auto it = mEntries.begin(); it != mEntries.end(); it++)
|
||||
for (auto it = mEntries.begin(); it != mEntries.end(); ++it)
|
||||
it->data.textCache.reset();
|
||||
}
|
||||
|
||||
void setUppercase(bool uppercase)
|
||||
{
|
||||
mUppercase = uppercase;
|
||||
for (auto it = mEntries.begin(); it != mEntries.end(); it++)
|
||||
for (auto it = mEntries.begin(); it != mEntries.end(); ++it)
|
||||
it->data.textCache.reset();
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ template <typename T> void TextListComponent<T>::render(const glm::mat4& parentT
|
|||
glm::ivec2{static_cast<int>(std::round(dim.x - mHorizontalMargin * 2.0f)),
|
||||
static_cast<int>(std::round(dim.y))});
|
||||
|
||||
for (int i = startEntry; i < listCutoff; i++) {
|
||||
for (int i = startEntry; i < listCutoff; ++i) {
|
||||
typename IList<TextListData, T>::Entry& entry = mEntries.at(static_cast<unsigned int>(i));
|
||||
|
||||
unsigned int color;
|
||||
|
|
|
@ -157,7 +157,7 @@ void VideoFFmpegComponent::render(const glm::mat4& parentTrans)
|
|||
// clang-format on
|
||||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
|
||||
// This is needed to avoid a slight gap before the video starts playing.
|
||||
|
@ -557,7 +557,7 @@ void VideoFFmpegComponent::readFrames()
|
|||
}
|
||||
|
||||
if (mVideoCodecContext && mFormatContext) {
|
||||
for (int i = 0; i < readLoops; i++) {
|
||||
for (int i = 0; i < readLoops; ++i) {
|
||||
if (static_cast<int>(mVideoFrameQueue.size()) < mVideoTargetQueueSize ||
|
||||
(mAudioStreamIndex >= 0 &&
|
||||
static_cast<int>(mAudioFrameQueue.size()) < mAudioTargetQueueSize)) {
|
||||
|
@ -567,7 +567,7 @@ void VideoFFmpegComponent::readFrames()
|
|||
!avcodec_receive_frame(mVideoCodecContext, mVideoFrame)) {
|
||||
|
||||
int returnValue = 0;
|
||||
mVideoFrameReadCount++;
|
||||
++mVideoFrameReadCount;
|
||||
|
||||
if (mSWDecoder) {
|
||||
// Drop the frame if necessary.
|
||||
|
@ -577,7 +577,7 @@ void VideoFFmpegComponent::readFrames()
|
|||
AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT);
|
||||
}
|
||||
else {
|
||||
mVideoFrameDroppedCount++;
|
||||
++mVideoFrameDroppedCount;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -618,7 +618,7 @@ void VideoFFmpegComponent::readFrames()
|
|||
av_frame_free(&destFrame);
|
||||
}
|
||||
else {
|
||||
mVideoFrameDroppedCount++;
|
||||
++mVideoFrameDroppedCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -785,7 +785,7 @@ void VideoFFmpegComponent::outputFrames()
|
|||
audioLock.unlock();
|
||||
}
|
||||
mAudioFrameQueue.pop();
|
||||
mAudioFrameCount++;
|
||||
++mAudioFrameCount;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
|
@ -846,7 +846,7 @@ void VideoFFmpegComponent::outputFrames()
|
|||
pictureLock.unlock();
|
||||
|
||||
mVideoFrameQueue.pop();
|
||||
mVideoFrameCount++;
|
||||
++mVideoFrameCount;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
|
@ -1006,7 +1006,7 @@ bool VideoFFmpegComponent::decoderInitHW()
|
|||
}
|
||||
|
||||
// 50 is just an arbitrary number so we don't potentially get stuck in an endless loop.
|
||||
for (int i = 0; i < 50; i++) {
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
const AVCodecHWConfig* config = avcodec_get_hw_config(mHardwareCodec, i);
|
||||
if (!config) {
|
||||
LOG(LogDebug) << "VideoFFmpegComponent::decoderInitHW(): Hardware decoder \""
|
||||
|
@ -1038,7 +1038,7 @@ bool VideoFFmpegComponent::decoderInitHW()
|
|||
|
||||
const enum AVPixelFormat* pixelFormats;
|
||||
|
||||
for (pixelFormats = pix_fmts; *pixelFormats != -1; pixelFormats++)
|
||||
for (pixelFormats = pix_fmts; *pixelFormats != -1; ++pixelFormats)
|
||||
if (*pixelFormats == sPixelFormat)
|
||||
return static_cast<enum AVPixelFormat>(sPixelFormat);
|
||||
|
||||
|
@ -1100,7 +1100,7 @@ bool VideoFFmpegComponent::decoderInitHW()
|
|||
// For some videos we need to process at least one extra frame to verify
|
||||
// that the hardware encoder can actually be used, otherwise the fallback
|
||||
// to software decoding would take place when it's not necessary.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (avcodec_receive_frame(checkCodecContext, checkFrame) < 0) {
|
||||
av_packet_unref(checkPacket);
|
||||
while (av_read_frame(mFormatContext, checkPacket) == 0) {
|
||||
|
|
|
@ -220,7 +220,7 @@ void VideoVlcComponent::render(const glm::mat4& parentTrans)
|
|||
// clang-format on
|
||||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
|
||||
// Build a texture for the video frame.
|
||||
|
@ -363,7 +363,7 @@ void VideoVlcComponent::startVideo()
|
|||
// Wait for a maximum of 1 second for the media parsing.
|
||||
// This maximum time is quite excessive as this step should normally
|
||||
// be completed in 15 - 30 ms or so.
|
||||
for (int i = 0; i < 200; i++) {
|
||||
for (int i = 0; i < 200; ++i) {
|
||||
if (libvlc_media_get_parsed_status(mMedia))
|
||||
break;
|
||||
SDL_Delay(5);
|
||||
|
@ -372,7 +372,7 @@ void VideoVlcComponent::startVideo()
|
|||
|
||||
libvlc_media_track_t** tracks;
|
||||
track_count = libvlc_media_tracks_get(mMedia, &tracks);
|
||||
for (unsigned track = 0; track < track_count; track++) {
|
||||
for (unsigned track = 0; track < track_count; ++track) {
|
||||
if (tracks[track]->i_type == libvlc_track_video) {
|
||||
mVideoWidth = tracks[track]->video->i_width;
|
||||
mVideoHeight = tracks[track]->video->i_height;
|
||||
|
@ -456,7 +456,7 @@ void VideoVlcComponent::startVideo()
|
|||
// video player audio volume is apparently not properly handled by libVLC.
|
||||
// This maximum time is quite excessive as this step should normally
|
||||
// be completed in 4 - 16 ms or so even on slower machines.
|
||||
for (int i = 0; i < 50; i++) {
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
state = libvlc_media_player_get_state(mMediaPlayer);
|
||||
if (state == libvlc_Playing) {
|
||||
// This additional delay is needed to prevent some kind of race
|
||||
|
|
|
@ -84,7 +84,7 @@ GuiInputConfig::GuiInputConfig(Window* window,
|
|||
mList = std::make_shared<ComponentList>(mWindow);
|
||||
mGrid.setEntry(mList, glm::ivec2{0, 5}, true, true);
|
||||
|
||||
for (int i = 0; i < inputCount; i++) {
|
||||
for (int i = 0; i < inputCount; ++i) {
|
||||
ComponentListRow row;
|
||||
|
||||
// Icon.
|
||||
|
|
|
@ -60,7 +60,7 @@ GuiMsgBox::GuiMsgBox(Window* window,
|
|||
mAcceleratorFunc = mButtons.front()->getPressedFunc();
|
||||
}
|
||||
else {
|
||||
for (auto it = mButtons.cbegin(); it != mButtons.cend(); it++) {
|
||||
for (auto it = mButtons.cbegin(); it != mButtons.cend(); ++it) {
|
||||
if (Utils::String::toUpper((*it)->getText()) == "OK" ||
|
||||
Utils::String::toUpper((*it)->getText()) == "NO") {
|
||||
mAcceleratorFunc = (*it)->getPressedFunc();
|
||||
|
|
|
@ -156,10 +156,10 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
|
|||
std::vector<std::vector<std::shared_ptr<ButtonComponent>>> buttonList;
|
||||
|
||||
// Create keyboard.
|
||||
for (int i = 0; i < static_cast<int>(kbLayout.size()) / 4; i++) {
|
||||
for (int i = 0; i < static_cast<int>(kbLayout.size()) / 4; ++i) {
|
||||
std::vector<std::shared_ptr<ButtonComponent>> buttons;
|
||||
|
||||
for (int j = 0; j < static_cast<int>(kbLayout[i].size()); j++) {
|
||||
for (int j = 0; j < static_cast<int>(kbLayout[i].size()); ++j) {
|
||||
std::string lower = kbLayout[4 * i][j];
|
||||
if (lower.empty() || lower == "-rowspan-" || lower == "-colspan-")
|
||||
continue;
|
||||
|
@ -215,9 +215,9 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
|
|||
buttons.push_back(button);
|
||||
|
||||
int colSpan = 1;
|
||||
for (int cs = j + 1; cs < static_cast<int>(kbLayout[i].size()); cs++) {
|
||||
for (int cs = j + 1; cs < static_cast<int>(kbLayout[i].size()); ++cs) {
|
||||
if (std::string(kbLayout[4 * i][cs]) == "-colspan-")
|
||||
colSpan++;
|
||||
++colSpan;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
|
|||
int rowSpan = 1;
|
||||
for (int cs = (4 * i) + 4; cs < static_cast<int>(kbLayout.size()); cs += 4) {
|
||||
if (std::string(kbLayout[cs][j]) == "-rowspan-")
|
||||
rowSpan++;
|
||||
++rowSpan;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace Renderer
|
|||
displayIndex = 0;
|
||||
}
|
||||
else {
|
||||
displayIndex--;
|
||||
--displayIndex;
|
||||
}
|
||||
|
||||
int availableDisplays = SDL_GetNumVideoDisplays();
|
||||
|
@ -286,7 +286,7 @@ namespace Renderer
|
|||
shaderFiles.push_back(":/shaders/glsl/blur_vertical.glsl");
|
||||
shaderFiles.push_back(":/shaders/glsl/scanlines.glsl");
|
||||
|
||||
for (auto it = shaderFiles.cbegin(); it != shaderFiles.cend(); it++) {
|
||||
for (auto it = shaderFiles.cbegin(); it != shaderFiles.cend(); ++it) {
|
||||
Shader* loadShader = new Shader();
|
||||
|
||||
loadShader->loadShaderFile(*it, GL_VERTEX_SHADER);
|
||||
|
@ -307,7 +307,7 @@ namespace Renderer
|
|||
static void destroyWindow()
|
||||
{
|
||||
#if defined(USE_OPENGL_21)
|
||||
for (auto it = sShaderProgramVector.cbegin(); it != sShaderProgramVector.cend(); it++)
|
||||
for (auto it = sShaderProgramVector.cbegin(); it != sShaderProgramVector.cend(); ++it)
|
||||
delete *it;
|
||||
#endif
|
||||
|
||||
|
@ -492,7 +492,7 @@ namespace Renderer
|
|||
// clang-format on
|
||||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
|
||||
if (opacity < 1.0) {
|
||||
|
@ -533,7 +533,7 @@ namespace Renderer
|
|||
// of shifts required to reach 0.
|
||||
while (shaderID > 0) {
|
||||
shaderID = shaderID >> 1;
|
||||
index++;
|
||||
++index;
|
||||
}
|
||||
|
||||
if (sShaderProgramVector.size() > index - 1)
|
||||
|
|
|
@ -483,7 +483,7 @@ namespace Renderer
|
|||
|
||||
GL_CHECK_ERROR(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0));
|
||||
|
||||
for (size_t i = 0; i < shaderList.size(); i++) {
|
||||
for (size_t i = 0; i < shaderList.size(); ++i) {
|
||||
vertices[0].shaders = shaderList[i];
|
||||
int shaderPasses = 1;
|
||||
// For the blur shaders there is an optional variable to set the number of passes
|
||||
|
@ -493,7 +493,7 @@ namespace Renderer
|
|||
shaderPasses = parameters.blurPasses;
|
||||
}
|
||||
|
||||
for (int p = 0; p < shaderPasses; p++) {
|
||||
for (int p = 0; p < shaderPasses; ++p) {
|
||||
GL_CHECK_ERROR(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, shaderFBO));
|
||||
|
||||
// Attach the texture to the shader framebuffer.
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Renderer
|
|||
mProgramID = glCreateProgram();
|
||||
|
||||
// Compile and attach all shaders that have been loaded.
|
||||
for (auto it = shaderVector.cbegin(); it != shaderVector.cend(); it++) {
|
||||
for (auto it = shaderVector.cbegin(); it != shaderVector.cend(); ++it) {
|
||||
GLuint currentShader = glCreateShader(std::get<2>(*it));
|
||||
GLchar const* shaderCodePtr = std::get<1>(*it).c_str();
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ void Font::initLibrary()
|
|||
size_t Font::getMemUsage() const
|
||||
{
|
||||
size_t memUsage = 0;
|
||||
for (auto it = mTextures.cbegin(); it != mTextures.cend(); it++)
|
||||
for (auto it = mTextures.cbegin(); it != mTextures.cend(); ++it)
|
||||
memUsage += it->textureSize.x * it->textureSize.y * 4;
|
||||
|
||||
for (auto it = mFaceCache.cbegin(); it != mFaceCache.cend(); it++)
|
||||
for (auto it = mFaceCache.cbegin(); it != mFaceCache.cend(); ++it)
|
||||
memUsage += it->second->data.length;
|
||||
|
||||
return memUsage;
|
||||
|
@ -69,7 +69,7 @@ size_t Font::getTotalMemUsage()
|
|||
}
|
||||
|
||||
total += it->second.lock()->getMemUsage();
|
||||
it++;
|
||||
++it;
|
||||
}
|
||||
|
||||
return total;
|
||||
|
@ -94,7 +94,7 @@ Font::Font(int size, const std::string& path)
|
|||
initLibrary();
|
||||
|
||||
// Always initialize ASCII characters.
|
||||
for (unsigned int i = 32; i < 128; i++)
|
||||
for (unsigned int i = 32; i < 128; ++i)
|
||||
getGlyph(i);
|
||||
|
||||
clearFaceCache();
|
||||
|
@ -134,7 +134,7 @@ std::shared_ptr<Font> Font::get(int size, const std::string& path)
|
|||
|
||||
void Font::unloadTextures()
|
||||
{
|
||||
for (auto it = mTextures.begin(); it != mTextures.end(); it++)
|
||||
for (auto it = mTextures.begin(); it != mTextures.end(); ++it)
|
||||
it->deinitTexture();
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ FT_Face Font::getFaceForChar(unsigned int id)
|
|||
|
||||
// Look through our current font + fallback fonts to see if any have the
|
||||
// glyph we're looking for.
|
||||
for (unsigned int i = 0; i < fallbackFonts.size() + 1; i++) {
|
||||
for (unsigned int i = 0; i < fallbackFonts.size() + 1; ++i) {
|
||||
auto fit = mFaceCache.find(i);
|
||||
|
||||
// Doesn't exist yet.
|
||||
|
@ -347,11 +347,11 @@ Font::Glyph* Font::getGlyph(unsigned int id)
|
|||
void Font::rebuildTextures()
|
||||
{
|
||||
// Recreate OpenGL textures.
|
||||
for (auto it = mTextures.begin(); it != mTextures.end(); it++)
|
||||
for (auto it = mTextures.begin(); it != mTextures.end(); ++it)
|
||||
it->initTexture();
|
||||
|
||||
// Re-upload the texture data.
|
||||
for (auto it = mGlyphMap.cbegin(); it != mGlyphMap.cend(); it++) {
|
||||
for (auto it = mGlyphMap.cbegin(); it != mGlyphMap.cend(); ++it) {
|
||||
FT_Face face = getFaceForChar(it->first);
|
||||
FT_GlyphSlot glyphSlot = face->glyph;
|
||||
|
||||
|
@ -379,7 +379,7 @@ void Font::renderTextCache(TextCache* cache)
|
|||
return;
|
||||
}
|
||||
|
||||
for (auto it = cache->vertexLists.cbegin(); it != cache->vertexLists.cend(); it++) {
|
||||
for (auto it = cache->vertexLists.cbegin(); it != cache->vertexLists.cend(); ++it) {
|
||||
assert(*it->textureIdPtr != 0);
|
||||
|
||||
auto vertexList = *it;
|
||||
|
@ -658,7 +658,7 @@ TextCache* Font::buildTextCache(const std::string& text,
|
|||
convertedColor};
|
||||
|
||||
// Round vertices.
|
||||
for (int i = 1; i < 5; i++)
|
||||
for (int i = 1; i < 5; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
|
||||
// Make duplicates of first and last vertex so this can be rendered as a triangle strip.
|
||||
|
@ -674,7 +674,7 @@ TextCache* Font::buildTextCache(const std::string& text,
|
|||
cache->metrics = {sizeText(text, lineSpacing)};
|
||||
|
||||
unsigned int i = 0;
|
||||
for (auto it = vertMap.cbegin(); it != vertMap.cend(); it++) {
|
||||
for (auto it = vertMap.cbegin(); it != vertMap.cend(); ++it) {
|
||||
TextCache::VertexList& vertList = cache->vertexLists.at(i);
|
||||
|
||||
vertList.textureIdPtr = &it->first->textureId;
|
||||
|
@ -700,8 +700,8 @@ void TextCache::setColor(unsigned int color)
|
|||
{
|
||||
const unsigned int convertedColor = Renderer::convertRGBAToABGR(color);
|
||||
|
||||
for (auto it = vertexLists.begin(); it != vertexLists.end(); it++)
|
||||
for (auto it2 = it->verts.begin(); it2 != it->verts.end(); it2++)
|
||||
for (auto it = vertexLists.begin(); it != vertexLists.end(); ++it)
|
||||
for (auto it2 = it->verts.begin(); it2 != it->verts.end(); ++it2)
|
||||
it2->col = convertedColor;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ void ResourceManager::unloadAll()
|
|||
while (iter != mReloadables.cend()) {
|
||||
if (!iter->expired()) {
|
||||
iter->lock()->unload(sInstance);
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
else {
|
||||
iter = mReloadables.erase(iter);
|
||||
|
@ -160,7 +160,7 @@ void ResourceManager::reloadAll()
|
|||
while (iter != mReloadables.cend()) {
|
||||
if (!iter->expired()) {
|
||||
iter->lock()->reload(sInstance);
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
else {
|
||||
iter = mReloadables.erase(iter);
|
||||
|
|
|
@ -17,7 +17,7 @@ TextureDataManager::TextureDataManager()
|
|||
{
|
||||
unsigned char data[5 * 5 * 4];
|
||||
mBlank = std::make_shared<TextureData>(false);
|
||||
for (int i = 0; i < (5 * 5); i++) {
|
||||
for (int i = 0; i < (5 * 5); ++i) {
|
||||
data[i * 4] = (i % 2) * 255;
|
||||
data[i * 4 + 1] = (i % 2) * 255;
|
||||
data[i * 4 + 2] = (i % 2) * 255;
|
||||
|
@ -132,7 +132,7 @@ void TextureDataManager::load(std::shared_ptr<TextureData> tex, bool block)
|
|||
|
||||
size_t max_texture = settingVRAM * 1024 * 1024;
|
||||
|
||||
for (auto it = mTextures.crbegin(); it != mTextures.crend(); it++) {
|
||||
for (auto it = mTextures.crbegin(); it != mTextures.crend(); ++it) {
|
||||
if (size < max_texture)
|
||||
break;
|
||||
(*it)->releaseVRAM();
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace Utils
|
|||
{
|
||||
// CImg does not interleave the pixels as in RGBARGBARGBA so a conversion is required.
|
||||
int counter = 0;
|
||||
for (int r = 0; r < image.height(); r++) {
|
||||
for (int c = 0; c < image.width(); c++) {
|
||||
for (int r = 0; r < image.height(); ++r) {
|
||||
for (int c = 0; c < image.width(); ++c) {
|
||||
image(c, r, 0, 0) = imageRGBA[counter + 2];
|
||||
image(c, r, 0, 1) = imageRGBA[counter + 1];
|
||||
image(c, r, 0, 2) = imageRGBA[counter + 0];
|
||||
|
@ -31,8 +31,8 @@ namespace Utils
|
|||
void convertCImgToRGBA(const cimg_library::CImg<unsigned char>& image,
|
||||
std::vector<unsigned char>& imageRGBA)
|
||||
{
|
||||
for (int r = image.height() - 1; r >= 0; r--) {
|
||||
for (int c = 0; c < image.width(); c++) {
|
||||
for (int r = image.height() - 1; r >= 0; --r) {
|
||||
for (int c = 0; c < image.width(); ++c) {
|
||||
imageRGBA.emplace_back((unsigned char)image(c, r, 0, 2));
|
||||
imageRGBA.emplace_back((unsigned char)image(c, r, 0, 1));
|
||||
imageRGBA.emplace_back((unsigned char)image(c, r, 0, 0));
|
||||
|
@ -55,38 +55,38 @@ namespace Utils
|
|||
unsigned int columnCounterRight = 0;
|
||||
|
||||
// Count the number of rows and columns that are completely transparent.
|
||||
for (int i = image.height() - 1; i > 0; i--) {
|
||||
for (int i = image.height() - 1; i > 0; --i) {
|
||||
cimg_library::CImg<unsigned char> imageRow = image.get_rows(i, i);
|
||||
pixelValueSum = imageRow.get_shared_channel(3).sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
rowCounterTop++;
|
||||
++rowCounterTop;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < image.height(); i++) {
|
||||
for (int i = 0; i < image.height(); ++i) {
|
||||
cimg_library::CImg<unsigned char> imageRow = image.get_rows(i, i);
|
||||
pixelValueSum = imageRow.get_shared_channel(3).sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
rowCounterBottom++;
|
||||
++rowCounterBottom;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < image.width(); i++) {
|
||||
for (int i = 0; i < image.width(); ++i) {
|
||||
cimg_library::CImg<unsigned char> imageColumn = image.get_columns(i, i);
|
||||
pixelValueSum = imageColumn.get_shared_channel(3).sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
columnCounterLeft++;
|
||||
++columnCounterLeft;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = image.width() - 1; i > 0; i--) {
|
||||
for (int i = image.width() - 1; i > 0; --i) {
|
||||
cimg_library::CImg<unsigned char> imageColumn = image.get_columns(i, i);
|
||||
pixelValueSum = imageColumn.get_shared_channel(3).sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
columnCounterRight++;
|
||||
++columnCounterRight;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -110,38 +110,38 @@ namespace Utils
|
|||
unsigned int columnCounterRight = 0;
|
||||
|
||||
// Count the number of rows and columns that are completely transparent.
|
||||
for (int i = image.height() - 1; i > 0; i--) {
|
||||
for (int i = image.height() - 1; i > 0; --i) {
|
||||
cimg_library::CImg<unsigned char> imageRow = image.get_rows(i, i);
|
||||
pixelValueSum = imageRow.get_shared_channel(3).sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
rowCounterTop++;
|
||||
++rowCounterTop;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < image.height(); i++) {
|
||||
for (int i = 0; i < image.height(); ++i) {
|
||||
cimg_library::CImg<unsigned char> imageRow = image.get_rows(i, i);
|
||||
pixelValueSum = imageRow.get_shared_channel(3).sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
rowCounterBottom++;
|
||||
++rowCounterBottom;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < image.width(); i++) {
|
||||
for (int i = 0; i < image.width(); ++i) {
|
||||
cimg_library::CImg<unsigned char> imageColumn = image.get_columns(i, i);
|
||||
pixelValueSum = imageColumn.get_shared_channel(3).sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
columnCounterLeft++;
|
||||
++columnCounterLeft;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = image.width() - 1; i > 0; i--) {
|
||||
for (int i = image.width() - 1; i > 0; --i) {
|
||||
cimg_library::CImg<unsigned char> imageColumn = image.get_columns(i, i);
|
||||
pixelValueSum = imageColumn.get_shared_channel(3).sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
columnCounterRight++;
|
||||
++columnCounterRight;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -167,23 +167,23 @@ namespace Utils
|
|||
int rowCounterLower = 0;
|
||||
|
||||
// Count the number of rows that are pure black.
|
||||
for (int i = image.height() - 1; i > 0; i--) {
|
||||
for (int i = image.height() - 1; i > 0; --i) {
|
||||
cimg_library::CImg<unsigned char> imageRow = image.get_rows(i, i);
|
||||
// Ignore the alpha channel.
|
||||
imageRow.channels(0, 2);
|
||||
pixelValueSum = imageRow.sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
rowCounterUpper++;
|
||||
++rowCounterUpper;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < image.height(); i++) {
|
||||
for (int i = 0; i < image.height(); ++i) {
|
||||
cimg_library::CImg<unsigned char> imageRow = image.get_rows(i, i);
|
||||
imageRow.channels(0, 2);
|
||||
pixelValueSum = imageRow.sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
rowCounterLower++;
|
||||
++rowCounterLower;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -203,23 +203,23 @@ namespace Utils
|
|||
unsigned int columnCounterRight = 0;
|
||||
|
||||
// Count the number of columns that are pure black.
|
||||
for (int i = 0; i < image.width(); i++) {
|
||||
for (int i = 0; i < image.width(); ++i) {
|
||||
cimg_library::CImg<unsigned char> imageColumn = image.get_columns(i, i);
|
||||
// Ignore the alpha channel.
|
||||
imageColumn.channels(0, 2);
|
||||
pixelValueSum = imageColumn.sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
columnCounterLeft++;
|
||||
++columnCounterLeft;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = image.width() - 1; i > 0; i--) {
|
||||
for (int i = image.width() - 1; i > 0; --i) {
|
||||
cimg_library::CImg<unsigned char> imageColumn = image.get_columns(i, i);
|
||||
imageColumn.channels(0, 2);
|
||||
pixelValueSum = imageColumn.sum();
|
||||
if (pixelValueSum == 0.0l)
|
||||
columnCounterRight++;
|
||||
++columnCounterRight;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ namespace Utils
|
|||
|
||||
std::string pathTest;
|
||||
|
||||
for (auto it = pathList.cbegin(); it != pathList.cend(); it++) {
|
||||
for (auto it = pathList.cbegin(); it != pathList.cend(); ++it) {
|
||||
pathTest = it->c_str() + ("/" + executable);
|
||||
if (exists(pathTest))
|
||||
return it->c_str();
|
||||
|
@ -317,10 +317,10 @@ namespace Utils
|
|||
|
||||
if ((offset == 0) || (escapedPath[offset - 1] != '\\')) {
|
||||
escapedPath.insert(offset, 1, '\\');
|
||||
start++;
|
||||
++start;
|
||||
}
|
||||
}
|
||||
invalidChar++;
|
||||
++invalidChar;
|
||||
}
|
||||
return escapedPath;
|
||||
#endif
|
||||
|
@ -343,7 +343,7 @@ namespace Utils
|
|||
scan = false;
|
||||
|
||||
for (stringList::const_iterator it = pathList.cbegin(); it != pathList.cend();
|
||||
it++) {
|
||||
++it) {
|
||||
// Ignore empty.
|
||||
if ((*it).empty())
|
||||
continue;
|
||||
|
@ -377,7 +377,7 @@ namespace Utils
|
|||
else
|
||||
canonicalPath = getParent(canonicalPath) + "/" + resolved;
|
||||
|
||||
for (++it; it != pathList.cend(); it++)
|
||||
for (++it; it != pathList.cend(); ++it)
|
||||
canonicalPath += (canonicalPath.size() == 0) ? (*it) : ("/" + (*it));
|
||||
|
||||
scan = true;
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace Utils
|
|||
// Encodes unsigned int input into unsigned char output. Assumes len is a multiple of 4.
|
||||
auto encodeFunc = [](unsigned char output[], const unsigned int input[],
|
||||
unsigned int len) {
|
||||
for (unsigned int i = 0, j = 0; j < len; i++, j += 4) {
|
||||
for (unsigned int i = 0, j = 0; j < len; ++i, j += 4) {
|
||||
output[j] = input[i] & 0xff;
|
||||
output[j + 1] = (input[i] >> 8) & 0xff;
|
||||
output[j + 2] = (input[i] >> 16) & 0xff;
|
||||
|
@ -134,7 +134,7 @@ namespace Utils
|
|||
|
||||
// Convert to hex string.
|
||||
char buf[33];
|
||||
for (int i = 0; i < 16; i++)
|
||||
for (int i = 0; i < 16; ++i)
|
||||
sprintf(buf + i * 2, "%02x", digest[i]);
|
||||
buf[32] = 0;
|
||||
|
||||
|
@ -152,7 +152,7 @@ namespace Utils
|
|||
|
||||
// Update number of bits.
|
||||
if ((count[0] += (length << 3)) < (length << 3))
|
||||
count[1]++;
|
||||
++count[1];
|
||||
count[1] += (length >> 29);
|
||||
|
||||
// Number of bytes we need to fill in buffer.
|
||||
|
@ -188,7 +188,7 @@ namespace Utils
|
|||
unsigned int x[16]{};
|
||||
|
||||
// Encodes unsigned int input into unsigned char output. Assumes len is a multiple of 4.
|
||||
for (unsigned int i = 0, j = 0; j < 64; i++, j += 4)
|
||||
for (unsigned int i = 0, j = 0; j < 64; ++i, j += 4)
|
||||
x[i] = (static_cast<unsigned int>(block[j])) |
|
||||
((static_cast<unsigned int>(block[j + 1])) << 8) |
|
||||
((static_cast<unsigned int>(block[j + 2])) << 16) |
|
||||
|
|
|
@ -328,7 +328,7 @@ namespace Utils
|
|||
}
|
||||
else {
|
||||
// Error, invalid character.
|
||||
cursor++;
|
||||
++cursor;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -394,7 +394,7 @@ namespace Utils
|
|||
size_t result = cursor;
|
||||
|
||||
while (result < stringArg.length()) {
|
||||
result++;
|
||||
++result;
|
||||
|
||||
// Break if current character is not 10xxxxxx
|
||||
if ((stringArg[result] & 0xC0) != 0x80)
|
||||
|
@ -409,7 +409,7 @@ namespace Utils
|
|||
size_t result = cursor;
|
||||
|
||||
while (result > 0) {
|
||||
result--;
|
||||
--result;
|
||||
|
||||
// Break if current character is not 10xxxxxx
|
||||
if ((stringArg[result] & 0xC0) != 0x80)
|
||||
|
@ -424,11 +424,11 @@ namespace Utils
|
|||
size_t result = cursor;
|
||||
|
||||
if (amount > 0) {
|
||||
for (int i = 0; i < amount; i++)
|
||||
for (int i = 0; i < amount; ++i)
|
||||
result = nextCursor(stringArg, result);
|
||||
}
|
||||
else if (amount < 0) {
|
||||
for (int i = amount; i < 0; i++)
|
||||
for (int i = amount; i < 0; ++i)
|
||||
result = prevCursor(stringArg, result);
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ namespace Utils
|
|||
// Normal UTF-8 ASCII character.
|
||||
if (checkCharType <= 0x7F) {
|
||||
stringLower += static_cast<char>(tolower(stringArg[i]));
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
// Four-byte Unicode character, no case conversion done.
|
||||
else if (checkCharType >= 0xF0) {
|
||||
|
@ -498,7 +498,7 @@ namespace Utils
|
|||
// Normal UTF-8 ASCII character.
|
||||
if (checkCharType <= 0x7F) {
|
||||
stringUpper += static_cast<char>(toupper(stringArg[i]));
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
// Four-byte Unicode character, no case conversion done.
|
||||
else if (checkCharType >= 0xF0) {
|
||||
|
@ -546,7 +546,7 @@ namespace Utils
|
|||
std::string line = stringArg;
|
||||
bool active = true;
|
||||
|
||||
for (int i = 0; line[i] != '\0'; i++) {
|
||||
for (int i = 0; line[i] != '\0'; ++i) {
|
||||
if (std::isalpha(line[i])) {
|
||||
if (active) {
|
||||
line[i] = Utils::String::toUpper(std::string(1, line[i]))[0];
|
||||
|
@ -691,7 +691,7 @@ namespace Utils
|
|||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator it = vectorArg.cbegin();
|
||||
it != vectorArg.cend(); it++)
|
||||
it != vectorArg.cend(); ++it)
|
||||
resultString += (resultString.length() ? delimiter : "") + (*it);
|
||||
|
||||
return resultString;
|
||||
|
@ -701,7 +701,7 @@ namespace Utils
|
|||
{
|
||||
std::string buffer = input;
|
||||
|
||||
for (size_t i = 0; i < input.size(); i++)
|
||||
for (size_t i = 0; i < input.size(); ++i)
|
||||
buffer[i] = input[i] ^ key[i];
|
||||
|
||||
return buffer;
|
||||
|
|
Loading…
Reference in a new issue