Load sys fonts if assets dir not found, return err if unsupported
This commit is contained in:
@@ -55,10 +55,6 @@ class ExperimentFlags {
|
|||||||
// Use the new platform specific file dialog wrappers.
|
// Use the new platform specific file dialog wrappers.
|
||||||
bool kNewFileDialogWrapper = true;
|
bool kNewFileDialogWrapper = true;
|
||||||
|
|
||||||
// Platform specific loading of fonts from the system. Currently
|
|
||||||
// only supports macOS.
|
|
||||||
bool kLoadSystemFonts = true;
|
|
||||||
|
|
||||||
// Uses texture streaming from SDL for my dynamic updates.
|
// Uses texture streaming from SDL for my dynamic updates.
|
||||||
bool kLoadTexturesAsStreaming = true;
|
bool kLoadTexturesAsStreaming = true;
|
||||||
|
|
||||||
@@ -125,8 +121,6 @@ class ExperimentFlags {
|
|||||||
std::to_string(flags_->kDrawDungeonRoomGraphics) + "\n";
|
std::to_string(flags_->kDrawDungeonRoomGraphics) + "\n";
|
||||||
result += "kNewFileDialogWrapper: " +
|
result += "kNewFileDialogWrapper: " +
|
||||||
std::to_string(flags_->kNewFileDialogWrapper) + "\n";
|
std::to_string(flags_->kNewFileDialogWrapper) + "\n";
|
||||||
result +=
|
|
||||||
"kLoadSystemFonts: " + std::to_string(flags_->kLoadSystemFonts) + "\n";
|
|
||||||
result += "kLoadTexturesAsStreaming: " +
|
result += "kLoadTexturesAsStreaming: " +
|
||||||
std::to_string(flags_->kLoadTexturesAsStreaming) + "\n";
|
std::to_string(flags_->kLoadTexturesAsStreaming) + "\n";
|
||||||
result +=
|
result +=
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
@@ -402,10 +403,19 @@ absl::Status Controller::CreateGuiContext() {
|
|||||||
Renderer::GetInstance().renderer());
|
Renderer::GetInstance().renderer());
|
||||||
ImGui_ImplSDLRenderer2_Init(Renderer::GetInstance().renderer());
|
ImGui_ImplSDLRenderer2_Init(Renderer::GetInstance().renderer());
|
||||||
|
|
||||||
if (flags()->kLoadSystemFonts) {
|
// Check if the assets/fonts directory exists in our CWD
|
||||||
LoadSystemFonts();
|
// Otherwise, load the system fonts.
|
||||||
} else {
|
const auto assets_path = std::filesystem::path("assets");
|
||||||
|
if (std::filesystem::is_directory(assets_path)) {
|
||||||
RETURN_IF_ERROR(LoadFontFamilies());
|
RETURN_IF_ERROR(LoadFontFamilies());
|
||||||
|
} else {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LoadSystemFonts();
|
||||||
|
#else
|
||||||
|
return absl::InternalError(
|
||||||
|
"Could not find assets/fonts directory in the current working "
|
||||||
|
"directory");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the default style
|
// Set the default style
|
||||||
|
|||||||
Reference in New Issue
Block a user