// ~ImageMan() // { //#if(TRACK_DESTRUCTOR) // Debug.WriteLine("~ImageMan():{0}", this.GetHashCode()); //#endif // this.poNodeCompare = null; // ImageMan.pInstance = null; // } //---------------------------------------------------------------------- // Static Methods //---------------------------------------------------------------------- public static void Create(int reserveNum = 3, int reserveGrow = 1) { // make sure values are ressonable Debug.Assert(reserveNum > 0); Debug.Assert(reserveGrow > 0); // initialize the singleton here Debug.Assert(pInstance == null); // Do the initialization if (pInstance == null) { pInstance = new ImageMan(reserveNum, reserveGrow); // Add a NULL Texture into the Manager, allows find Image pImage; pImage = ImageMan.Add(Image.Name.NullObject, Texture.Name.NullObject, 0, 0, 128, 128); Debug.Assert(pImage != null); // Default image manager pImage = ImageMan.Add(Image.Name.Default, Texture.Name.Default, 0, 0, 128, 128); Debug.Assert(pImage != null); } }
//--------------------------------------------------------------------------------------------------------- // 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; }
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); }
//--------------------------------------------------------------------------------------------------------- // 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; }
//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; }
public static void DumpImages() { ImageMan pIMan = ImageMan.PrivGetInstance(); Debug.Assert(pIMan != null); pIMan.BaseDumpNodes(); }
// public public static void Create(int init = 2, int delta = 2) { if (pMan == null) { pMan = new ImageMan(init, delta); } ImageMan.Add(Image.Name.Img_NullObject, Texture.Name.NullObjectTexture, 0, 0, 128, 128); }
public static void Dump() { ImageMan pMan = ImageMan.PrivGetInstance(); Debug.Assert(pMan != null); pMan.BaseDump(); }
public static void Remove(Image pNode) { ImageMan pMan = ImageMan.PrivGetInstance(); Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.BaseRemove(pNode); }
private void PrivStatDump() { ImageMan pIMan = ImageMan.PrivGetInstance(); Debug.Assert(pIMan != null); Debug.WriteLine(""); Debug.WriteLine("Image Manager Stats-------------------------"); pIMan.BaseStatDump(); }
//----------------------------------------------------------------------------- // Game::UnLoadContent() // unload content (resources loaded above) // unload all content that was loaded before the Engine Loop started //----------------------------------------------------------------------------- public override void UnLoadContent() { GameObjectMan.Destory(); ProxySpriteMan.Destory(); TimerMan.Destory(); SpriteBatchMan.Destory(); GameSpriteMan.Destory(); BoxSpriteMan.Destory(); ImageMan.Destory(); TextureMan.Destory(); }
public static void Remove(Image pImage) { // ensure call Create() first ImageMan pMan = ImageMan.GetInstance(); Debug.Assert(pMan != null); // ensure pImage is not null Debug.Assert(pImage != null); pMan.baseRemove(pImage); }
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 static Image Find(Image.Name name) { ImageMan pMan = ImageMan.PrivGetInstance(); Debug.Assert(pMan != null); pMan.poNodeCompare.name = name; Image pData = (Image)pMan.BaseFind(pMan.poNodeCompare); return(pData); }
public static void Destory() { // ensure call Create() first ImageMan pMan = ImageMan.GetInstance(); Debug.Assert(pMan != null); pMan.baseDestory(); pMan.poNodeForCompare = null; ImageMan.pInstance = null; }
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 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); }
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); }
public static void Destroy() { ImageMan pMan = ImageMan.privGetInstance(); Debug.Assert(pMan != null); // Print stats on destroy pMan.baseDump(); // Invalidate the singleton if (pInstance != null) { pInstance = null; } }
public override void UnLoadContent() { TimerMan.Destroy(); TextureMan.Destroy(); ImageMan.Destroy(); GameSpriteMan.Destroy(); BoxSpriteMan.Destroy(); pSpriteBatchMan.Destroy(); ProxySpriteMan.Destroy(); GlyphMan.Destroy(); //GameObjectMan.Destroy(); ColPairMan.Destroy(); FontMan.Destroy(); ShipMan.Destroy(); }
public static Image Find(Image.Name name) { ImageMan pMan = ImageMan.PrivGetInstance(); Debug.Assert(pMan != null); // Compare functions only compares two Nodes // 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 static void Create(int reserveNum = 3, int reserveGrow = 1) { Debug.Assert(reserveNum > 0); Debug.Assert(reserveGrow > 0); // initialize the singleton here Debug.Assert(pInstance == null); // Do the initialization if (pInstance == null) { pInstance = new ImageMan(reserveNum, reserveGrow); ImageMan.Add(Image.Name.NullObject, Texture.Name.NullObject, 0, 0, 128, 128); ImageMan.Add(Image.Name.Default, Texture.Name.Default, 0, 0, 128, 128); } }
//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) { 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; }
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; }
override public void Unload() { //SpriteBatchMan.Remove(pSB_Texts); //SpriteBatchMan.Remove(pSB_Texts); SpriteBatchMan.Destroy(); TextureMan.Destroy(); GlyphMan.Destroy(); FontMan.Destroy(); ImageMan.Destroy(); GameSpriteMan.Destroy(); BoxSpriteMan.Destroy(); ProxySpriteMan.Destroy(); GameObjectMan.Destroy(); InputMan.Destroy(); this.Handle(); }
public static void Destroy() { // Get the instance ImageMan pMan = ImageMan.PrivGetInstance(); #if (TRACK_DESTRUCTOR_MAN) Debug.WriteLine("--->ImageMan.Destroy()"); #endif pMan.BaseDestroy(); #if (TRACK_DESTRUCTOR_MAN) Debug.WriteLine(" {0} ({1})", pMan.poNodeCompare, pMan.poNodeCompare.GetHashCode()); Debug.WriteLine(" {0} ({1})", ImageMan.pInstance, ImageMan.pInstance.GetHashCode()); #endif pMan.poNodeCompare = null; ImageMan.pInstance = null; }
//--------------------------------------------------------------------------------------------------------- // 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; }
override public void Unload() { SpriteBatchMan.Destroy(); TextureMan.Destroy(); GlyphMan.Destroy(); FontMan.Destroy(); ImageMan.Destroy(); GameSpriteMan.Destroy(); BoxSpriteMan.Destroy(); ProxySpriteMan.Destroy(); GameObjectMan.Destroy(); TimerMan.Destroy(); ColPairMan.Destroy(); Simulation.Destroy(); InputMan.Destroy(); this.Handle(); }
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); }