Ejemplo n.º 1
0
        public CCTexture2D AddRawImage <T>(T[] data, int width, int height, string assetName, CCSurfaceFormat format,
                                           bool premultiplied, bool mipMap, CCSize contentSize) where T : struct
        {
            CCTexture2D texture;

            lock (dictLock)
            {
                if (!textures.TryGetValue(assetName, out texture))
                {
                    texture = new CCTexture2D();
                    texture.InitWithRawData(data, format, width, height, premultiplied, mipMap, contentSize);
                    textures.Add(assetName, texture);
                }
            }
            return(texture);
        }
Ejemplo n.º 2
0
        protected override void Draw()
        {
            if (isFontDirty)
            {
                FontConfiguration = InitializeFont(fontName, fontSize, Text);
                isFontDirty       = false;
            }

            if (isTextureDirty)
            {
                labelTexture.InitWithRawData(m_pData, CCSurfaceFormat.Color, m_nWidth, m_nHeight, true, false);
                isTextureDirty = false;
            }

            base.Draw();
        }