Example #1
0
        //----------------------------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------------------------

        public Texture(Name textureName, string pTextureName)
        {
            Debug.Assert(pTextureName != null);

            this.name          = textureName;
            this.poAzulTexture = new Azul.Texture(pTextureName);
        }
Example #2
0
        private void Add(Azul.Texture pFont, int key, int x, int y, int width, int height)
        {
            Glyph pGlyph = new Glyph(pFont, key, x, y, width, height);

            // quickly add to a linked list
            this.privAddToFront(ref this.pHead, pGlyph);
        }
Example #3
0
        public void Set(Texture.Name name)
        {
            String assetName = null;

            switch (name)
            {
            case Name.Consolas36pt:
                assetName = Constants.fontAsset;
                break;

            case Name.Invader:
                assetName = Constants.invaderAsset;
                break;

            case Name.NullObject:
                assetName = Constants.uninitializedAsset;
                break;

            case Name.Uninitialized:
                assetName = Constants.uninitializedAsset;
                break;

            default:
                Debug.Assert(false, "Invalid texture name");
                break;
            }

            this.poTexture = new Azul.Texture(assetName);
            Debug.Assert(poTexture != null);

            this.name = name;
        }
Example #4
0
        //-----------------------------------------------------------------------------
        // Game::LoadContent()
        //		Allows you to load all content needed for your engine,
        //	    such as objects, graphics, etc.
        //-----------------------------------------------------------------------------
        public override void LoadContent()
        {
            //---------------------------------------------------------------------------------------------------------
            // Audio
            //---------------------------------------------------------------------------------------------------------

            /*
             * // Create the Audio Engine
             * AudioEngine = new IrrKlang.ISoundEngine();
             *
             * // Play a sound file
             * music = AudioEngine.Play2D("theme.wav", true);
             * music.Volume = 0.2f;
             *
             * // Resident loads
             * srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav");
             * sndShoot = AudioEngine.Play2D(srcShoot, false, false, false);
             * sndShoot.Stop();
             */

            soundEngine.themeSong();
            soundEngine.init();
            //---------------------------------------------------------------------------------------------------------
            // Setup Font
            //---------------------------------------------------------------------------------------------------------

            // Font - texture
            pFont = new Azul.Texture("consolas20pt.tga");
            Debug.Assert(pFont != null);

            GlyphMan.AddXml("Consolas20pt.xml", pFont);

            //---------------------------------------------------------------------------------------------------------
            // Load the Textures
            //---------------------------------------------------------------------------------------------------------

            // Red bird texture
            pText = new Azul.Texture("unsorted.tga");
            Debug.Assert(pText != null);

            //---------------------------------------------------------------------------------------------------------
            // Create Sprites
            //---------------------------------------------------------------------------------------------------------

            pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f), new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f));
            Debug.Assert(pRedBird != null);

            //---------------------------------------------------------------------------------------------------------
            // Demo variables
            //---------------------------------------------------------------------------------------------------------

            stats = new GameStats();

            if (startgame)
            {
                active_piece = generateRandomShape();
                active_piece.setToPlay();
                future_piece = generateRandomShape();
            }
        }
Example #5
0
 public Texture(TexEnum name, string texFile)
     : base()
 {
     this.name = name;
     this.index = Index.Index_Null;
     tex = new Azul.Texture(texFile);
 }
 private void ClearNode()
 {
     Debug.Assert(Texture.pDefaultAzulTexture != null);
     this.pAzulTexture = pDefaultAzulTexture;
     Debug.Assert(this.pAzulTexture != null);
     this.name = Name.Default;
 }
Example #7
0
        public void Set(Name name, Azul.Texture pAzulTexture)
        {
            Debug.Assert(pAzulTexture != null);

            this.pAzulTexture = pAzulTexture;

            this.name = name;
        }
Example #8
0
        public void Set(Name name, string pTextureName)
        {
            Debug.Assert(pTextureName != null);

            this.pAzulTexture = new Azul.Texture(pTextureName);
            Debug.Assert(pAzulTexture != null);

            this.name = name;
        }
 public AnimationParticle(Azul.Rect textRect, Azul.Rect destRect, Azul.Texture text, Azul.Color color)
     : base(textRect, destRect, text, color)
 {
     timer = new Stopwatch();
     frame = 0;
     timer.Start();
     frameSpeed = 1.0f * 100;
     animation  = new List <Azul.Sprite>();
     animation.Add(pSprite);
 }
