Example #1
0
        public Game1()
        {
            var graphics = new GraphicsDeviceManager(this)
            {
                IsFullScreen = false,
                PreferredBackBufferHeight = 640,
                PreferredBackBufferWidth = 640
            };
            graphics.ApplyChanges();
            Content.RootDirectory = "Content";

            _timer = Timer;
            _blockFactory = new BlockFactory(Content);
        }
 //Generates a newly spawned random playable block at the top of the map
 public void GenerateNewBlock()
 {
     CurrentBlock = BlockFactory.CreateBlockRandom(Drawer, 5, 0);
 }
        //handles any initialization to be done before main game loop
        protected override void Initialize()
        {
            //screen initialization
            graphics.PreferredBackBufferWidth = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            graphics.ApplyChanges();
            IsMouseVisible = true;

            //game component initialization
            Components.Add(inputHandler = new InputHandler(this));

            base.Initialize();

            //game object initialization
            blockFactory = new BlockFactory(squareTex, origin);
            blockList = new List<TetBlock>();
            tetBoard = new TetBoard(gridUnit);
        }