Skip to content

Commit

Permalink
Misc Clean Up
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuria-Shikibe committed Jun 11, 2024
1 parent c43fc8e commit e8ddaf2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/arc-impl/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void Core::initFileSystem() {
#if defined(ASSETS_DIR)
rootFileTree = OS::FileTree(ASSETS_DIR);
#else
const auto dir = Core::platform->getProcessFileDir();
const auto dir = Core::platform->getCurrentParentDir();

std::cout << "Targeted Resource Root:" << dir.absolutePath() << std::endl;

Expand Down
2 changes: 1 addition & 1 deletion src/arc/asset/LoaderRenderer.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export namespace Assets {
void update(){
if(!loader)return;
if(!loader->isFinished()) {
Font::defGlyphParser->parseWith(loadTasks, R"(loader->getCurrentProgress("$<alp#[0.3]>$<scl#[1.5]>", ">> ")");
Font::defGlyphParser->parseWith(loadTasks, R"($<alp#[0.3]>$<scl#[1.5]>Loading...)");
lastProgress = Math::lerp(lastProgress, loader->getCurrentProgress(), 0.075f);
}else {
Font::defGlyphParser->parseWith(loadTasks, "$<alp#[0.3]>$<scl#[1.8]>LOAD DONE");
Expand Down
1 change: 1 addition & 0 deletions src/arc/asset/load/AssetsLoadCore.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ namespace Assets::Load{

void LoadManager::afterArrival() noexcept{
if(std::to_underlying(currentPhase) < MaxPhaseCount){
//TODO move this to other place
std::println("[{}]: Phase {} Reached | {:.1f}% Completed.", taskName, std::to_underlying(currentPhase), calCurrentProgress() * 100.f);
std::cout.flush();
for (const auto task : tasks | std::views::keys){
Expand Down
15 changes: 13 additions & 2 deletions src/arc/asset/load/TexturePacker.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ namespace Assets::Load{
ext::json::JsonSrlContBase_string_map<PackData, true>::write(pageJsonValue.asObject()[ext::json::keys::Value], fragments);

std::ofstream stream{getDataFile().getPath()};
stream << pageJsonValue;
std::print(stream, "{:nf0}", pageJsonValue);
}

//TODO load by cache
Expand Down Expand Up @@ -339,11 +339,16 @@ namespace Assets::Load{
pageData.allPages = &pagesToPack;
}

progress = .1f;

break;
case Phase::pull:
for (auto& pageData : pagesToPack | std::views::values){
pageData.loadPulledData();
}

progress = .3f;

break;
case Phase::load:{
loadPages();
Expand All @@ -352,6 +357,8 @@ namespace Assets::Load{
pageData.applyTextureToRegion();
}

progress = .5f;

break;
}
case Phase::post_load:{
Expand All @@ -362,7 +369,11 @@ namespace Assets::Load{
}

try{
std::ranges::for_each(cacheTasks, &std::future<void>::get);
for (std::future<void>& cacheTask : cacheTasks){
cacheTask.get();

progress += .5f / static_cast<float>(cacheTasks.size());
}
}catch(...){
handler.throwException(std::current_exception());
}
Expand Down
3 changes: 1 addition & 2 deletions src/ext/Json.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,8 @@ namespace ext::json{

std::unreachable();
}
}

export namespace ext::json{
export
[[nodiscard]] JsonValue parse(const std::string_view view){
return parseJsonFromString(view);
}
Expand Down

0 comments on commit e8ddaf2

Please sign in to comment.