public Sprite(int number, int width, int height, int colorDepth, SpriteImportResolution importRes, bool alphaChannel) { _number = number; _width = width; _height = height; _colorDepth = colorDepth; _resolution = importRes; _alphaChannel = alphaChannel; }
/// <summary> /// Tests if its possible to "promote" sprite's resolution to "Real" /// if it is matching current game resolution type. /// </summary> public static SpriteImportResolution FixupSpriteResolution(SpriteImportResolution res) { if (res == SpriteImportResolution.Real || Factory.AGSEditor.CurrentGame.IsHighResolution && res == SpriteImportResolution.HighRes || !Factory.AGSEditor.CurrentGame.IsHighResolution && res == SpriteImportResolution.LowRes) { return(SpriteImportResolution.Real); } return(res); }
public Sprite(XmlNode node) { _number = Convert.ToInt32(node.Attributes["Slot"].InnerText); _width = Convert.ToInt32(node.Attributes["Width"].InnerText); _height = Convert.ToInt32(node.Attributes["Height"].InnerText); _colorDepth = Convert.ToInt32(node.Attributes["ColorDepth"].InnerText); if (node.Attributes["AlphaChannel"] != null) { _alphaChannel = Convert.ToBoolean(node.Attributes["AlphaChannel"].InnerText); } if (node.SelectSingleNode("Source") != null) { XmlNode sourceNode = node.SelectSingleNode("Source"); _sourceFile = SerializeUtils.GetElementString(sourceNode, "FileName"); } if (node.Attributes["ColoursLockedToRoom"] != null) { _coloursLockedToRoom = Convert.ToInt32(node.Attributes["ColoursLockedToRoom"].InnerText); } _resolution = (SpriteImportResolution)Enum.Parse(typeof(SpriteImportResolution), node.Attributes["Resolution"].InnerText); }
public Sprite(XmlNode node) { _number = Convert.ToInt32(node.Attributes["Slot"].InnerText); _width = Convert.ToInt32(node.Attributes["Width"].InnerText); _height = Convert.ToInt32(node.Attributes["Height"].InnerText); _colorDepth = Convert.ToInt32(node.Attributes["ColorDepth"].InnerText); _resolution = (SpriteImportResolution)Enum.Parse(typeof(SpriteImportResolution), node.Attributes["Resolution"].InnerText); if (node.Attributes["AlphaChannel"] != null) { _alphaChannel = Convert.ToBoolean(node.Attributes["AlphaChannel"].InnerText); } if (node.Attributes["ColoursLockedToRoom"] != null) { _coloursLockedToRoom = Convert.ToInt32(node.Attributes["ColoursLockedToRoom"].InnerText); } if (node.SelectSingleNode("Source") != null) { XmlNode sourceNode = node.SelectSingleNode("Source"); try { _sourceFile = SerializeUtils.GetElementString(sourceNode, "FileName"); // added in XML version 17 _offsetX = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "OffsetX")); _offsetY = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "OffsetY")); _frame = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "Frame")); _remapToGamePalette = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "RemapToGamePalette")); _remapToRoomPalette = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "RemapToRoomPalette")); _tranparentColour = (SpriteImportTransparency)Enum.Parse(typeof(SpriteImportTransparency), SerializeUtils.GetElementString(sourceNode, "ImportMethod")); } catch (InvalidDataException) { // pass } // added with fixup task in XML version 20 try { _importAlphaChannel = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "ImportAlphaChannel")); } catch (InvalidDataException) { _importAlphaChannel = true; } // added with fixup task in XML Version 23 try { _importWidth = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "ImportWidth")); _importHeight = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "ImportHeight")); } catch (InvalidDataException) { _importWidth = _width; _importHeight = _height; } // added with fixup task in XML Version 24 try { _importAsTile = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "ImportAsTile")); } catch (InvalidDataException) { _importAsTile = false; } } }
public SpriteInfo(int width, int height, SpriteImportResolution res) { Width = width; Height = height; Resolution = res; }