mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-18 20:16:44 -04:00
Added FSO.Files for use with the API server
Don't ask me. FreeSO is the prime example of dependency hell.
This commit is contained in:
parent
4b5e584eeb
commit
8fec258215
104 changed files with 14653 additions and 163 deletions
39
server/tso.files/Formats/IFF/Chunks/BMP.cs
Executable file
39
server/tso.files/Formats/IFF/Chunks/BMP.cs
Executable file
|
@ -0,0 +1,39 @@
|
|||
using System.IO;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace FSO.Files.Formats.IFF.Chunks
|
||||
{
|
||||
/// <summary>
|
||||
/// This chunk type holds an image in BMP format.
|
||||
/// </summary>
|
||||
public class BMP : IffChunk
|
||||
{
|
||||
public byte[] data;
|
||||
|
||||
/// <summary>
|
||||
/// Reads a BMP chunk from a stream.
|
||||
/// </summary>
|
||||
/// <param name="iff">An Iff instance.</param>
|
||||
/// <param name="stream">A Stream object holding a BMP chunk.</param>
|
||||
public override void Read(IffFile iff, Stream stream)
|
||||
{
|
||||
data = new byte[stream.Length];
|
||||
stream.Read(data, 0, (int)stream.Length);
|
||||
}
|
||||
|
||||
public Texture2D GetTexture(GraphicsDevice device)
|
||||
{
|
||||
var tex = ImageLoader.FromStream(device, new MemoryStream(data));
|
||||
return tex;
|
||||
//return Texture2D.FromStream(device, new MemoryStream(data));
|
||||
}
|
||||
|
||||
public override bool Write(IffFile iff, Stream stream)
|
||||
{
|
||||
stream.Write(data, 0, data.Length);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue