예제 #1
0
        Random rand; //random number generator

        #endregion Fields

        #region Constructors

        //must pass lanewidth from Game1 object
        public GameBoard( int displayWidth )
        {
            int laneWidth = displayWidth / ( laneCount );
            //set up random numbers
            this.rand = new Random();

            this.Lanes = new int[7];
            for( int i = 0; i < laneCount; i++ ) {
                this.Lanes[i] = i * laneWidth;
            }

            this.currentNutList = new List<Nut>();
            this.removeNutList = new List<Nut>();
            //this.currentPineCones = new List<PineCone>();
            //this.removePineCones = new List<PineCone>();

            //sets up event, to affect frequency of nuts, adjust update interval...perhaps add randomness?
            this.nutsFalling = new GameTimer();
            nutsFalling.UpdateInterval = TimeSpan.FromSeconds(nutFrequency);
            nutsFalling.Update += new EventHandler<GameTimerEventArgs>(generateNuts);
            nutsFalling.Start();

            //sets up level up timer
            this.levelTimer = new GameTimer();
            levelTimer.UpdateInterval = TimeSpan.FromSeconds(levelFrequency);
            levelTimer.Update += new EventHandler<GameTimerEventArgs>(levelUp);
            levelTimer.Start();
        }
예제 #2
0
        public void initializeGameTimer()
        {
            Microsoft.Xna.Framework.GameTimer gameTimer = new Microsoft.Xna.Framework.GameTimer();
            gameTimer.UpdateInterval = TimeSpan.FromMilliseconds(33);

            gameTimer.Update += delegate { try { FrameworkDispatcher.Update(); } catch { } };

            gameTimer.Start();

            FrameworkDispatcher.Update();
        }
예제 #3
0
        // Performs initialization of the XNA types required for the application.
        private void InitializeXnaApplication()
        {
            // Create the service provider
            Services = new AppServiceProvider();

            // Add the SharedGraphicsDeviceManager to the Services as the IGraphicsDeviceService for the app
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
            }

            // Create the ContentManager so the application can load precompiled assets
            Content = new ContentManager(Services, "Content");

            // Create a GameTimer to pump the XNA FrameworkDispatcher
            FrameworkDispatcherTimer = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();
        }
예제 #4
0
        // Esegue l'inizializzazione dei tipi XNA richiesti per l'applicazione.
        private void InitializeXnaApplication()
        {
            // Creare provider di servizi
            Services = new AppServiceProvider();

            // Aggiungere SharedGraphicsDeviceManager ai servizi come IGraphicsDeviceService per l'applicazione
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
            }

            // Creare l'elemento ContentManager per caricare gli asset precompilati nell'applicazione
            Content = new ContentManager(Services, "Content");

            // Creare un elemento GameTimer per fornire l'elemento FrameworkDispatcher XNA
            FrameworkDispatcherTimer = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();
        }
예제 #5
0
        // Performs initialization of the XNA types required for the application.
        private void InitializeXnaApplication()
        {
            // Create the ContentManager so the application can load precompiled assets
            Content = new ContentManager(this, "Content");

            // Create a GameTimer to pump the XNA FrameworkDispatcher
            FrameworkDispatcherTimer = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();
        }
예제 #6
0
        public MainPageViewModel(INavigationService n)
        {
            // XNA stuff for media control
            GameTimer gameTimer = new GameTimer();
            gameTimer.UpdateInterval = TimeSpan.FromMilliseconds(33);
            gameTimer.Update += delegate { try { FrameworkDispatcher.Update(); } catch { } };
            gameTimer.Start();

            // navigation service
            this.navigationService = n;

            // event handlers
            MediaPlayer.ActiveSongChanged += new EventHandler<EventArgs>(SongChanged);
            MediaPlayer.MediaStateChanged += new EventHandler<EventArgs>(StateChanged);

            FrameworkDispatcher.Update();

            currentAccentColorHex = (System.Windows.Media.Color)Application.Current.Resources["PhoneAccentColor"];
            if (MediaPlayer.GameHasControl)
            {
                MessageBox.Show(AppResources.TurnMusicOnLongWP7);
                IsEnabled = false;
            }
            else
            {
                IsEnabled = true;
                NextSongBackground = currentAccentColorHex.ToString();

                UpdateView();
            }
            
            
        }
