forked from slothsoft/stardew-informant
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: multiple bundle decorator display (#9)
- Loading branch information
Showing
5 changed files
with
70 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Microsoft.Xna.Framework.Graphics; | ||
using Color = Microsoft.Xna.Framework.Color; | ||
using Rectangle = Microsoft.Xna.Framework.Rectangle; | ||
|
||
namespace Slothsoft.Informant.Helper; | ||
|
||
internal static class TextureBlitter | ||
{ | ||
public static Texture2D Blit(this Texture2D source, Rectangle rectangle, GraphicsDevice? device = null) | ||
{ | ||
device ??= Game1.graphics.GraphicsDevice; | ||
var texture = new Texture2D(device, rectangle.Width, rectangle.Height); | ||
Color[] data = new Color[rectangle.Width * rectangle.Height]; | ||
source.GetData(0, rectangle, data, 0, data.Length); | ||
texture.SetData(data); | ||
return texture; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters