Beispiel #1
0
 public Image()
 {
     this.name        = Name.Uninitialized;
     this.pTexture    = null;
     this.poImageRect = new Azul.Rect();
     Debug.Assert(poImageRect != null);
 }
Beispiel #2
0
        public static Image Add(Image.Name ImageName, Texture.Name TextureName, float x, float y, float width, float height)
        {
            ImageMan pMan = ImageMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            Image pNode = (Image)pMan.BaseAdd();

            Debug.Assert(pNode != null);

            // Initialize the data
            Texture pTexture = TextureMan.Find(TextureName);

            //Debug.Assert(pTexture != null);
            if (pTexture == null)
            {
                pTexture = TextureMan.Find(Texture.Name.Default);
                Debug.Assert(pTexture != null);
                x      = 0;
                y      = 0;
                width  = 128;
                height = 128;
            }

            pNode.Set(ImageName, pTexture, x, y, width, height);

            return(pNode);
        }
Beispiel #3
0
        public static Image Find(Image.Name name)
        {
            instance.pNodeCompare.name = name;
            Image image = (Image)instance.baseFind(instance.pNodeCompare);

            return(image);
        }
 //methods
 public void Set(Image.Name name, Texture pTexture, float x, float y, float width, float height)
 {
     this.name = name;
     Debug.Assert(pTexture != null);
     this.pTexture = pTexture;
     this.pRect.Set(x, y, width, height);
 }
Beispiel #5
0
        public static Image Add(Image.Name name, Texture.Name texture, Azul.Rect poRect)
        {
            Image   image    = (Image)instance.AddToFront();
            Texture pTexture = TextureMan.Find(texture);

            image.Initialize(name, pTexture, poRect);
            return(image);
        }
Beispiel #6
0
        /// <summary>
        ///		Attaches an Image to the frame animation
        /// </summary>
        /// <param name="imageName"></param>
        /// <returns></returns>
        public AnimationUnitFrame Attach(Image.Name imageName)
        {
            Image newImage             = ImageManager.Self.Find(imageName);
            AnimationUnitFrame newUnit = this.BaseAttach(0u) as AnimationUnitFrame;

            newUnit.SetImage(newImage);
            this.PointToStartingAnimationUnit();
            return(newUnit);
        }
        /// <summary>
        ///		Create a new image map from the object pool
        /// </summary>
        /// <param name="newName"></param>
        /// <param name="texName"></param>
        /// <param name="s"></param>
        /// <param name="t"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public Image Create(Image.Name newName, Texture.Name texName, float s, float t, float width, float height)
        {
            Image newImage = this.BaseCreate() as Image;

            newImage.SetName(newName);
            newImage.SetImageMapping(s, t, width, height);
            newImage.SetTexture(TextureManager.Self.Find(texName));
            return(newImage);
        }
Beispiel #8
0
        public Image(Image.Name name, Texture texture, float x, float y, float width, float height)
        {
            Debug.Assert(texture != null);

            this.pTexture = texture;
            this.name     = name;

            this.poImageRect = new Azul.Rect(x, y, width, height);
            Debug.Assert(poImageRect != null);
        }
Beispiel #9
0
        public Image(Image.Name name, Texture pTex, Azul.Rect pSubRect)
        {
            Debug.Assert(pTex != null);

            // Do the create and load
            this.pTex   = pTex;
            this.poRect = new Azul.Rect(pSubRect);

            this.name = name;
        }
        ///////////////////////////////////////////////////////
        //
        // Methods
        //
        ///////////////////////////////////////////////////////

        /// <summary>
        ///		Create a new image map from the object pool
        /// </summary>
        /// <param name="newName"></param>
        /// <param name="textureName"></param>
        /// <returns></returns>
        public Image Create(Image.Name newName, Texture.Name textureName)
        {
            Azul.Rect stMap    = this.LookupImageMapping(newName);
            Image     newImage = this.BaseCreate() as Image;

            newImage.SetName(newName);
            newImage.SetImageMapping(stMap.x, stMap.y, stMap.w, stMap.h);
            newImage.SetTexture(TextureManager.Self.Find(textureName));
            return(newImage);
        }
Beispiel #11
0
        public Image(Image.Name name, Texture texture, Azul.Rect imageRect)
        {
            Debug.Assert(texture != null);
            Debug.Assert(imageRect != null);

            this.pTexture = texture;
            this.name     = name;

            this.poImageRect = new Azul.Rect(imageRect);
            Debug.Assert(imageRect != null);
        }
        public static Image Find(Image.Name name)
        {
            ImageManager pMan = ImageManager.GetInstance();

            Debug.Assert(pMan != null);

            pMan.pNodeCompare.name = name;
            Image pData = (Image)pMan.BaseFind(pMan.pNodeCompare);

            return(pData);
        }
        /// <summary>
        ///		Removes the given image to be used again from the pool
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool Recycle(Image.Name name)
        {
            Image oldNode = this.BaseRecycle(name) as Image;

            if (oldNode == null)
            {
                return(false);
            }
            oldNode.Reset();
            return(true);
        }
Beispiel #14
0
        public void addImage(Image.Name imgName)
        {
            if (this.pImageQueue == null)
            {
                this.pImageQueue = new ImageHolderMan();
            }

            Image img = ImageManager.getInstance().FindImageByName(imgName);

            this.pCrntImgHolder = this.pImageQueue.AddImageHolder(img);
        }
Beispiel #15
0
        /// <summary>
        ///		Removes an Image from the frame animation
        /// </summary>
        /// <param name="oldName"></param>
        /// <returns></returns>
        public bool Detach(Image.Name oldName)
        {
            AnimationUnitFrame oldUnit = this.BaseDetach(oldName, 0u) as AnimationUnitFrame;

            if (oldUnit == null)
            {
                return(false);
            }
            oldUnit.Reset();
            return(true);
        }
        private bool texChanged;                // Did the texture change?

        //
        // Constructors
        //

        public Image() : base()
        {
            this.imageMapping = new Azul.Rect(0.0f, 0.0f, 0.0f, 0.0f);
            this.texture      = null;
            this.name         = Image.Name.UNINITIALIZED;
            this.s            = 0.0f;
            this.t            = 0.0f;
            this.w            = 0.0f;
            this.h            = 0.0f;
            this.stChanged    = false;
            this.texChanged   = false;
        }
Beispiel #17
0
        public static Image Find(Image.Name name)
        {
            ImageMan pIMan = ImageMan.PrivGetInstance();

            Debug.Assert(pIMan != null);

            pIMan.poImageCompare.SetName(name);

            Image pINode = (Image)pIMan.BaseFind(pIMan.poImageCompare);

            return(pINode);
        }
        public void Attach(Image.Name imageName)
        {
            Image pImage = ImageMan.Find(imageName);

            Debug.Assert(pImage != null);
            ImageHolder pImageHolder = new ImageHolder(pImage);

            Debug.Assert(pImageHolder != null);

            SLink.AddToFront(ref this.poHeadImage, pImageHolder);
            this.pCurrImage = pImageHolder;
        }
        public static Image Find(Image.Name theName)
        {
            ImageManager pManager = ImageManager.privGetInstance();

            Debug.Assert(pManager != null);

            // set the static compare object for use
            pManager.poNodeCompare.SetName(theName);

            Image pImg = (Image)pManager.baseFind(pManager.poNodeCompare);

            return(pImg);
        }
Beispiel #20
0
        public static Image Find(Image.Name name)
        {
            // ensure call Create() first
            ImageMan pMan = ImageMan.GetInstance();

            Debug.Assert(pMan != null);

            // find the image by specific image name
            pMan.poNodeForCompare.setName(name);
            Image pImage = (Image)pMan.baseFind(pMan.poNodeForCompare);

            return(pImage);
        }
