protected override void BuildIconTexture(DrawArgs drawArgs) { base.BuildIconTexture(drawArgs); try { // if secondary icon enabled if (this.m_iconTexture2Show && this.m_iconTexture2Name.Trim() != String.Empty) { if (this.m_iconTexture2 != null) { this.m_iconTexture2.ReferenceCount--; } this.m_iconTexture2 = (IconTexture)DrawArgs.Textures[this.m_iconTexture2Name]; if (this.m_iconTexture2 == null) { this.m_iconTexture2 = new IconTexture(drawArgs.device, this.m_iconTexture2Name); DrawArgs.Textures.Add(this.m_iconTexture2Name, this.m_iconTexture2); } if (this.m_iconTexture2 != null) { this.m_iconTexture2.ReferenceCount++; } } // if teritary icon enabled if (this.m_iconTexture3Show && this.m_iconTexture3Name.Trim() != String.Empty) { if (this.m_iconTexture3 != null) { this.m_iconTexture3.ReferenceCount--; } this.m_iconTexture3 = (IconTexture)DrawArgs.Textures[this.m_iconTexture3Name]; if (this.m_iconTexture3 == null) { this.m_iconTexture3 = new IconTexture(drawArgs.device, this.m_iconTexture3Name); DrawArgs.Textures.Add(this.m_iconTexture3Name, this.m_iconTexture3); } if (this.m_iconTexture3 != null) { this.m_iconTexture3.ReferenceCount++; } } } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } this.m_newTexture = false; }
public override void Initialize(DrawArgs drawArgs) { if (!this.isOn) { return; } if (!this.isInitialized) { string textureFilePath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"Data\Icons\sol_wh.gif"); this.m_pointTexture = new IconTexture(drawArgs.device, textureFilePath); // This could be off since the texture is scaled this.SelectionRectangle = new Rectangle(0, 0, this.m_pointTexture.Width, this.m_pointTexture.Height); // Center the box at (0,0) this.SelectionRectangle.Offset(-this.SelectionRectangle.Width / 2, -this.SelectionRectangle.Height / 2); } this.isInitialized = true; }