Example #10
0
        public void Set(Name textureName, string pTextureName)
        {
            this.name = textureName;

            Debug.Assert(pTextureName != null);

            // do the load: = default texture node - HotPink.tga?
            this.poAzulTexture = new Azul.Texture(pTextureName, Azul.Texture_Filter.NEAREST, Azul.Texture_Filter.NEAREST);
            Debug.Assert(this.poAzulTexture != null);
        }
Example #11
0
        public Texture()
            : base()
        {
            Debug.Assert(Texture.psDefaultAzulTexture != null);

            this.name = Name.Default;

            this.poAzulTexture = psDefaultAzulTexture;
            Debug.Assert(this.poAzulTexture != null);
        }
Example #12
0
        public void Set(Name name, String pTexName)
        {
            Debug.Assert(pTexName != null);

            this.name = name;

            //Texture Swap
            this.poAzulTexture = new Azul.Texture(pTexName);
            Debug.Assert(this.poAzulTexture != null);
        }
Example #13
0
        public Glyph(Azul.Texture pFont, int key, int x, int y, int width, int height)
        {
            this.pNext = null;
            this.pFont = pFont;

            this.key    = key;
            this.x      = x;
            this.y      = y;
            this.width  = width;
            this.height = height;
        }
Example #14
0
 public void Set(TextureName textureName, string assetName)
 {
     this.name      = textureName;
     this.assetName = assetName;
     Azul.Texture pTex = new Azul.Texture(assetName);
     if (pTex == null)
     {
         pTex = new Azul.Texture("HotPink.tga");
     }
     this.pAzulTexture = pTex;
 }
 //methods
 public void Set(Name name, string pTextureName)
 {
     this.name = name;
     Debug.Assert(pTextureName != null);
     Debug.Assert(this.pAzulTexture != null);
     if (System.IO.File.Exists(pTextureName))
     {
         // Replace the Default with the new one
         this.pAzulTexture = new Azul.Texture(pTextureName, Azul.Texture_Filter.NEAREST, Azul.Texture_Filter.NEAREST);
     }
     Debug.Assert(this.pAzulTexture != null);
 }
Example #16
0
        public void Set(Name theName, string pTextureName)
        {
            Debug.Assert(pTextureName != null);

            this.name = theName;

            //Texture swap

            if (System.IO.File.Exists(pTextureName))
            {
                //Replace old Texture with new one.
                this.poAzulTexture = new Azul.Texture(pTextureName, Azul.Texture_Filter.NEAREST, Azul.Texture_Filter.NEAREST);
            }

            Debug.Assert(this.poAzulTexture != null);
        }
Example #17
0
        private GameManager()
        {
            destroyList = new List <GameObject>();
            gameObjList = new List <GameObject>();

            mainMenuSprite = new Azul.Sprite(loadScreenText, new Azul.Rect(0, 0, 800, 480), new Azul.Rect(400, 250, 800, 500));

            state = GAME_STATE.LOADSCREEN;

            //fontText20 = new Azul.Texture("Consolas20pt.tga");
            //GlyphMan.AddXml("Consolas20pt.xml", fontText20);
            fontText20 = new Azul.Texture("Arial20pt.tga");
            GlyphMan.AddXml("Arial20pt.xml", fontText20);

            GameOverText = new SpriteFont("", 0, 0);

            pLobby = new Lobby();
        }
Example #18
0
        // Author: Brandon Wegner
        public override void LoadContent()
        {
            AudioEngine = new IrrKlang.ISoundEngine();

            music        = AudioEngine.Play2D("theme.wav", true);
            music.Volume = 0.2f;

            srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav");
            sndShoot = AudioEngine.Play2D(srcShoot, false, false, false);
            sndShoot.Stop();

            pFont = new Azul.Texture("consolas20pt.tga");

            GlyphMan.AddXml("Consolas20pt.xml", pFont);

            pText = new Azul.Texture("unsorted.tga");

            pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f),
                                       new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f));
        }
