Ejemplo n.º 1
0
        /**
         */
        public VisualParticle[] GetVisualParticlesList()
        {
            try
            {
                int bufSize = ParticlePool_GetVisualParticlesListCount(nativePtr);
                if (bufSize == 0)
                {
                    return(null);
                }
                IntPtr[]         floats   = new IntPtr[bufSize];
                VisualParticle[] toReturn = new VisualParticle[bufSize];

                ParticlePool_GetVisualParticlesList(nativePtr, floats, bufSize);

                for (int i = 0; i < floats.Length; i++)
                {
                    //IntPtr scalePtr = floats[i];
                    //Type type = typeof(VisualParticle);
                    //VisualParticle retVal = (VisualParticle)(Marshal.PtrToStructure(scalePtr, type));
                    VisualParticle retVal = new VisualParticle(floats[i]);
                    toReturn[i] = retVal;
                }
                return(toReturn);
            }
            catch (Exception e) { Console.WriteLine(e.Message + "@" + e.Source); }
            return(null);
        }
Ejemplo n.º 2
0
        internal static VisualParticle GetInstances(IntPtr ptr)
        {
            if (visualParticleInstances == null)
            {
                visualParticleInstances = new Dictionary <IntPtr, VisualParticle>();
            }

            VisualParticle newvalue;

            if (visualParticleInstances.TryGetValue(ptr, out newvalue))
            {
                return(newvalue);
            }
            newvalue = VisualParticle.GetInstances(ptr);
            visualParticleInstances.Add(ptr, newvalue);
            return(newvalue);
        }