当前位置: 首页>>代码示例>>C#>>正文


C# GameTimer.Start方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.GameTimer.Start方法的典型用法代码示例。如果您正苦于以下问题:C# GameTimer.Start方法的具体用法?C# GameTimer.Start怎么用?C# GameTimer.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.GameTimer的用法示例。


在下文中一共展示了GameTimer.Start方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GameBoard

        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();
        }
开发者ID:chrisco255,项目名称:Project-N4N,代码行数:35,代码来源:GameBoard.cs

示例2: initializeGameTimer

        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();
        }
开发者ID:NAWEB-USP,项目名称:SmartAudioCityGuide,代码行数:11,代码来源:Route.xaml.cs

示例3: InitializeXnaApplication

        // 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();
        }
开发者ID:Alxandr,项目名称:Hackaton,代码行数:21,代码来源:App.xaml.cs

示例4: InitializeXnaApplication

        // 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();
        }
开发者ID:peter-popov,项目名称:xomango,代码行数:11,代码来源:App.xaml.cs

示例5: MainPageViewModel

        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();
            }
            
            
        }
开发者ID:kkoscielniak,项目名称:car_audio,代码行数:33,代码来源:MainPageViewModel.cs

示例6: InitializeXnaApplication

        // 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();
        }
开发者ID:ronforbes,项目名称:vectorarena_backup,代码行数:29,代码来源:App.xaml.cs

示例7: Initialize

        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

            
        }
开发者ID:Aranda,项目名称:BugSense-Windows-Phone-library,代码行数:30,代码来源:Game1.cs


注:本文中的Microsoft.Xna.Framework.GameTimer.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。