Skip to content

Commit

Permalink
fix: path for loading proj from diff context
Browse files Browse the repository at this point in the history
  • Loading branch information
cherrynik committed Sep 27, 2023
1 parent eb9c6b5 commit 6036939
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Apps/GameDesktop/RootFeatureCompositionRoot.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Components;
using System;
using System.IO;
using Components;
using Components.World;
using Entitas;
using Features;
Expand All @@ -18,6 +20,9 @@ namespace GameDesktop;

public class RootFeatureCompositionRoot : ICompositionRoot
{
private static readonly string Path = System.IO.Path.Join(Directory.GetParent(AppContext.BaseDirectory)!.FullName,
"Content/SpriteSheets/Player.aseprite");

public void Compose(IServiceRegistry serviceRegistry)
{
RegisterServices(serviceRegistry);
Expand Down Expand Up @@ -76,8 +81,9 @@ private static void RegisterCreatePlayerEntitySystem(IServiceRegistry serviceReg
serviceRegistry.Register(factory =>
{
GraphicsDevice graphicsDevice = factory.GetInstance<SpriteBatch>().GraphicsDevice;
Console.WriteLine(Path);
SpriteSheet spriteSheet =
AnimatedCharactersFactory.LoadSpriteSheet(graphicsDevice, "Content/SpriteSheets/Player.aseprite");
AnimatedCharactersFactory.LoadSpriteSheet(graphicsDevice, Path);

var idleAnimations = AnimatedCharactersFactory.CreateAnimations(spriteSheet, "Idle");
var walkingAnimations = AnimatedCharactersFactory.CreateAnimations(spriteSheet, "Walking");
Expand Down Expand Up @@ -128,7 +134,7 @@ private void RegisterCreateStaticEntitySystem(IServiceRegistry serviceRegistry)
{
GraphicsDevice graphicsDevice = factory.GetInstance<SpriteBatch>().GraphicsDevice;
SpriteSheet spriteSheet =
AnimatedCharactersFactory.LoadSpriteSheet(graphicsDevice, "Content/SpriteSheets/Player.aseprite");
AnimatedCharactersFactory.LoadSpriteSheet(graphicsDevice, Path);

AnimatedSprite animatedSprite =
AnimatedCharactersFactory.CreateAnimations(spriteSheet, "Idle")[Direction.Down];
Expand Down

0 comments on commit 6036939

Please sign in to comment.