Exemplo n.º 1
0
        public override void LoadContent()
        {
            pSpriteBatchMan = new SpriteBatchMan(1, 1);
            TextureMan.Create(2, 1);
            GlyphMan.Create(3, 1);
            FontMan.Create(1, 1);

            TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");
            FontMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            SpriteBatch pSB_Texts = pSpriteBatchMan.Add(SpriteBatch.Name.Texts);

            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "SCORE<1>  HIGH-SCORE  SCORE<2>", Glyph.Name.Consolas36pt, 200, 680);
            FontMan.Add(pSpriteBatchMan, Font.Name.ScoreOne, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 240, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.HighestScore, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 440, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.ScoreTwo, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 650, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "SPACE INVADERS", Glyph.Name.Consolas36pt, 320, 500);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "Choose 1 or 2 to play...", Glyph.Name.Consolas36pt, 240, 450);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "1, Single Player", Glyph.Name.Consolas36pt, 300, 350);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "2, Two Player", Glyph.Name.Consolas36pt, 310, 250);

            InputSubject pInputSubject;

            pInputSubject = InputMan.GetKeyOneSubject();
            pInputSubject.Attach(new MoveToPlayingStateObserver());

            pInputSubject = InputMan.GetKeyTwoSubject();
            pInputSubject.Attach(new MoveToPlayingStateObserver());

            Simulation.SetState(Simulation.State.Realtime);
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            this.poSpriteBatchMan = new SpriteBatchMan(3, 1);
            SpriteBatchMan.SetActive(this.poSpriteBatchMan);

            this.poFontMan = new FontMan();
            FontMan.SetActive(this.poFontMan);

            this.poInputMan = new InputMan();
            InputMan.SetActive(this.poInputMan);

            SpriteBatch pSB_Texts = SpriteBatchMan.Add(SpriteBatch.Name.Texts, 100, true);

            HighScore hS = new HighScore();

            Texture pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");

            GlyphMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            Font pFont = FontMan.Add(Font.Name.HighScore, SpriteBatch.Name.Texts, "High Score", Glyph.Name.Consolas36pt, 100, 500);

            pFont.SetColor(1.0f, 1.0f, 1.0f);

            pFont = FontMan.Add(Font.Name.HighScores, SpriteBatch.Name.Texts, hS.GetScore().ToString(), Glyph.Name.Consolas20pt, 100, 400);
            pFont.SetColor(0.40f, 0.40f, 0.40f);

            pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Back to Menu", Glyph.Name.Consolas20pt, 100, 100);
            pFont.SetColor(0.60f, 0.60f, 0.60f);

            InputSubject pInputSubject = InputMan.GetCursorSubject();

            pInputSubject.Attach(new HighlightHoverTextObserver(pFont));
            pInputSubject = InputMan.GetMouseLeftKeySubject();
            pInputSubject.Attach(new MenuChoiceObserver(pFont));
        }
Exemplo n.º 3
0
 public override void UnLoadContent()
 {
     pSpriteBatchMan.Destroy();
     TextureMan.Destroy();
     GlyphMan.Destroy();
     FontMan.Destroy();
 }
        public override void LoadContent()
        {
            pSpriteBatchMan = new SpriteBatchMan(1, 1);
            //TimerMan.Create(3, 1);
            TextureMan.Create(2, 1);
            GlyphMan.Create(3, 1);
            FontMan.Create(1, 1);

            TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");
            FontMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            SpriteBatch pSB_Texts = pSpriteBatchMan.Add(SpriteBatch.Name.Texts);

            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "SCORE<1>  HIGH-SCORE  SCORE<2>", Glyph.Name.Consolas36pt, 200, 680);
            FontMan.Add(pSpriteBatchMan, Font.Name.ScoreOne, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 240, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.HighestScore, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 440, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.ScoreTwo, SpriteBatch.Name.Texts, "00", Glyph.Name.Consolas36pt, 650, 650);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "GAME OVER!!", Glyph.Name.Consolas36pt, 350, 400);
            FontMan.Add(pSpriteBatchMan, Font.Name.Title, SpriteBatch.Name.Texts, "Press 3 to go back to the menu...", Glyph.Name.Consolas36pt, 200, 280);

            InputSubject pInputSubject;

            pInputSubject = InputMan.GetKeyThreeSubject();
            pInputSubject.Attach(new MoveToMenuObserver());

            Simulation.SetState(Simulation.State.Realtime);
            //CycleBackToMenuState pCylce = new CycleBackToMenuState();
            //TimerMan.Add(TimeEvent.Name.CycleBackToMenu, pCylce, 20f);
        }
