• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Framework.GameTimer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



GameTimer类属于Microsoft.Xna.Framework命名空间,在下文中一共展示了GameTimer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GamePage

        public GamePage()
        {
            InitializeComponent();

            // Get the application's ContentManager
            content = (Application.Current as App).Content;

            timer = new GameTimer { UpdateInterval = TimeSpan.FromTicks(333333) };
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

            dispatcherTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(50) };
            dispatcherTimer.Tick += (sender, e1) => Detect();

            if (GameState.getInstance(false) != null)
            {
                GameState.getInstance().resetTurn();
            }

            //setup microphone and configure delegates that handle events
            microphone.BufferDuration = TimeSpan.FromSeconds(1);
            microphoneBuffer = new byte[microphone.GetSampleSizeInBytes(microphone.BufferDuration)];

            BasicHttpBinding binding = new BasicHttpBinding() { MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue };
            EndpointAddress address = new EndpointAddress(voiceRecognitionServerIP);
            speechRecognitionClient = new ARVRClient(binding, address);

            microphone.BufferReady += delegate
            {
                microphone.GetData(microphoneBuffer);
                microphoneMemoryStream.Write(microphoneBuffer, 0, microphoneBuffer.Length);
            };
            speechRecognitionClient.RecognizeSpeechCompleted += new EventHandler<RecognizeSpeechCompletedEventArgs>(_client_RecognizeSpeechCompleted);
        }
开发者ID:ARChess,项目名称:ARChess,代码行数:34,代码来源:GamePage.xaml.cs


示例2: Animate

        public void Animate(GameTimer timer, Player player)
        {
            if (player.IsAlive)
                this.Position += direction * velocity * (float)timer.UpdateInterval.TotalSeconds;

            if (this.assetName != "bomb")
            {
                if (currentFrame < animate.Length)
                {
                    Source = sources[animate[currentFrame]];
                    currentFrame++;
                }
                else
                    currentFrame = 0;
            }
            else
            {
                if (this.Scale < 0.75f && smallest)
                    this.Scale += 0.6f * (float)timer.UpdateInterval.TotalSeconds;
                else
                {
                    smallest = false;
                    biggest = true;
                }
                if (this.Scale > 0.4f && biggest)
                    this.Scale -= 0.6f * (float)timer.UpdateInterval.TotalSeconds;
                else
                {
                    smallest = true;
                    biggest = false;
                }
            }
        }
开发者ID:kulhajs,项目名称:wp_planes,代码行数:33,代码来源:Powerup.cs


示例3: Update

        public void Update(GameTimer timer)
        {
            this.Position += gravity * velocity * (float)timer.UpdateInterval.TotalSeconds;

            if (this.Rotation < wRotation)
                this.Rotation += 0.02f;
        }
开发者ID:kulhajs,项目名称:wp_planes,代码行数:7,代码来源:Bomb.cs


示例4: GamePage

        public GamePage()
        {
            InitializeComponent();

            // Obtenir le gestionnaire de contenu de l’application
            contentManager = (Application.Current as App).Content;

            // Créer un minuteur pour cette page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

            this.map = new Map(this);
            server = new Network();
            this.plist = new List<Player>();
            this.elist = new List<Egg>();
            this.tlist = new List<string>();
            this.lbc = new Queue<string>();
            this.screen = new Microsoft.Xna.Framework.Rectangle(0, 0, 800, 480);
            this.inventory_details = null;
            this.inventory_timer = TimeSpan.Zero;
            this.dot = new Vector2(640, 360);
            this.end = false;
            this.winner = "toto";
        }
开发者ID:fiahil,项目名称:Zappy,代码行数:26,代码来源:GamePage.xaml.cs


示例5: GameOverPage

        public GameOverPage()
        {
            InitializeComponent();

            App app = Application.Current as App;
            Score.Text = "Score: " + app.Score.ToString("#,#");
            app.Leaderboard.AddEntry(app.Score);

            //for(int e = 0; e < app.Leaderboard.Entries.Count; e++)
            //{
            //    Leaderboard.Text += app.Leaderboard.Entries[e].Rank + ". " + app.Leaderboard.Entries[e].Date + " " + app.Leaderboard.Entries[e].Score + "\n";
            //}

            graphicsDevice = SharedGraphicsDeviceManager.Current.GraphicsDevice;

            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;

            // Create a timer for this page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

            LayoutUpdated += new EventHandler(GameOverPage_LayoutUpdated);
        }
开发者ID:ronforbes,项目名称:vectorarena_backup,代码行数:26,代码来源:GameOverPage.xaml.cs


