public GMBackground(ProjectReader reader) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); // version that we don't care about here. UseAsTileset = reader.ReadBoolean(); TileWidth = reader.ReadInt32(); TileHeight = reader.ReadInt32(); OffsetH = reader.ReadInt32(); OffsetV = reader.ReadInt32(); SepH = reader.ReadInt32(); SepV = reader.ReadInt32(); FrameVersion = reader.ReadInt32(); // frame version int Width, Height; Width = reader.ReadInt32(); Height = reader.ReadInt32(); Background = null; if (Width * Height != 0) { Background = reader.ReadBGRAImage(Width, Height); } reader.Dispose(); }
public GMSprite(ProjectReader reader) { Name = reader.ReadString(); LastChanged = reader.ReadDate(); Version = reader.ReadInt32(); if (Version != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } int _x = reader.ReadInt32(); int _y = reader.ReadInt32(); Origin = new Point(_x, _y); int framenum = reader.ReadInt32(); Subimages = new List <Image>(framenum); for (int i = 0; i < framenum; i++) { int framever = reader.ReadInt32(); if (framever != 800) { throw new InvalidDataException("This library only supports .gmk GM8.0 files."); } Width = reader.ReadInt32(); Height = reader.ReadInt32(); if (Width * Height != 0) { Subimages.Add(reader.ReadBGRAImage(Width, Height)); } else { Subimages.Add(null); // ???? } } MaskMode = (SpriteMaskMode)reader.ReadInt32(); AlphaTolerance = reader.ReadInt32(); SeparateMasks = reader.ReadBoolean(); BBoxMode = (SpriteBBoxMode)reader.ReadInt32(); int _l = reader.ReadInt32(); int _r = reader.ReadInt32(); int _b = reader.ReadInt32(); int _t = reader.ReadInt32(); BBox = new Rectangle(_l, _r, _b, _t); reader.Dispose(); }