Ejemplo n.º 1
0
        public MainPage()
        {
            InitializeComponent();

            SoundPlayer.FillDictionary(App.Current.Resources.MergedDictionaries[0]);
            SoundPlayer.BackgroundMusic.FillBgDictionary(App.Current.Resources.MergedDictionaries[1]);
            TextHandler.FillDictionary(App.Current.Resources.MergedDictionaries[2]);

            this.GotFocus  += MainPageGotFocus;
            this.LostFocus += MainPageLostFocus;

            _keyHandler = new KeyHandler(this);

            _menuEngine           = new MenuEngine(this.gameSurface);
            _menuEngine.Updated  += MenuEngineUpdated;
            _levelEngine          = new LevelEngine(new Canvas());
            _levelEngine.Renewed += LevelEngineRenewed;
            _hudEngine            = new HudEngine(new Canvas());
            _scoreEngine          = new ScoreEngine(new Canvas(), 10);

            Level.Player = Player = new Player();

            _renderNotifier = new RenderNotifier(this);
            _renderNotifier.AddObservedChild(this.gameSurface);
            _renderNotifier.RenderComplete += RenderNotifierRenderComplete;

            _mainLoop         = new CompositionTargetGameLoop();
            _mainLoop.Update += MainLoopUpdate;
        }