예제 #7
0
파일: App.xaml.cs 프로젝트: Branlute/victor
        // Procède à l'initialisation des types XNA requis pour l'application.
        private void InitializeXnaApplication()
        {
            // Créer le fournisseur de services
            Services = new AppServiceProvider();

            // Ajouter le SharedGraphicsDeviceManager aux Services en tant que IGraphicsDeviceService pour l'application
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
            }

            // Créez le Gestionnaire de contenu pour que l'application puisse charger les licences pré-compilées
            Content = new ContentManager(Services, "Content");

            // Créez un GameTimer pour pomper le FrameworkDispatcher XNA
            FrameworkDispatcherTimer = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();
        }
예제 #8
0
        // Führt die Initialisierung der für die Anwendung erforderlichen XNA-Typen aus.
        private void InitializeXnaApplication()
        {
            // Dienstanbieter erstellen
            Services = new AppServiceProvider();

            // Diensten den SharedGraphicsDeviceManager als IGraphicsDeviceService für die App hinzufügen
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
            }

            // ContentManager erstellen, damit die Anwendung vorkompilierte Ressourcen laden kann
            Content = new ContentManager(Services, "Content");

            // GameTimer zum Auffüllen des XNA FrameworkDispatcher erstellen
            FrameworkDispatcherTimer = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();
        }
예제 #9
0
        // Performs initialization of the XNA types required for the application.
        private void InitializeXnaApplication()
        {
            // Create the service provider
            Services = new AppServiceProvider();

            // Add the SharedGraphicsDeviceManager to the Services as the IGraphicsDeviceService for the app
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
            }

            // Create the ContentManager so the application can load precompiled assets
            Content = new ContentManager(Services, "Content");

            // Create a GameTimer to pump the XNA FrameworkDispatcher
            FrameworkDispatcherTimer = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();

            Settings = new Settings();
            AudioManager = new AudioManager(Settings.SoundEnabled, Settings.Volume / Settings.MaxVolume, Settings.MusicEnabled, Settings.Volume / Settings.MaxVolume);
            AudioManager.LoadSong("BasicDrumBeat", Content);
            AudioManager.LoadSong("ParticleFusion", Content);
            AudioManager.LoadSound("ClosedHihat", Content);
            AudioManager.LoadSound("Cymbal", Content);
            Leaderboard = new Leaderboard();
        }
예제 #10
0
        // Lleva a cabo la inicialización de los tipos de XNA necesarios para la aplicación.
        private void InitializeXnaApplication()
        {
            // Cree el proveedor de servicios
            Services = new AppServiceProvider();

            // Agregue el objeto SharedGraphicsDeviceManager a los servicios como objeto IGraphicsDeviceService de la aplicación
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
            }

            // Crear el objeto ContentManager para que la aplicación pueda cargar activos precompilados
            Content = new ContentManager(Services, "Content");

            // Crear un objeto GameTimer para proporcionar la clase FrameworkDispatcher de XNA
            FrameworkDispatcherTimer = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();
        }
예제 #11
0
        protected override void Initialize()
#endif
        {
            // TODO: Add your initialization logic here

#if WINDOWS_RT

            GraphicsDevice = _graphicsManager.GraphicsDevice;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            BugSenseHandler.Instance.Init("e1821f8f");
            BugSenseHandler.Instance.ScreenOrientation = "Landscape";
            var pp = GraphicsDevice.PresentationParameters;
            BugSenseHandler.Instance.ScreenSize.X = pp.BackBufferWidth;
            BugSenseHandler.Instance.ScreenSize.Y = pp.BackBufferHeight;
            

            BugSenseHandler.LogError(new Exception("WINRT Exception"), "This is an error");
            
            _timer = new GameTimer();
            _timer.UpdateInterval = TimeSpan.Zero;
            _timer.Draw += (o, a) => Draw(new GameTime(a.TotalTime, a.ElapsedTime));
            //_timer.Update += (o, a) => Update(new GameTime(a.TotalTime, a.ElapsedTime));
            _timer.Start();
#else
            base.Initialize();
#endif

            
        }