Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fit json loader into resource container protocol #102

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace action {

using SpriteAnimationTable = ::ugdk::structure::IndexableTable<SpriteAnimation>;

std::shared_ptr<const SpriteAnimationTable> LoadSpriteAnimationTableFromFile(const std::string& filepath);
const SpriteAnimationTable* LoadSpriteAnimationTableFromFile(const std::string& filepath);

} // namespace action
} // namespace ugdk
Expand Down
5 changes: 2 additions & 3 deletions modules/ugdk-core/src/action/json2spriteanimation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace {
};
}

std::shared_ptr<const SpriteAnimationTable> LoadSpriteAnimationTableFromFile(const std::string& filepath) {
const SpriteAnimationTable* LoadSpriteAnimationTableFromFile(const std::string& filepath) {
auto file = filesystem::manager().OpenFile(filepath);
if (!file)
return nullptr;
Expand All @@ -81,7 +81,7 @@ std::shared_ptr<const SpriteAnimationTable> LoadSpriteAnimationTableFromFile(con
throw system::BaseException("Invalid json: %s\n", filepath.c_str());

auto json_node = libjson::parse(contents);
std::shared_ptr<SpriteAnimationTable> table(new SpriteAnimationTable(json_node.size()));
SpriteAnimationTable* table(new SpriteAnimationTable(json_node.size()));
for (const auto& animation_json : json_node) {
auto element = MakeUnique<SpriteAnimation>();

Expand All @@ -108,4 +108,3 @@ std::shared_ptr<const SpriteAnimationTable> LoadSpriteAnimationTableFromFile(con

} // namespace action
} // namespace ugdk