forked from cardoso/ODK-FrameLib
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCImageFrame.cs
More file actions
47 lines (40 loc) · 1.26 KB
/
Copy pathCImageFrame.cs
File metadata and controls
47 lines (40 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace FrameLib
{
public class CImageFrame
{
//The following fields are, in order, an accurate representation of a DarkEden Frame
/// <summary>
/// The ID of the sprite associated with this frame.
/// </summary>
public UInt16 SpriteID;
/// <summary>
/// The X offset to be applied
/// </summary>
public Int16 X;
/// <summary>
/// The Y offset to be applied
/// </summary>
public Int16 Y;
/// <summary>
/// Initializes a new instance of CImageFrame from a valid FileStream.
/// </summary>
/// <param name="file">The FileStream as it would be read by DarkEden.</param>
public CImageFrame(ref FileStream file)
{
byte[] _spriteid = new byte[2];
byte[] _x = new byte[2];
byte[] _y = new byte[2];
file.Read(_spriteid, 0, 2);
file.Read(_x, 0, 2);
file.Read(_y, 0, 2);
this.SpriteID = BitConverter.ToUInt16(_spriteid, 0);
this.X = BitConverter.ToInt16(_x, 0);
this.Y = BitConverter.ToInt16(_y, 0);
}
}
}