mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
sys: Added clang-format file, formatted entire project
This commit is contained in:
@@ -69,7 +69,7 @@ namespace hex::init {
|
||||
|
||||
bool WindowSplash::loop() {
|
||||
auto splash = romfs::get("splash.png");
|
||||
ImGui::Texture splashTexture = ImGui::LoadImageFromMemory(reinterpret_cast<const ImU8*>(splash.data()), splash.size());
|
||||
ImGui::Texture splashTexture = ImGui::LoadImageFromMemory(reinterpret_cast<const ImU8 *>(splash.data()), splash.size());
|
||||
|
||||
if (splashTexture == nullptr) {
|
||||
log::fatal("Could not load splash screen image!");
|
||||
@@ -98,15 +98,14 @@ namespace hex::init {
|
||||
|
||||
drawList->AddText(ImVec2(15, 120) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("WerWolv 2020 - {0}", &__DATE__[7]).c_str());
|
||||
|
||||
#if defined(DEBUG)
|
||||
drawList->AddText(ImVec2(15, 140) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("{0} : {1} {2}@{3}", IMHEX_VERSION, ICON_FA_CODE_BRANCH, GIT_BRANCH, GIT_COMMIT_HASH).c_str());
|
||||
#else
|
||||
drawList->AddText(ImVec2(15, 140) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("{0}", IMHEX_VERSION).c_str());
|
||||
#endif
|
||||
#if defined(DEBUG)
|
||||
drawList->AddText(ImVec2(15, 140) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("{0} : {1} {2}@{3}", IMHEX_VERSION, ICON_FA_CODE_BRANCH, GIT_BRANCH, GIT_COMMIT_HASH).c_str());
|
||||
#else
|
||||
drawList->AddText(ImVec2(15, 140) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("{0}", IMHEX_VERSION).c_str());
|
||||
#endif
|
||||
|
||||
drawList->AddRectFilled(ImVec2(0, splashTexture.size().y - 5) * scale, ImVec2(splashTexture.size().x * this->m_progress, splashTexture.size().y) * scale, 0xFFFFFFFF);
|
||||
drawList->AddText(ImVec2(15, splashTexture.size().y - 25) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF),
|
||||
hex::format("[{}] {}", "|/-\\"[ImU32(ImGui::GetTime() * 15) % 4], this->m_currTaskName).c_str());
|
||||
drawList->AddText(ImVec2(15, splashTexture.size().y - 25) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("[{}] {}", "|/-\\"[ImU32(ImGui::GetTime() * 15) % 4], this->m_currTaskName).c_str());
|
||||
}
|
||||
|
||||
ImGui::Render();
|
||||
@@ -171,12 +170,12 @@ namespace hex::init {
|
||||
|
||||
SharedData::globalScale = SharedData::fontScale = std::midpoint(xScale, yScale);
|
||||
|
||||
// On Macs with a retina display (basically all modern ones we care about), the OS reports twice
|
||||
// the actual monitor scale for some obscure reason. Get rid of this here so ImHex doesn't look
|
||||
// extremely huge with native scaling on MacOS.
|
||||
#if defined(OS_MACOS)
|
||||
SharedData::globalScale /= 2;
|
||||
#endif
|
||||
// On Macs with a retina display (basically all modern ones we care about), the OS reports twice
|
||||
// the actual monitor scale for some obscure reason. Get rid of this here so ImHex doesn't look
|
||||
// extremely huge with native scaling on MacOS.
|
||||
#if defined(OS_MACOS)
|
||||
SharedData::globalScale /= 2;
|
||||
#endif
|
||||
|
||||
if (SharedData::globalScale <= 0) {
|
||||
SharedData::globalScale = 1.0;
|
||||
@@ -217,8 +216,7 @@ namespace hex::init {
|
||||
cfg.MergeMode = true;
|
||||
|
||||
ImWchar fontAwesomeRange[] = {
|
||||
ICON_MIN_FA, ICON_MAX_FA,
|
||||
0
|
||||
ICON_MIN_FA, ICON_MAX_FA, 0
|
||||
};
|
||||
std::uint8_t *px;
|
||||
int w, h;
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace hex::init {
|
||||
}
|
||||
|
||||
if (!result)
|
||||
getInitArguments().push_back({ "folder-creation-error", { } });
|
||||
getInitArguments().push_back({ "folder-creation-error", {} });
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ namespace hex::init {
|
||||
auto &cfg = SharedData::fontConfig;
|
||||
|
||||
fonts = IM_NEW(ImFontAtlas)();
|
||||
cfg = { };
|
||||
cfg = {};
|
||||
|
||||
fs::path fontFile;
|
||||
for (const auto &dir : hex::getPath(ImHexPath::Resources)) {
|
||||
@@ -120,18 +120,15 @@ namespace hex::init {
|
||||
}
|
||||
|
||||
ImWchar fontAwesomeRange[] = {
|
||||
ICON_MIN_FA, ICON_MAX_FA,
|
||||
0
|
||||
ICON_MIN_FA, ICON_MAX_FA, 0
|
||||
};
|
||||
|
||||
ImWchar codiconsRange[] = {
|
||||
ICON_MIN_VS, ICON_MAX_VS,
|
||||
0
|
||||
ICON_MIN_VS, ICON_MAX_VS, 0
|
||||
};
|
||||
|
||||
ImWchar unifontRange[] = {
|
||||
0x0020, 0xFFF0,
|
||||
0
|
||||
0x0020, 0xFFF0, 0
|
||||
};
|
||||
|
||||
|
||||
@@ -151,7 +148,7 @@ namespace hex::init {
|
||||
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
|
||||
cfg.SizePixels = fontSize * SharedData::fontScale;
|
||||
|
||||
fonts->AddFontFromFileTTF(fontFile.string().c_str(), std::floor(fontSize * SharedData::fontScale), &cfg, ranges.Data); // Needs conversion to char for Windows
|
||||
fonts->AddFontFromFileTTF(fontFile.string().c_str(), std::floor(fontSize * SharedData::fontScale), &cfg, ranges.Data); // Needs conversion to char for Windows
|
||||
}
|
||||
|
||||
cfg.MergeMode = true;
|
||||
@@ -224,7 +221,7 @@ namespace hex::init {
|
||||
if (PluginManager::getPlugins().empty()) {
|
||||
log::error("No plugins found!");
|
||||
|
||||
getInitArguments().push_back({ "no-plugins", { } });
|
||||
getInitArguments().push_back({ "no-plugins", {} });
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -251,22 +248,22 @@ namespace hex::init {
|
||||
}
|
||||
|
||||
switch (ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.scaling", 0)) {
|
||||
default:
|
||||
case 0:
|
||||
// Native scaling
|
||||
break;
|
||||
case 1:
|
||||
SharedData::globalScale = SharedData::fontScale = 0.5F;
|
||||
break;
|
||||
case 2:
|
||||
SharedData::globalScale = SharedData::fontScale = 1.0F;
|
||||
break;
|
||||
case 3:
|
||||
SharedData::globalScale = SharedData::fontScale = 1.5F;
|
||||
break;
|
||||
case 4:
|
||||
SharedData::globalScale = SharedData::fontScale = 2.0F;
|
||||
break;
|
||||
default:
|
||||
case 0:
|
||||
// Native scaling
|
||||
break;
|
||||
case 1:
|
||||
SharedData::globalScale = SharedData::fontScale = 0.5F;
|
||||
break;
|
||||
case 2:
|
||||
SharedData::globalScale = SharedData::fontScale = 1.0F;
|
||||
break;
|
||||
case 3:
|
||||
SharedData::globalScale = SharedData::fontScale = 1.5F;
|
||||
break;
|
||||
case 4:
|
||||
SharedData::globalScale = SharedData::fontScale = 2.0F;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -284,24 +281,24 @@ namespace hex::init {
|
||||
|
||||
std::vector<Task> getInitTasks() {
|
||||
return {
|
||||
{ "Checking for updates...", checkForUpdates },
|
||||
{ "Downloading information...", downloadInformation },
|
||||
{ "Creating directories...", createDirectories },
|
||||
{ "Loading settings...", loadSettings },
|
||||
{ "Loading plugins...", loadPlugins },
|
||||
{ "Loading fonts...", loadFonts },
|
||||
{"Checking for updates...", checkForUpdates },
|
||||
{ "Downloading information...", downloadInformation},
|
||||
{ "Creating directories...", createDirectories },
|
||||
{ "Loading settings...", loadSettings },
|
||||
{ "Loading plugins...", loadPlugins },
|
||||
{ "Loading fonts...", loadFonts },
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<Task> getExitTasks() {
|
||||
return {
|
||||
{ "Saving settings...", storeSettings },
|
||||
{ "Cleaning up shared data...", deleteSharedData },
|
||||
{ "Unloading plugins...", unloadPlugins },
|
||||
{"Saving settings...", storeSettings },
|
||||
{ "Cleaning up shared data...", deleteSharedData},
|
||||
{ "Unloading plugins...", unloadPlugins },
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<Argument>& getInitArguments() {
|
||||
std::vector<Argument> &getInitArguments() {
|
||||
static std::vector<Argument> initArguments;
|
||||
|
||||
return initArguments;
|
||||
|
||||
Reference in New Issue
Block a user