Example #19
0
 public Image(Image.Name name, Azul.Texture texture, float x, float y, float w, float h)
 {
     this.name         = name;
     this.pAzulTexture = texture;
     this.poRect       = new Azul.Rect(x, y, w, h);
 }
Example #20
0
        public static void AddXml2(String assetName, Azul.Texture pFont)
        {
            // Singleton
            GlyphMan pMan = GlyphMan.privGetInstance();

            System.Xml.XmlTextReader reader = new XmlTextReader(assetName);

            int key    = -1;
            int x      = -1;
            int y      = -1;
            int width  = -1;
            int height = -1;

            // I'm sure there is a better way to do this... but this works for now
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:     // The node is an element.
                    if (reader.GetAttribute("key") != null)
                    {
                        key = Convert.ToInt32(reader.GetAttribute("key"));
                    }
                    else if (reader.Name == "x")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                x = Convert.ToInt32(reader.Value);
                                break;
                            }
                        }
                    }
                    else if (reader.Name == "y")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                y = Convert.ToInt32(reader.Value);
                                break;
                            }
                        }
                    }
                    else if (reader.Name == "width")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                width = Convert.ToInt32(reader.Value);
                                break;
                            }
                        }
                    }
                    else if (reader.Name == "height")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                height = Convert.ToInt32(reader.Value);
                                break;
                            }
                        }
                    }
                    break;

                case XmlNodeType.EndElement:     //Display the end of the element
                    if (reader.Name == "character")
                    {
                        // have all the data... so now create a glyph
                        //  Debug.WriteLine("key:{0} x:{1} y:{2} w:{3} h:{4}", key, x, y, width, height);
                        pMan.Add(pFont, key, x, y, width, height);
                    }
                    break;
                }
            }
        }
 /// <summary>
 ///		Clears the data in the Texture
 /// </summary>
 /// <remarks>
 ///		Does not clear base data. Use <c>BaseReset()</c> for that.
 /// </remarks>
 public override void Reset()
 {
     this.textureMap = null;
     this.name       = Texture.Name.UNINITIALIZED;
 }
Example #22
0
        //----------------------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------------------

        public void Wash()
        {
            this.name          = Name.Uninitialized;
            this.poAzulTexture = null;
        }
Example #23
0
 // Default constructor
 public Texture()
 {
     textureName = TextureName.Uninitilized;
     azulTexture = null;
 }
Example #24
0
 public new void Clear()
 {
     this.name          = Name.Uninitialized;
     this.poAzulTexture = null;
 }
Example #25
0
        // all setters

        public void setAll(TextureName texureName, string azulTexName)
        {
            this.textureName = texureName;
            this.azulTexture = createAzulTexture(azulTexName);
        }
Example #26
0
 public Texture()
 {
     this.name         = TextureName.Uninitialized;
     this.assetName    = "HotPink.tga";
     this.pAzulTexture = new Azul.Texture("HotPink.tga");
 }
