/// <summary> /// Unloads the content. /// </summary> public override void UnloadContent() { Manager.ImageCompositor.Delete(this.CurrentTextureName); this.horizontalTextStripper = null; base.UnloadContent(); }
/// <summary> /// Called when graphics resources need to be loaded. /// Use this for the usage of : /// - creation of the internal embedded controls. /// - setting of the variables and resources in this control /// - to load any game-specific graphics resources /// - take over the config width and height and use it into State /// - overriding how this item looks like , by settings its texture or theme /// Call base.LoadContent before you do your override code, this will cause : /// - State.SourceRectangle to be reset to the Config.Size /// </summary> public override void LoadContent() { base.LoadContent(); this.UpdateDrawSizeByConfig(); // make the sprite font if (string.IsNullOrEmpty(this.ConfigFont)) { this.ConfigFont = Theme.FontName; } Manager.ImageCompositor.CreateSpriteFont(this.ConfigFont); // always fill the ConfigText-measurement , so we will always have a nonzero size.. this.currentText = !string.IsNullOrEmpty(this.currentText) ? this.currentText : "T"; // create the stripper ,this will create the StateTextShown from ConfigText this.horizontalTextStripper = new HorizontalTextStripper(Manager.ImageCompositor); // use the sprite-font to check how big the size would be this.UpdateTextWhenNeeded(); this.CurrentTextureName = Manager.ImageCompositor.CreateRectangleTexture( this.Name + "-ConfigText", (int)State.Width, (int)State.Height, 0, new GUIColor(128, 0, 0, 128), Theme.BorderColor); }