From eefc0547eb8d3cbfde289b1e294c6a132c3fa57c Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Sun, 3 Jan 2021 00:32:36 -0800 Subject: [PATCH] pulled latest blah fixes --- libs/blah | 2 +- src/content.cpp | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/libs/blah b/libs/blah index d8930f1..cc5e222 160000 --- a/libs/blah +++ b/libs/blah @@ -1 +1 @@ -Subproject commit d8930f15ac4583206855e03c5f246187072a8526 +Subproject commit cc5e222be5545d3fd02e61cf0a0afb50407c2578 diff --git a/src/content.cpp b/src/content.cpp index d3a8f8c..b2e3320 100644 --- a/src/content.cpp +++ b/src/content.cpp @@ -117,29 +117,34 @@ void Content::load() // add sprites for (auto& info : sprite_info) { - Sprite* sprite = sprites.expand(); - sprite->name = info.name; - sprite->origin = Vec2::zero; + Sprite sprite; + sprite.name = info.name; + sprite.origin = Vec2::zero; if (info.aseprite.slices.size() > 0 && info.aseprite.slices[0].has_pivot) { - sprite->origin = Vec2( + sprite.origin = Vec2( info.aseprite.slices[0].pivot.x, info.aseprite.slices[0].pivot.y); } for (auto& tag : info.aseprite.tags) { - Sprite::Animation* anim = sprite->animations.expand(); - anim->name = tag.name; + Sprite::Animation anim; + anim.name = tag.name; for (int i = tag.from; i <= tag.to; i++) { - Sprite::Frame* frame = anim->frames.expand(); - frame->duration = info.aseprite.frames[i].duration / 1000.0f; - frame->image = subtextures[info.pack_index + i]; + Sprite::Frame frame; + frame.duration = info.aseprite.frames[i].duration / 1000.0f; + frame.image = subtextures[info.pack_index + i]; + anim.frames.push_back(frame); } + + sprite.animations.push_back(anim); } + + sprites.push_back(sprite); } // add tilesets