Skip to content

Commit

Permalink
* [editor] tilesheet editor, animation editor crash
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualGMQ committed Apr 13, 2024
1 parent 84974af commit 93fa9fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
7 changes: 6 additions & 1 deletion editor/src/anim_editor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
class Sequence {
public:
Sequence()
: animMgr{*nickel::ECS::Instance().World().res_mut<nickel::AnimationManager>()} {}
: player{*nickel::ECS::Instance()
.World()
.res_mut<nickel::AnimationManager>()},
animMgr{*nickel::ECS::Instance()
.World()
.res_mut<nickel::AnimationManager>()} {}

int GetItemCount() const {
if (!animMgr.Has(player.Anim())) {
Expand Down
2 changes: 0 additions & 2 deletions nickel/include/anim/anim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,6 @@ class AnimationPlayer final {

using animation_type = Animation;

AnimationPlayer() = default;

explicit AnimationPlayer(AnimationManager& mgr) : mgr_(&mgr) {}

AnimationPlayer(const AnimationPlayer&) = delete;
Expand Down
18 changes: 9 additions & 9 deletions nickel/src/graphics/tilesheet.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "graphics/tilesheet.hpp"
#include "misc/asset_manager.hpp"

#define RAPIDXML_NO_EXCEPTIONS
#include "rapidxml.hpp"
Expand Down Expand Up @@ -110,15 +111,14 @@ std::unique_ptr<Tilesheet> LoadAssetFromMeta(const toml::table& tbl) {
TilesheetHandle TilesheetManager::Create(TextureHandle handle, uint32_t col,
uint32_t row, const Margin& margin,
const Spacing& spacing) {
// auto elem =
// std::make_unique<Tilesheet>(gWorld->res<AssetManager>()->TextureMgr(),
// handle, col, row, margin, spacing);
// if (elem && *elem) {
// auto handle = TilesheetHandle::Create();
// storeNewItem(handle, std::move(elem));
// return handle;
// }
return TilesheetHandle::Null();
auto elem = std::make_unique<Tilesheet>(
ECS::Instance().World().res<AssetManager>()->TextureMgr(), handle, col,
row, margin, spacing);
if (elem && *elem) {
auto handle = TilesheetHandle::Create();
storeNewItem(handle, std::move(elem));
return handle;
}
}

TilesheetHandle TilesheetManager::Load(const std::filesystem::path& filename) {
Expand Down

0 comments on commit 93fa9fb

Please sign in to comment.