Skip to content

Commit 9182140

Browse files
committed
clang format
1 parent 40fc3a6 commit 9182140

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

src/resource/ResourceManager.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ bool ResourceManager::DidLoadSuccessfully() {
4545
return mArchiveManager != nullptr && mArchiveManager->IsArchiveLoaded();
4646
}
4747

48-
std::shared_ptr<File> ResourceManager::LoadFileProcess(const std::string& filePath, std::shared_ptr<ResourceInitData> initData) {
48+
std::shared_ptr<File> ResourceManager::LoadFileProcess(const std::string& filePath,
49+
std::shared_ptr<ResourceInitData> initData) {
4950
auto file = mArchiveManager->LoadFile(filePath, initData);
5051
if (file != nullptr) {
5152
SPDLOG_TRACE("Loaded File {} on ResourceManager", file->InitData->Path);
@@ -55,7 +56,8 @@ std::shared_ptr<File> ResourceManager::LoadFileProcess(const std::string& filePa
5556
return file;
5657
}
5758

58-
std::shared_ptr<IResource> ResourceManager::LoadResourceProcess(const std::string& filePath, bool loadExact, std::shared_ptr<ResourceInitData> initData) {
59+
std::shared_ptr<IResource> ResourceManager::LoadResourceProcess(const std::string& filePath, bool loadExact,
60+
std::shared_ptr<ResourceInitData> initData) {
5961
// Check for and remove the OTR signature
6062
if (OtrSignatureCheck(filePath.c_str())) {
6163
const auto newFilePath = filePath.substr(7);
@@ -136,8 +138,9 @@ std::shared_ptr<IResource> ResourceManager::LoadResourceProcess(const std::strin
136138
return resource;
137139
}
138140

139-
std::shared_future<std::shared_ptr<IResource>> ResourceManager::LoadResourceAsync(const std::string& filePath,
140-
bool loadExact, bool priority, std::shared_ptr<ResourceInitData> initData) {
141+
std::shared_future<std::shared_ptr<IResource>>
142+
ResourceManager::LoadResourceAsync(const std::string& filePath, bool loadExact, bool priority,
143+
std::shared_ptr<ResourceInitData> initData) {
141144
// Check for and remove the OTR signature
142145
if (OtrSignatureCheck(filePath.c_str())) {
143146
auto newFilePath = filePath.substr(7);
@@ -161,7 +164,8 @@ std::shared_future<std::shared_ptr<IResource>> ResourceManager::LoadResourceAsyn
161164
}
162165
}
163166

164-
std::shared_ptr<IResource> ResourceManager::LoadResource(const std::string& filePath, bool loadExact, std::shared_ptr<ResourceInitData> initData) {
167+
std::shared_ptr<IResource> ResourceManager::LoadResource(const std::string& filePath, bool loadExact,
168+
std::shared_ptr<ResourceInitData> initData) {
165169
auto resource = LoadResourceAsync(filePath, loadExact, true, initData).get();
166170
if (resource == nullptr) {
167171
SPDLOG_ERROR("Failed to load resource file at path {}", filePath);

src/resource/ResourceManager.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ class ResourceManager {
3030
std::shared_ptr<ArchiveManager> GetArchiveManager();
3131
std::shared_ptr<ResourceLoader> GetResourceLoader();
3232
std::shared_ptr<IResource> GetCachedResource(const std::string& filePath, bool loadExact = false);
33-
std::shared_ptr<IResource> LoadResource(const std::string& filePath, bool loadExact = false, std::shared_ptr<ResourceInitData> initData = nullptr);
34-
std::shared_ptr<IResource> LoadResourceProcess(const std::string& filePath, bool loadExact = false, std::shared_ptr<ResourceInitData> initData = nullptr);
33+
std::shared_ptr<IResource> LoadResource(const std::string& filePath, bool loadExact = false,
34+
std::shared_ptr<ResourceInitData> initData = nullptr);
35+
std::shared_ptr<IResource> LoadResourceProcess(const std::string& filePath, bool loadExact = false,
36+
std::shared_ptr<ResourceInitData> initData = nullptr);
3537
size_t UnloadResource(const std::string& filePath);
36-
std::shared_future<std::shared_ptr<IResource>> LoadResourceAsync(const std::string& filePath,
37-
bool loadExact = false, bool priority = false, std::shared_ptr<ResourceInitData> initData = nullptr);
38+
std::shared_future<std::shared_ptr<IResource>>
39+
LoadResourceAsync(const std::string& filePath, bool loadExact = false, bool priority = false,
40+
std::shared_ptr<ResourceInitData> initData = nullptr);
3841
std::shared_ptr<std::vector<std::shared_ptr<IResource>>> LoadDirectory(const std::string& searchMask);
3942
std::shared_ptr<std::vector<std::shared_future<std::shared_ptr<IResource>>>>
4043
LoadDirectoryAsync(const std::string& searchMask, bool priority = false);
@@ -43,7 +46,8 @@ class ResourceManager {
4346
bool OtrSignatureCheck(const char* fileName);
4447

4548
protected:
46-
std::shared_ptr<File> LoadFileProcess(const std::string& filePath, std::shared_ptr<ResourceInitData> initData = nullptr);
49+
std::shared_ptr<File> LoadFileProcess(const std::string& filePath,
50+
std::shared_ptr<ResourceInitData> initData = nullptr);
4751
std::shared_ptr<IResource> GetCachedResource(std::variant<ResourceLoadError, std::shared_ptr<IResource>> cacheLine);
4852
std::variant<ResourceLoadError, std::shared_ptr<IResource>> CheckCache(const std::string& filePath,
4953
bool loadExact = false);

src/resource/archive/Archive.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class Archive {
2323
void Load();
2424
void Unload();
2525

26-
virtual std::shared_ptr<File> LoadFile(const std::string& filePath, std::shared_ptr<ResourceInitData> initData = nullptr);
26+
virtual std::shared_ptr<File> LoadFile(const std::string& filePath,
27+
std::shared_ptr<ResourceInitData> initData = nullptr);
2728
virtual std::shared_ptr<File> LoadFile(uint64_t hash, std::shared_ptr<ResourceInitData> initData = nullptr);
2829
std::shared_ptr<std::unordered_map<uint64_t, std::string>> ListFiles();
2930
std::shared_ptr<std::unordered_map<uint64_t, std::string>> ListFiles(const std::string& filter);

src/resource/archive/ArchiveManager.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ bool ArchiveManager::IsArchiveLoaded() {
4040
return !mArchives.empty();
4141
}
4242

43-
std::shared_ptr<File> ArchiveManager::LoadFile(const std::string& filePath, std::shared_ptr<ResourceInitData> initData) {
43+
std::shared_ptr<File> ArchiveManager::LoadFile(const std::string& filePath,
44+
std::shared_ptr<ResourceInitData> initData) {
4445
if (filePath == "") {
4546
return nullptr;
4647
}

src/window/gui/GameOverlay.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ void GameOverlay::LoadFont(const std::string& name, const std::string& path, flo
2323
initData->Format = RESOURCE_FORMAT_BINARY;
2424
initData->Type = static_cast<uint32_t>(RESOURCE_TYPE_FONT);
2525
initData->ResourceVersion = 0;
26-
std::shared_ptr<Font> font = std::static_pointer_cast<Font>(Context::GetInstance()->GetResourceManager()->LoadResource(path, false, initData));
26+
std::shared_ptr<Font> font = std::static_pointer_cast<Font>(
27+
Context::GetInstance()->GetResourceManager()->LoadResource(path, false, initData));
2728
if (font != nullptr) {
2829
mFonts[name] = io.Fonts->AddFontFromMemoryTTF(font->Data.data(), font->Data.size(), fontSize);
2930
}
@@ -130,7 +131,9 @@ ImVec2 GameOverlay::CalculateTextSize(const char* text, const char* textEnd, boo
130131
}
131132

132133
void GameOverlay::Init() {
133-
Context::GetInstance()->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(std::make_shared<ResourceFactoryBinaryFontV0>(), RESOURCE_FORMAT_BINARY, "Font", static_cast<uint32_t>(RESOURCE_TYPE_FONT), 0);
134+
Context::GetInstance()->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
135+
std::make_shared<ResourceFactoryBinaryFontV0>(), RESOURCE_FORMAT_BINARY, "Font",
136+
static_cast<uint32_t>(RESOURCE_TYPE_FONT), 0);
134137
LoadFont("Press Start 2P", "fonts/PressStart2P-Regular.ttf", 12.0f);
135138
LoadFont("Fipps", "fonts/Fipps-Regular.otf", 32.0f);
136139
const std::string defaultFont = mFonts.begin()->first;

0 commit comments

Comments
 (0)