Exemplo n.º 5
0
 public static void Create(int reserved, int growth)
 {
     if (instance == null)
     {
         instance = new TextureMan(reserved, growth);
     }
 }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public static void DumpTextures()
        {
            TextureMan pTMan = TextureMan.PrivGetInstance();

            Debug.Assert(pTMan != null);

            pTMan.BaseDumpNodes();
        }
Exemplo n.º 8
0
        public static void Dump()
        {
            TextureMan pMan = TextureMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.BaseDump();
        }
Exemplo n.º 9
0
        public static void Remove(Texture pNode)
        {
            TextureMan pMan = TextureMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.BaseRemove(pNode);
        }
Exemplo n.º 10
0
        public static void LoadTexture()
        {
            Debug.WriteLine("...LoadingTexture...");

            TextureMan.Add(Texture.Name.Consolas, "Consolas36pt.tga");
            TextureMan.Add(Texture.Name.Invader_3, "Invaders_3.tga");
            TextureMan.Add(Texture.Name.Invader_4, "Invaders_4.tga");

            Debug.WriteLine("Done!");
        }
Exemplo n.º 11
0
        // public
        public static void Create(int init = 2, int delta = 2)
        {
            if (pMan == null)
            {
                pMan = new TextureMan(init, delta);
            }


            TextureMan.Add(Texture.Name.NullObjectTexture, "HotPink.tga");
        }
Exemplo n.º 12
0
        public static void Remove(Texture pTexture)
        {
            //ensure call Create() first
            TextureMan pMan = TextureMan.GetInstance();

            Debug.Assert(pMan != null);

            // ensure pTexture is not null
            Debug.Assert(pTexture != null);
            pMan.baseRemove(pTexture);
        }
Exemplo n.º 13
0
        override public void Unload()
        {
            SpriteBatchMan.Destroy();
            TextureMan.Destroy();
            GlyphMan.Destroy();
            FontMan.Destroy();
            InputMan.Destroy();
            GhostGameObjectMan.Destroy();

            this.Handle();
        }
Exemplo n.º 14
0
 //-----------------------------------------------------------------------------
 // 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();
 }
Exemplo n.º 15
0
        private void PrivStatDump()
        {
            TextureMan pTMan = TextureMan.PrivGetInstance();

            Debug.Assert(pTMan != null);

            Debug.WriteLine("");
            Debug.WriteLine("Texture Manager Stats-------------------------");
            Debug.WriteLine("TO SELF!! The null texture and default texture included in stats.");
            pTMan.BaseStatDump();
        }
        public static Texture Find(Texture.Name name)
        {
            TextureMan pMan = TextureMan.privGetInstance();

            Debug.Assert(pMan != null);

            pMan.poNodeCompare.name = name;

            Texture pData = (Texture)pMan.baseFind(pMan.poNodeCompare);

            return(pData);
        }
Exemplo n.º 17
0
        public static Texture Find(Texture.Name name)
        {
            TextureMan pTMan = TextureMan.PrivGetInstance();

            Debug.Assert(pTMan != null);

            pTMan.poTexCompare.SetName(name);

            Texture pTNode = (Texture)pTMan.BaseFind(pTMan.poTexCompare);

            return(pTNode);
        }
