void BuildGlyphs()
        {
            if (Glyphs == null)
            {
                Glyphs = new List <Glyph>();
            }

            Glyphs.Clear();
            float innerWidth  = Size.X - Border.X * 2;
            float innerHeight = Size.Y - Border.Y * 2;

            Glyphs.Add(GetGlyph(Orientation.TopLeft, new Vector3(0, 0, 0), new Vector2(Border.X, Border.Y), TextureSize));
            Glyphs.Add(GetGlyph(Orientation.Top, new Vector3(Border.X, 0, 0), new Vector2(innerWidth, Border.Y), TextureSize));
            Glyphs.Add(GetGlyph(Orientation.TopRight, new Vector3(Border.X + innerWidth, 0, 0), new Vector2(Border.X, Border.Y), TextureSize));
            Glyphs.Add(GetGlyph(Orientation.Left, new Vector3(0, Border.Y, 0), new Vector2(Border.X, innerHeight), TextureSize));
            Glyphs.Add(GetGlyph(Orientation.Right, new Vector3(Border.X + innerWidth, Border.Y, 0), new Vector2(Border.X, innerHeight), TextureSize));
            Glyphs.Add(GetGlyph(Orientation.BottomLeft, new Vector3(0, Border.Y + innerHeight, 0), new Vector2(Border.X, Border.Y), TextureSize));
            Glyphs.Add(GetGlyph(Orientation.Bottom, new Vector3(Border.X, Border.Y + innerHeight, 0), new Vector2(innerWidth, Border.Y), TextureSize));
            Glyphs.Add(GetGlyph(Orientation.BottomRight, new Vector3(Border.X + innerWidth, Border.Y + innerHeight, 0), new Vector2(Border.X, Border.Y), TextureSize));

            if (BackgroundStyle == BorderBackgroundStyle.Inner)
            {
                Glyphs.Add(GetGlyph(Orientation.Center, new Vector3(Border.X, Border.Y, 0), new Vector2(innerWidth, innerHeight), TextureSize));
            }
            else
            {
                Glyphs.Add(GetGlyph(Orientation.Center, new Vector3(0, 0, 0), new Vector2(Border.X, Border.Y), TextureSize));
            }
        }
示例#2
0
        public void Dispose()
        {
            if (!IsDisposed)
            {
                Resource?.Dispose();
                Texture?.Dispose();
                Glyphs?.Clear();
                Image?.Dispose();

                Resource = null;
                Texture  = null;
                Image    = null;

                IsDisposed = true;
            }
        }
示例#3
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            // Get rid of this font from its factory cache when its disposed. Otherwise it'll live on in a half initialized state.
            Factory?.UnregisterFont(this);

            foreach (GorgonTexture2D texture in _internalTextures)
            {
                texture?.Dispose();
            }

            var brush = _info.Brush as IDisposable;

            brush?.Dispose();
            _internalTextures.Clear();
            KerningPairs.Clear();
            Glyphs.Clear();
        }
示例#4
0
        public static void Update()
        {
            // Keep the frame stuck so we can do a bunch of injecting at once.
            using (StyxWoW.Memory.AcquireFrame())
            {
                CurrentSpec = StyxWoW.Me.Specialization;

                Talents.Clear();
                TalentId = new int[6];

                // Always 18 talents. 6 rows of 3 talents.
                for (int index = 1; index <= 6 * 3; index++)
                {
                    var selected =
                        Lua.GetReturnVal <bool>(
                            string.Format(
                                "local t= select(5,GetTalentInfo({0})) if t == true then return 1 end return nil", index),
                            0);
                    var t = new Talent {
                        Index = index, Selected = selected
                    };
                    Talents.Add(t);

                    TalentId[(index - 1) / 3] = index;
                }

                Glyphs.Clear();
                GlyphId = new int[6];

                // 6 glyphs all the time. Plain and simple!
                for (int i = 1; i <= 6; i++)
                {
                    List <string> glyphInfo = Lua.GetReturnValues(String.Format("return GetGlyphSocketInfo({0})", i));

                    // add check for 4 members before access because empty sockets weren't returning 'nil' as documented
                    if (glyphInfo != null && glyphInfo.Count >= 4 && glyphInfo[3] != "nil" &&
                        !string.IsNullOrEmpty(glyphInfo[3]))
                    {
                        GlyphId[i - 1] = int.Parse(glyphInfo[3]);
                        Glyphs.Add(WoWSpell.FromId(GlyphId[i - 1]).Name.Replace("Glyph of ", ""));
                    }
                }
            }
        }