mirror of
				https://github.com/MaddyThorson/StrawberryBF.git
				synced 2025-11-04 01:41:33 +08:00 
			
		
		
		
	Aseprite loading fix. Draw.Sprite overload
This commit is contained in:
		@ -243,15 +243,18 @@ namespace Strawberry
 | 
			
		||||
				LoadSpritesDir(path);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			for (let file in Directory.EnumerateFiles(directory, "*.ase"))
 | 
			
		||||
			for (let file in Directory.EnumerateFiles(directory, "*.ase*"))
 | 
			
		||||
			{
 | 
			
		||||
				let path = scope String();
 | 
			
		||||
				file.GetFilePath(path);
 | 
			
		||||
				let sprite = new [Friend]Sprite(path);
 | 
			
		||||
 | 
			
		||||
				path.Remove(0, ContentRoot.Length + 9);
 | 
			
		||||
				path.RemoveFromEnd(4);
 | 
			
		||||
				Sprites.Add(new String(path), sprite);
 | 
			
		||||
				if (path.EndsWith(".ase") || path.EndsWith(".aseprite"))
 | 
			
		||||
				{
 | 
			
		||||
					let sprite = new [Friend]Sprite(path);
 | 
			
		||||
	
 | 
			
		||||
					path.Remove(0, ContentRoot.Length + 9);
 | 
			
		||||
					path.RemoveFromEnd(path.Length - path.IndexOf('.'));
 | 
			
		||||
					Sprites.Add(new String(path), sprite);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -65,5 +65,13 @@ namespace Strawberry
 | 
			
		||||
			SDL.Rect dst = Strawberry.Rect(position.X - Camera.X, position.Y - Camera.Y, sprite.Width, sprite.Height);
 | 
			
		||||
			SDL.RenderCopy(Game.Renderer, sprite[frame].Texture, &src, &dst);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		static public void Sprite(Sprite sprite, int frame, Point position, Point origin, float rotation)
 | 
			
		||||
		{
 | 
			
		||||
			SDL.Point cnt = origin;
 | 
			
		||||
			SDL.Rect src = Strawberry.Rect(0, 0, sprite.Width, sprite.Height);
 | 
			
		||||
			SDL.Rect dst = Strawberry.Rect(position.X - Camera.X, position.Y - Camera.Y, sprite.Width, sprite.Height);
 | 
			
		||||
			SDL.RenderCopyEx(Game.Renderer, sprite[frame].Texture, &src, &dst, rotation, &cnt, .None);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -55,6 +55,11 @@ namespace Strawberry
 | 
			
		||||
			return Point((int)a.X, (int)a.Y);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		static public implicit operator SDL2.SDL.Point(Point a)
 | 
			
		||||
		{
 | 
			
		||||
			return .((int32)a.X, (int32)a.Y);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		static public bool operator==(Point a, Point b)
 | 
			
		||||
		{
 | 
			
		||||
			return a.X == b.X && a.Y == b.Y;
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user