Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Modding:Modder Guide/APIs/Content
(view source)
Revision as of 03:00, 28 November 2022
208 bytes added
,
03:00, 28 November 2022
→Use IRawTextureData
Line 478:
Line 478:
IRawTextureData image = this.Helper.ModContent.Load<IRawTextureData>("assets/image.png");
IRawTextureData image = this.Helper.ModContent.Load<IRawTextureData>("assets/image.png");
−
for (int i = 0; i <
image.Data.Length
; i++)
+
int pixelCount = image.Width * image.Height;
+
for (int i = 0; i <
pixelCount
; i++)
{
{
Color color = image.Data[i];
Color color = image.Data[i];
Line 488:
Line 489:
}
}
</syntaxhighlight>
</syntaxhighlight>
+
+
(Note: while SMAPI's implementation of IRawTextureData is exactly as long as it needs to be, this may not be the case for implementations of IRawTextureData from mods.)
===Compare asset names===
===Compare asset names===
Atravita
528
edits
Navigation menu
Personal tools
Create account
Log in
Namespaces
Modding
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Admin noticeboard
Help Editing
Random page
Official Links
Official Site
Official Forums
Official Merchandise
Discord
Reddit
Tools
Upload file
Special pages
Printable version