示例6: Update

        public void Update(GameTimer timer, ContentManager theContentManager, PowerupHandler pu, Player player, bool soundMuted)
        {
            enemiesInLevel = (background.Period + 1) * 3;

            elapsedTime += (float)timer.UpdateInterval.TotalSeconds;
            if (elapsedTime > 45f / enemiesInLevel && readyEnemies.Count > 0) //45f = time to 4000px to pass (current background width = 2000px)
            {
                elapsedTime = 0;
                readyEnemies[0].Position = new Vector2(player.Position.X + random.Next(760, 810), random.Next(110, 450));
                visibleEnemies.Add(readyEnemies[0]);
                readyEnemies.Remove(readyEnemies[0]);
            }

            foreach (Enemy e in visibleEnemies)
            {
                if (e.Position.X < player.Position.X - 100)
                {
                    if (e.IsAlive && player.IsAlive)
                        player.score.AddPoints(-5);
                    e.IsAlive = true;
                    e.Hitpoints = maxHealth;
                    e.ExplosionCreated = false;
                    e.explosionHandler.explosions.Clear();
                    readyEnemies.Add(e);
                    visibleEnemies.Remove(e);
                    break;
                }
                e.Update(timer, pu, theContentManager, player, soundMuted);
            }
        }
开发者ID:kulhajs,项目名称:wp_planes,代码行数:30,代码来源:EnemyHandler.cs


示例7: GamePage

        public GamePage()
        {
            InitializeComponent();

            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;

            // Create a timer for this page
            timer = new GameTimer();
            //timer.UpdateInterval = TimeSpan.FromTicks(333333);

            // Using TimeSpan.Zero causes the update to happen
            // at the actual framerate of the device. This makes
            // animation much smoother. However, this will cause
            // the speed of the app to vary from device to device
            // where a fixed UpdateInterval will not.
            timer.UpdateInterval = TimeSpan.Zero;
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

            // Use the LayoutUpdate event to know when the page layout
            // has completed so we can create the UIElementRenderer
            LayoutUpdated += new EventHandler(GamePage_LayoutUpdated);
            LayoutUpdated += new EventHandler(GamePage_LayoutUpdated);
        }
开发者ID:bertuck,项目名称:RushWindowsPhone,代码行数:25,代码来源:GamePage.xaml.cs


示例8: 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


示例9: GamePage_Loaded

        private void GamePage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!pageLoaded)
            {
                manager = SharedGraphicsDeviceManager.Current;
                manager.PreferredBackBufferWidth = (int)this.ActualWidth;
                manager.PreferredBackBufferHeight = (int)this.ActualHeight;
                manager.SwapChainPanel = this;
                manager.ApplyChanges();

                gameTimer = new GameTimer();
                gameTimer.UpdateInterval = TimeSpan.FromTicks(166666);
                gameTimer.Update += Update;
                gameTimer.Draw += Draw;

                this.SizeChanged += GamePage_SizeChanged;

                // Le contenu est chargé une fois
                LoadContent();

                pageLoaded = true;
            }

            // L'initialisation doit se faire à chaque rechargement
            Initialize();
        }
开发者ID:JordanDx,项目名称:demonixis.tutorials,代码行数:26,代码来源:GamePage.xaml.cs


示例10: Menu

        public Menu()
        {
            InitializeComponent();
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;

            this.image_PlayGame.Tap += new EventHandler<GestureEventArgs>(image_PlayGame_Tap);
        }
开发者ID:cikidot,项目名称:game-xna-herobot,代码行数:9,代码来源:Menu.xaml.cs


示例11: Update

 public void Update(GameTimer timer, bool move, bool soundMuted)
 {
     foreach (Explosion e in explosions)
     {
         e.Explode(soundMuted);
         if (move)
             e.Position += direction * velocity * (float)timer.UpdateInterval.TotalSeconds;
     }
 }
开发者ID:kulhajs,项目名称:wp_planes,代码行数:9,代码来源:ExplosionHandler.cs


示例12: MapGamePageView

        /// <summary>
        /// Creates a new map game page view using the given content manager.
        /// </summary>
        /// <param name="contentManager"></param>
        public MapGamePageView(ContentManager contentManager)
        {
            // Get the content manager from the application
            _contentManager = contentManager;

            // Create a timer for this page
            _timer = new GameTimer();
            _timer.UpdateInterval = TimeSpan.FromTicks(333333);
            _timer.Update += OnUpdate;
            _timer.Draw += OnDraw;
        }
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:15,代码来源:MapGamePageView.cs


示例13: 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