Beispiel #21
0
        public static Image Find(Image.Name name)
        {
            ImageManager pInstance = ImageManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            // Use compare node to compare to search nodes
            pInstance.pImageCompare.SetName(name);

            Image pData = (Image)pInstance.BaseFind(pInstance.pImageCompare);

            return(pData);
        }
        public static Image Add(Image.Name imageName)
        {
            ImageManager pMan = ImageManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            Image pNode = (Image)pMan.BaseAdd();

            Debug.Assert(pNode != null);

            pNode.Set(imageName);

            return(pNode);
        }
Beispiel #23
0
        // PA2: Factory method, create and add image into actives
        public Image AddImage(Image.Name name, Texture.Name tName, float x, float y, float w, float h)
        {
            Texture texture = TextureManager.getInstance().FindTextureByName(tName);

            Debug.Assert(texture != null);

            // Create a new image
            Image ret = new Image(name, texture.poAzulTexture, x, y, w, h);

            // Add it to the list
            this.Add(ret);

            return(ret);
        }
Beispiel #24
0
        public static Image Find(Image.Name name)
        {
            ImageManager pMan = ImageManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            // So:  Use the Compare Node - as a reference
            //      use in the Compare() function
            pMan.poNodeCompare.SetName(name);

            Image pData = (Image)pMan.BaseFind(pMan.poNodeCompare);

            return(pData);
        }
        public void Attach(Image.Name imageName)
        {
            Image pImg = ImageManager.Find(imageName);

            Debug.Assert(pImg != null);

            ImageHolder pImgHold = new ImageHolder(pImg);

            Debug.Assert(pImgHold != null);

            DLink.AddToEnd(ref this.poFirstImage, pImgHold);

            this.pCurrentImage = pImgHold;
        }
 /// <summary>
 ///		Clears the data in the Image
 /// </summary>
 /// <remarks>
 ///		Does not clear base data. Use <c>BaseReset()</c> for that.
 /// </remarks>
 public override void Reset()
 {
     this.imageMapping.x = 0.0f;
     this.imageMapping.y = 0.0f;
     this.imageMapping.w = 0.0f;
     this.imageMapping.h = 0.0f;
     this.texture        = null;
     this.name           = Image.Name.UNINITIALIZED;
     this.stChanged      = false;
     this.texChanged     = false;
     this.s = 0.0f;
     this.t = 0.0f;
     this.w = 0.0f;
     this.h = 0.0f;
 }
        public static GameSprite Add(GameSprite.Name name, Image.Name pImgName, int x, int y, int w, int h)
        {
            Debug.Assert(pMan != null);

            GameSprite pSprite = (GameSprite)pMan.baseAdd();

            Debug.Assert(pSprite != null);

            Image pImg = ImageMan.Find(pImgName);

            Debug.Assert(pImg != null);

            pSprite.SetSprite(name, pImg, x, y, w, h);
            return(pSprite);
        }
Beispiel #28
0
        public static Image Add(Image.Name name, Texture.Name pTexName, int x, int y, int w, int h)
        {
            Debug.Assert(pMan != null);

            Image pImage = (Image)pMan.baseAdd();

            Debug.Assert(pImage != null);


            Texture pTex = TextureMan.Find(pTexName);

            Debug.Assert(pTex != null);

            pImage.SetImage(name, pTex, x, y, w, h);
            return(pImage);
        }
Beispiel #29
0
        public static Image Find(Image.Name name)
        {
            DLink ptr = pMan.poActive;

            while (ptr != null)
            {
                if (((Image)ptr).GetName() == name)
                {
                    return((Image)ptr);
                }

                ptr = ptr.pNext;
            }

            return(null);
        }
Beispiel #30
0
        // PA6 Find Image by Name
        public Image FindImageByName(Image.Name n)
        {
            DLink current = poActiveHead;

            while (current != null)
            {
                if (((Image)current).name == n)
                {
                    return((Image)current);
                }

                current = current.pNext;
            }

            return(null);
        }