Example #27
0
        public override void Load()
        {
            Receiver.instance.clearTime();
            if (isLoaded == false)
            {
                resetCommand = new PlayGameResetCommand();
                explosion    = RealSpriteFactory.getSprite(SpriteType.Explosion);
                CollisionSubjectFactory.getFactory.getAlienVictorySubject().setPos(800, 100);
                CollisionSubjectFactory.getFactory.getAlienVictorySubject().setScale(100, 30);
                ufoController = UFOSpawnControllerFactory.getFactory.getController;
                isLoaded      = true;
                it            = CollisionControllerFactory.getFactor.getIterator;

                shieldList = ShieldListFactory.getFactory.getShieldList();
                //collisionBox = new Azul.SpriteBox(new Azul.Rect(1,1,1,1), new Azul.Color(1.0f, 1.0f, 1.0f, 1.0f));
                Azul.Texture f = new Azul.Texture("Font.tga");

                GameObjectTreeFactory.getFactory.getUfo().setPos(100, 100);
                GameObjectTreeFactory.getFactory.getUfo().setStatus(Status.Active);

                m = AnimationManagerList.instance.findManager(SpriteType.Crab);
                //letterManager = LetterManagerFactory.getFactory().createManager("HELLO BOYS");
                //letterManager.setPos(100, 100);

                //---------------------------------------------------------------------------------------------------------
                // Load the Textures
                //---------------------------------------------------------------------------------------------------------


                movement = MovementControllerFactory.getFactory.getController();

                /*colObserver = new MovementCollisionObserver(movement);
                 * colSubject = new AlienGridCollisionSubject(GameObjectTreeFactory.getFactory.alien, SpriteType.Unitialized);
                 * colSubject.addObserver(new MovementCollisionObserver(movement));*/
                //colSubject = CollisionSubjectFactory.getFactory.getAlienSubject();
                //colSubject.addCollisionTest(collisionTest);
                wallList = GridWallCollisionListFactory.getFactory().getList();
                player   = PlayerFactory.instance.getPlayer();

                //player.setSpriteScale(100, 100);
                inputController = PlayerInputControllerFactory.getFactory.getController();



                projectileController = ProjectileControllerFactory.instance.controller;
                controller           = CommandProjectileFactory.getFactory.controller;
                score = ScoreFactory.getFactory.player_1;
                //score.setPos(100, 100);
                //ScoreFactory.getFactory.player_2.setPos(400,100);
                //ScoreFactory.getFactory.high_score.setPos(300, 900);
                score.addScore(0);
                score.setImages();
                explosion.setPosition(300, 100);
            }
            if (start == false)
            {
                movement.setMovementDirection(MovementStateFactory.right);
                PlayerStatusControllerFactory.getFactory.getController.setAllPos(100, 600);
                PlayerStatusControllerFactory.getFactory.getController.setAllLives(3);
                ScoreFactory.getFactory.player_1.setScore(0);
                ScoreFactory.getFactory.player_2.setScore(0);
                ScoreFactory.getFactory.player_1.setImages();
                PlayScoreControllerFactory.getFactory.playController.setPlayerScoreController(ScoreFactory.getFactory.player_1);
                ScoreFactory.getFactory.player_2.setImages();
                //ufoController.getUfo().setStatus(Status);
                start = true;
            }
            CollisionSpawnFactory.getFactory.setAllInactive();
            setAllActive();
            resetPosition();
            addToRecevier();

            /*ufoController.addToReceiver();
             * movement.addCommandToReceiver();
             *
             * Scale sh = SizeFactory.getFactory.shieldScale;
             * GameObjectTreeFactory.getFactory.alien.setPos(100, 600, SizeFactory.getFactory.alienScale.spriteWidth, SizeFactory.getFactory.alienScale.spriteHeight);
             * movement.setActive(Status.Active);
             * movement.setAllActive(Status.Active);
             * shieldList.setAllActive(Status.Active);
             * shieldList.setPos(100, 200, sh.colWidth, sh.colHeight, 0);
             * shieldList.setPos(300, 200, sh.colWidth, sh.colHeight, 1);
             * shieldList.setPos(500, 200, sh.colWidth, sh.colHeight, 2);
             * shieldList.setPos(700, 200, sh.colWidth, sh.colHeight, 3);
             * player.setPos(100, 100);
             * controller.addToReceiver();
             * player.setStatus(Status.Active);*/
            projectileController.deactiateProjectiles();
        }
Example #28
0
 // Clear the Texture
 public void wash()
 {
     textureName = TextureName.Uninitilized;
     azulTexture = null;
 }
Example #29
0
 private Azul.Texture createAzulTexture(string azulTextureName)
 {
     Azul.Texture azulTex = new Azul.Texture(azulTextureName, Azul.Texture_Filter.NEAREST, Azul.Texture_Filter.NEAREST);
     Debug.Assert(azulTex != null);
     return(azulTex);
 }
Example #30
0
 public void setAzulTexture(Azul.Texture azulTex)
 {
     this.azulTexture = azulTex;
 }
Example #31
0
 public GameObject(GAMEOBJECT_TYPE _type, Azul.Rect textureRect, Azul.Rect screenRect, Azul.Texture text, Azul.Color c)
 {
     type        = _type;
     color       = c;
     pSprite     = new Azul.Sprite(text, textureRect, screenRect, color);
     pScreenRect = screenRect;
     id          = IDNUM++;
     alive       = true;
 }