Exemplo n.º 18
0
        public override void UnLoadContent()
        {
            //pSpriteBatchMan.Destroy();
            TextureMan.Destroy();
            GlyphMan.Destroy();
            //TimerMan.Destroy();

            FontMan.Destroy();
            GameObjectMan.Destroy();
            //ColPairMan.Destroy();
            //ShipMan.Destroy();
        }
Exemplo n.º 19
0
        public static void Destory()
        {
            //ensure call Create() first
            TextureMan pMan = TextureMan.GetInstance();

            Debug.Assert(pMan != null);

            pMan.baseDestory();

            pMan.poNodeForCompare = null;
            TextureMan.pInstance  = null;
        }
Exemplo n.º 20
0
        //----------------------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------------------
        public void set(Glyph.Name name, int key, Texture.Name textName, float x, float y, float width, float height)
        {
            Debug.Assert(this.pSubRect != null);
            this.name = name;

            this.pTexture = TextureMan.Find(textName);
            Debug.Assert(this.pTexture != null);

            this.pSubRect.Set(x, y, width, height);

            this.key = key;
        }
Exemplo n.º 21
0
        public static Texture Find(Texture.Name name)
        {
            //ensure call Create() first
            TextureMan pMan = TextureMan.GetInstance();

            Debug.Assert(pMan != null);

            // find the texture by specific texture name
            pMan.poNodeForCompare.setName(name);
            Texture pTexture = (Texture)pMan.baseFind(pMan.poNodeForCompare);

            return(pTexture);
        }
Exemplo n.º 22
0
        public static Texture Add(Texture.Name name, String pTexName)
        {
            TextureMan pTMan = TextureMan.PrivGetInstance();

            Debug.Assert(pTMan != null);

            Texture pTNode = (Texture)pTMan.BaseAdd();

            Debug.Assert(pTNode != null);

            Debug.Assert(pTexName != null);

            pTNode.Set(name, pTexName);
            return(pTNode);
        }
        public static void Destroy()
        {
            TextureMan pMan = TextureMan.privGetInstance();

            Debug.Assert(pMan != null);

            // Print stats on destroy
            pMan.baseDump();

            // Invalidate the singleton
            if (pInstance != null)
            {
                pInstance = null;
            }
        }
Exemplo n.º 24
0
        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 TextureMan(reserveNum, reserveGrow);
                TextureMan.Add(Texture.Name.Default, "HotPink.tga");
                TextureMan.Add(Texture.Name.NullObject, "HotPink.tga");
            }
        }
        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();
        }
Exemplo n.º 26
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);
        }
        public static Texture Add(Texture.Name name, string pTextureName)
        {
            TextureMan pMan = TextureMan.privGetInstance();

            Debug.Assert(pMan != null);

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

            Debug.Assert(pNode != null);

            // Check the data initialization
            Debug.Assert(pTextureName != null);

            pNode.Set(name, pTextureName);
            return(pNode);
        }
Exemplo n.º 28
0
        public static Texture Add(Texture.Name name, String pTextureName)
        {
            TextureMan pMan = TextureMan.PrivGetInstance();

            Debug.Assert(pMan != null);

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

            Debug.Assert(pNode != null);

            // Initialize the data
            Debug.Assert(pTextureName != null);
            pNode.Set(name, pTextureName);

            return(pNode);
        }
Exemplo n.º 29
0
        public static Texture Find(Texture.Name name)
        {
            TextureMan pMan = TextureMan.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);

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

            return(pData);
        }
Exemplo n.º 30
0
        public override void Initialize()
        {
            this.name = SceneContext.Scene.Over;

            this.poSpriteBatchMan = new SpriteBatchMan(3, 1);
            SpriteBatchMan.SetActive(this.poSpriteBatchMan);

            SpriteBatch pSB_Texts = this.poSpriteBatchMan.Add(SpriteBatch.Name.Texts, 100);

            Texture pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");

            GlyphMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            Font pFont = FontMan.Add(Font.Name.GameOver, SpriteBatch.Name.Texts, "GAME OVER", Glyph.Name.Consolas36pt, 310, 350);

            pFont.SetColor(1.0f, 0.0f, 0.0f);
        }