Ejemplo n.º 1
0
        protected override void Begin()
        {
            try
            {
                Game.Window.KeyPress += InputEvent;

                m_field = new Field(Game, 1, Difficulty.Easy);
                m_field.OnCombo += DoCombo;
                m_field.OnChain += DoChain;

                AtlasBuilder builder = new AtlasBuilder(Game);
                builder.Textures.Add(LoadResized("images/block00.png"));
                builder.Textures.Add(LoadResized("images/block10.png"));
                builder.Textures.Add(LoadResized("images/block20.png"));
                builder.Textures.Add(LoadResized("images/block30.png"));
                builder.Textures.Add(LoadResized("images/block40.png"));
                builder.Textures.Add(LoadResized("images/block50.png"));
                builder.Textures.Add(LoadResized("images/cruiser0.png"));
                builder.Textures.Add(new LoadingTexture("images/white.png"));

                using (tex = builder.Build())
                {
                    //builder.Dispose();
                    builder = null;

                    blocks = new TextureInfo[6, 1];
                    blocks[0, 0] = tex["block00.png"];
                    blocks[1, 0] = tex["block10.png"];
                    blocks[2, 0] = tex["block20.png"];
                    blocks[3, 0] = tex["block30.png"];
                    blocks[4, 0] = tex["block40.png"];
                    blocks[5, 0] = tex["block50.png"];
                    cruiser = tex["cruiser0.png"];
                    whitepixel = tex["white.png"];

                    while (true)
                    {
                        HandleInput();
                        m_field.Cycle();
                        Game.NextFrame();
                    }
                }
            }
            finally
            {
                Game.Window.KeyPress -= InputEvent;
            }
        }