/// <summary> /// Constructor /// </summary> /// <param name="attributes"></param> public BitmapImage(XMLAttributes attributes) : this(attributes.GetValueAsString(ImageNameAttribute), System.GetSingleton().GetRenderer() .GetTexture(attributes.GetValueAsString(ImageTextureAttribute)), new Rectf(new Lunatics.Mathematics.Vector2(attributes.GetValueAsInteger(ImageXPosAttribute), attributes.GetValueAsInteger(ImageYPosAttribute)), new Sizef(attributes.GetValueAsInteger(ImageWidthAttribute), attributes.GetValueAsInteger(ImageHeightAttribute))), new Lunatics.Mathematics.Vector2(attributes.GetValueAsInteger(ImageXOffsetAttribute), attributes.GetValueAsInteger(ImageYOffsetAttribute)), PropertyHelper.FromString <AutoScaledMode>(attributes.GetValueAsString(ImageAutoScaledAttribute)), new Sizef(attributes.GetValueAsInteger(ImageNativeHorzResAttribute, 640), attributes.GetValueAsInteger(ImageNativeVertResAttribute, 480))) { }
/// <summary> /// handles the opening Mapping XML element. /// </summary> /// <param name="attributes"></param> private void ElementMappingStart(XMLAttributes attributes) { if (_font == null) { throw new InvalidRequestException("Attempt to access null object."); } // double-check font type just in case - report issues as 'soft' errors if (_font.GetTypeName() != FontTypePixmap) { System.GetSingleton().Logger.LogEvent( "Imageset_xmlHandler::elementMappingStart: <Mapping> element is " + "only valid for Pixmap type fonts.", LoggingLevel.Errors); } else { ((PixmapFont)_font).DefineMapping( (char)attributes.GetValueAsInteger(MappingCodepointAttribute), attributes.GetValueAsString(MappingImageAttribute), attributes.GetValueAsFloat(MappingHorzAdvanceAttribute, -1.0f)); } }