示例14: PlayLevel

        public PlayLevel()
        {
            InitializeComponent();
            goalReached = false;
            gameTime = new GameTimer();
            gameTime.UpdateInterval = TimeSpan.FromSeconds(0.03);
            gameTime.Update += new EventHandler<GameTimerEventArgs>(gameTime_Update);
            levelName = "levelname";

            GObjs = new List<GameObject>();
            //deserializeJsonAsync();
            
            // Load Level to the canvas
            /*
            EnemyTemp = new Enemy();
            enemyNoGravity = false;
            Enemies = new List<Enemy>();
            Enemies.Add(new Enemy(10,10,10,10,10,1,1000,true,false));
            Enemies.Add(new Enemy(10,100,10,10,10,1,1000,false,true));
            foreach (Enemy e in Enemies)
            {
                Canvas.SetLeft(e.hitbox, e.Left);
                Canvas.SetTop(e.hitbox, e.Top);
                canvasWorld.Children.Add(e.hitbox);

            }
            */

            kbLeft = false;
            kbRight = false;
            topTemp = 0;
            jump = 0;
            doubleJumpAvaivable = true;

            /*
            //GObjs.Add(new GameObject(10,10,100,10));
            GObjs.Add(new GameObject(100, 10, 100, 10));
            GObjs.Add(new GameObject(150, 110, 100, 10));
            GObjs.Add(new GameObject(200, 210, 100, 10));
            GObjs.Add(new GameObject(250, 310, 100, 10));

            foreach (GameObject go in GObjs)
            {
                Canvas.SetLeft(go.hitbox, go.Left);
                Canvas.SetTop(go.hitbox, go.Top);
                canvasWorld.Children.Add(go.hitbox);
                
            }
            */

            //MessageBox.Show("Start Game");
            //gameTime.Start();

        }
开发者ID:Bulltrick,项目名称:DIY-PlatformerWP,代码行数:54,代码来源:PlayLevel.xaml.cs


示例15: Animate

 public void Animate(GameTimer timer, Player player)
 {
     foreach (Powerup pu in powerups)
     {
         pu.Animate(timer, player);
         if (pu.X < -16)
         {
             powerups.Remove(pu);
             break;
         }
     }
 }
开发者ID:kulhajs,项目名称:wp_planes,代码行数:12,代码来源:PowerupHandler.cs


示例16: GamePage

        public GamePage()
        {
            InitializeComponent();

            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;

            // Create a timer for this page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;
        }
开发者ID:romanellius,项目名称:Organaizer_,代码行数:13,代码来源:GamePage.xaml.cs


示例17: Couteau

        public Couteau()
        {
            InitializeComponent();

            // Obtenir le gestionnaire de contenu à partir de l'application
            contentManager = (Application.Current as App).Content;

            // Créez une minuterie pour cette page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;
        }
开发者ID:Branlute,项目名称:victor,代码行数:13,代码来源:Couteau.xaml.cs


示例18: BuilderPage

        public BuilderPage()
        {
            InitializeComponent();

            // Obtenga el administrador de contenido de la aplicación
            contentManager = (Application.Current as App).Content;
            LayoutUpdated += new EventHandler(XNARendering_LayoutUpdated);
            // Crear un temporizador para esta página
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;
        }
开发者ID:hackaton-betaJuegos,项目名称:wpbuilder,代码行数:13,代码来源:BuilderPage.xaml.cs


示例19: MainPage

        public MainPage()
        {
            this.InitializeComponent();
            this.Loaded += this.OnLoad;

            this.gameTimer = new GameTimer();
            this.gameTimer.Draw += this.OnDraw;
            this.gameTimer.Update += this.OnUpdate;
            this.gameTimer.UpdateInterval = TimeSpan.Zero;

            var services = new AppServiceProvider();
            services.AddService(typeof(IGraphicsDeviceService), SharedGraphicsDeviceManager.Current);
        }
开发者ID:aschearer,项目名称:XNA-Project-Templates,代码行数:13,代码来源:MainPage.xaml.cs


示例20: GamePage

        public GamePage()
        {
            InitializeComponent();

            // Get the content manager from the application
            _contentManager = ((App) Application.Current).Content;

            // Create a timer for this page
            _timer = new GameTimer {UpdateInterval = TimeSpan.FromTicks(333333)};
            _timer.Update += OnUpdate;
            _timer.Draw += OnDraw;
            _screenHeight = SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height - 162;
            _screenWidth = SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width;
        }
开发者ID:KarolDabrowski,项目名称:Asteroids-XNA,代码行数:14,代码来源:GamePage.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Framework.GameTimerEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Framework.GameTime类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap