예제 #1
0
        //---------------------------------------------------------------------------------------------------------
        // Constructors
        //---------------------------------------------------------------------------------------------------------
        public GameSprite()
            : base()
        {
            this.name = GameSprite.Name.Uninitialized;

            // set default image to pImage, it will be replace in the set()
            this.pImage = ImageMan.Find(Image.Name.Default);
            Debug.Assert(this.pImage != null);

            // set static Azul.Rect and static Azul.Color - as defalt value of GameSprite
            Debug.Assert(GameSprite.psAzulColor != null);
            GameSprite.psAzulColor.Set(1, 1, 1);

            // only new Azul.Rect here
            this.poScreenRect = new Azul.Rect();
            Debug.Assert(this.poScreenRect != null);
            this.poScreenRect.Clear();

            // only new Azul.Sprite here
            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, GameSprite.psAzulColor);
            Debug.Assert(this.poAzulSprite != null);

            // only new Azul.color here
            this.poAzulColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poAzulColor != null);

            this.x     = this.poAzulSprite.x;
            this.y     = this.poAzulSprite.y;
            this.sx    = this.poAzulSprite.sx;
            this.sy    = this.poAzulSprite.sy;
            this.angle = this.poAzulSprite.angle;
        }
예제 #2
0
        //---------------------------------------------------------------------------------------------------------
        // Constructor
        //---------------------------------------------------------------------------------------------------------
        public GameSprite()
            : base()   // <--- Delegate (kick the can)
        {
            this.name = GameSprite.Name.Uninitialized;

            // Use the default - it will be replaced in the Set
            this.pImage = ImageMan.Find(Image.Name.Default);
            Debug.Assert(this.pImage != null);

            this.poScreenRect = new Azul.Rect();
            Debug.Assert(this.poScreenRect != null);
            this.poScreenRect.Clear();

            Debug.Assert(GameSprite.psTmpColor != null);
            GameSprite.psTmpColor.Set(1, 1, 1);

            // here is the actual new
            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTmpColor);
            Debug.Assert(this.poAzulSprite != null);

            // here is the actual new
            this.poAzulColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poAzulColor != null);

            this.x     = poAzulSprite.x;
            this.y     = poAzulSprite.y;
            this.sx    = poAzulSprite.sx;
            this.sy    = poAzulSprite.sy;
            this.angle = poAzulSprite.angle;
        }
예제 #3
0
        //static Azul.Rect poRect = new Azul.Rect();


        public GameSprite()
            : base()
        {
            this.name = GameSprite.Name.Unitialized;

            //use the default for now and replace later in the Set
            this.pImage = ImageMan.Find(Image.Name.Default);
            Debug.Assert(this.pImage != null);

            this.poScreenRect = new Azul.Rect();
            Debug.Assert(this.pImage != null);

            //make sure nothing is there already?
            this.poScreenRect.Clear();

            Debug.Assert(GameSprite.psTempColor != null);
            GameSprite.psTempColor.Set(1, 1, 1);

            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTempColor);
            Debug.Assert(this.poAzulSprite != null);

            this.poAzulColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poAzulColor != null);

            this.x     = poAzulSprite.x;
            this.y     = poAzulSprite.y;
            this.sx    = poAzulSprite.sx;
            this.sy    = poAzulSprite.sy;
            this.angle = poAzulSprite.angle;
        }
예제 #4
0
        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;
        }
예제 #5
0
        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);
        }
예제 #6
0
        public void Attach(Image.Name imageName)
        {
            Image pImage = ImageMan.Find(imageName);

            Debug.Assert(pImage != null);

            ImageHolder pImageHolder = new ImageHolder(pImage);

            Debug.Assert(pImageHolder != null);

            // add Image to the list
            SLink.AddToFront(ref this.poFirstImage, pImageHolder);

            //then set the current image to the image just added
            //its always the first image
            this.pCurrentImage = pImageHolder;
        }
예제 #7
0
        //optional add method to add color
        public static GameSprite Add(GameSprite.Name name, Image.Name ImageName, float x, float y, float width, float height, float red, float green, float blue)
        {
            GameSpriteMan pSMan = GameSpriteMan.PrivGetInstance();

            Debug.Assert(pSMan != null);

            GameSprite pSNode = (GameSprite)pSMan.BaseAdd();

            Debug.Assert(pSNode != null);

            Image pImage = ImageMan.Find(ImageName);

            Debug.Assert(pSNode != null);

            pSNode.Set(name, pImage, x, y, width, height, new Azul.Color(red, green, blue));
            return(pSNode);
        }
        public void Attach(Image.Name imageName)
        {
            // Get the image
            Image pImage = ImageMan.Find(imageName);

            Debug.Assert(pImage != null);

            // Create a new holder
            ImageHolder pImageHolder = new ImageHolder(pImage);

            Debug.Assert(pImageHolder != null);

            // Attach it to the Animation Sprite ( Push to front )
            SLink.AddToFront(ref this.poFirstImage, pImageHolder);

            // Set the first one to this image
            this.pCurrImage = pImageHolder;
        }
예제 #9
0
        //---------------------------------------------------------------------------------------------------------
        // Methods
        //---------------------------------------------------------------------------------------------------------
        public void attach(Image.Name name)
        {
            // get the image
            Image pImage = ImageMan.Find(name);

            Debug.Assert(pImage != null);

            // create a new ImageHolder to hold the image
            ImageHolder pImageHolder = new ImageHolder(pImage);

            Debug.Assert(pImageHolder != null);

            // add to front
            SLink.AddToFront(ref this.poFirstImage, pImageHolder);

            // set the first one to this image
            this.pCurrImage = pImageHolder;
        }
예제 #10
0
        public static GameSprite Add(GameSprite.Name name, Image.Name ImageName, float x, float y, float width, float height, Azul.Color pColor = null)
        {
            GameSpriteMan pMan = GameSpriteMan.privGetInstance();

            Debug.Assert(pMan != null);

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

            Debug.Assert(pNode != null);

            // Initialize the data
            Image pImage = ImageMan.Find(ImageName);

            Debug.Assert(pImage != null);

            pNode.Set(name, pImage, x, y, width, height, pColor);

            return(pNode);
        }
예제 #11
0
        public GameSprite()
            : base()   // <--- Delegate (kick the can)
        {
            this.name = GameSprite.Name.Uninitialized;

            // Use the default - it will be replaced in the Set
            this.pImage = ImageMan.Find(Image.Name.Default);
            Debug.Assert(this.pImage != null);

            Debug.Assert(this.psTmpRect != null);
            this.psTmpRect.Clear();
            Debug.Assert(GameSprite.psTmpColor != null);
            this.ClearTmpColor();

            // here is the actual new
            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.psTmpRect, psTmpColor);
            Debug.Assert(this.poAzulSprite != null);

            this.BaseSet(poAzulSprite.x, poAzulSprite.y, poAzulSprite.sx, poAzulSprite.sy, poAzulSprite.angle);
        }
예제 #12
0
        public static GameSprite Add(GameSprite.Name gameSpriteName, Image.Name imageName, float x, float y, float width, float height, Azul.Color pAzulColor = null)
        {
            //ensure call Create() first
            GameSpriteMan pMan = GameSpriteMan.GetInstance();

            Debug.Assert(pMan != null);

            // add GameSprite to active list
            GameSprite pGameSprite = (GameSprite)pMan.baseAdd();

            Debug.Assert(pGameSprite != null);

            // find the image by image name
            Image pImage = ImageMan.Find(imageName);

            Debug.Assert(pImage != null);

            // set new GameSprite
            pGameSprite.set(gameSpriteName, pImage, x, y, width, height, pAzulColor);

            return(pGameSprite);
        }
예제 #13
0
        public static GameSprite Add(GameSprite.Name name, Image.Name ImageName, float x, float y, float width, float height, float r, float g, float b, float a)
        {
            GameSpriteMan pMan = GameSpriteMan.PrivGetInstance();

            Debug.Assert(pMan != null);

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

            Debug.Assert(pNode != null);

            // Initialize the data
            Image pImage = ImageMan.Find(ImageName);

            //Debug.Assert(pImage != null);
            if (pImage == null)
            {
                pImage = ImageMan.Find(Image.Name.Default);
                Debug.Assert(pImage != null);
            }

            pNode.Set(name, pImage, x, y, width, height, new Azul.Color(r, g, b, a));

            return(pNode);
        }
예제 #14
0
        //---------------------------------------------------------------------------------------------------------
        // Constructor
        //---------------------------------------------------------------------------------------------------------
        public GameSprite()
            : base()
        {
            this.name = GameSprite.Name.Uninitialized;

            this.pImage = ImageMan.Find(Image.Name.Default);
            Debug.Assert(this.pImage != null);

            this.poScreenRect = new Azul.Rect();
            Debug.Assert(this.poScreenRect != null);
            this.poScreenRect.Clear();

            this.poAzulColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poAzulColor != null);

            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTmpColor);
            Debug.Assert(this.poAzulSprite != null);

            this.x     = poAzulSprite.x;
            this.y     = poAzulSprite.y;
            this.sx    = poAzulSprite.sx;
            this.sy    = poAzulSprite.sy;
            this.angle = poAzulSprite.angle;
        }