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


C# Games.GameTime类代码示例

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


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

示例1: Update

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (Input.IsKeyPressed(Keys.W))
                textBlock.WrapText = !textBlock.WrapText;

            if (Input.IsKeyPressed(Keys.R))
            {
                textBlock.VerticalAlignment = VerticalAlignment.Stretch;
                textBlock.HorizontalAlignment = HorizontalAlignment.Stretch;
            }

            if (Input.IsKeyReleased(Keys.NumPad1))
                textBlock.VerticalAlignment = VerticalAlignment.Top;
            if (Input.IsKeyReleased(Keys.NumPad2))
                textBlock.VerticalAlignment = VerticalAlignment.Center;
            if (Input.IsKeyReleased(Keys.NumPad3))
                textBlock.VerticalAlignment = VerticalAlignment.Bottom;

            if (Input.IsKeyReleased(Keys.NumPad4))
                textBlock.HorizontalAlignment = HorizontalAlignment.Left;
            if (Input.IsKeyReleased(Keys.NumPad5))
                textBlock.HorizontalAlignment = HorizontalAlignment.Center;
            if (Input.IsKeyReleased(Keys.NumPad6))
                textBlock.HorizontalAlignment = HorizontalAlignment.Right;

            if (Input.IsKeyReleased(Keys.NumPad7))
                textBlock.TextAlignment = TextAlignment.Left;
            if (Input.IsKeyReleased(Keys.NumPad8))
                textBlock.TextAlignment = TextAlignment.Center;
            if (Input.IsKeyReleased(Keys.NumPad9))
                textBlock.TextAlignment = TextAlignment.Right;
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:34,代码来源:TextBlockWrappingTest.cs

示例2: Update

        public override void Update(GameTime gameTime)
        {
            if (Simulation.DisableSimulation) return;

            lock (this)
            {
                //read skinned meshes bone positions
                foreach (var physicsScene in scenes)
                {
                    //read skinned meshes bone positions and write them to the physics engine
                    physicsScene.Processor.UpdateBones();
                    //simulate physics
                    physicsScene.Simulation.Simulate((float)gameTime.Elapsed.TotalSeconds);
                    //update character bound entity's transforms from physics engine simulation
                    physicsScene.Processor.UpdateCharacters();

                    physicsScene.Simulation.BeginContactTesting();

                    //finally process any needed cleanup
                    physicsScene.Processor.UpdateRemovals();

                    
                    //handle frame contacts
                    physicsScene.Processor.UpdateContacts();

                    physicsScene.Simulation.EndContactTesting();

                    //send contact events
                    physicsScene.Simulation.SendEvents();                   
                }
            }
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:32,代码来源:Bullet2PhysicsSystem.cs

示例3: Update

        /// <inheritdoc/>
        public override void Update(GameTime time)
        {
            base.Update(time);
            if (ManageShadows)
            {
                InternalActiveShadowMaps.Clear();
                InternalActiveShadowMapTextures.Clear();

                foreach (var light in Lights)
                {
                    // create new shadow maps
                    if (light.Value.Light.Shadow != null)
                        CreateShadowMap(light.Value);

                    // TODO: handle shadow maps that does no require to be updated like static shadow maps.
                    // update shadow maps info
                    if (light.Value.Light.Enabled && light.Value.Light.Shadow != null && light.Value.Light.Shadow.Enabled && light.Value.ShadowMap.Update)
                    {
                        UpdateEntityLightShadow(light.Value);
                        InternalActiveShadowMaps.Add(light.Value.ShadowMap);
                        InternalActiveShadowMapTextures.Add(light.Value.ShadowMap.Texture);
                    }
                }
            }
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:26,代码来源:DynamicLightShadowProcessor.cs

示例4: Update

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (Input.IsKeyReleased(Keys.W))
                textScroller.RepeatText = !textScroller.RepeatText;

            if (Input.IsKeyDown(Keys.Right))
                textScroller.ScrollingSpeed /= 1.1f;

            if (Input.IsKeyDown(Keys.Left))
                textScroller.ScrollingSpeed *= 1.1f;

            if (Input.IsKeyReleased(Keys.C))
                textScroller.ClearText();

            if (Input.IsKeyReleased(Keys.T))
                textScroller.Text = TextWithBlanks;

            if (Input.IsKeyReleased(Keys.A))
                textScroller.AppendText(" Additional Text");

            if (Input.IsKeyReleased(Keys.B))
                IncreaseButtonSize();

            if (Input.IsKeyReleased(Keys.V))
                DecreaseButtonSize();
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:28,代码来源:ScrollingTextTest.cs

示例5: Update

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            
            if (Input.IsKeyReleased(Keys.D1))
                scrollViewer.Content = grid;
            if (Input.IsKeyReleased(Keys.D2))
                scrollViewer.Content = stackPanel;

            if (Input.IsKeyReleased(Keys.NumPad4))
                scrollViewer.ScrollToBeginning(Orientation.Horizontal);
            if (Input.IsKeyReleased(Keys.NumPad6))
                scrollViewer.ScrollToEnd(Orientation.Horizontal);
            if (Input.IsKeyReleased(Keys.NumPad8))
                scrollViewer.ScrollToBeginning(Orientation.Vertical);
            if (Input.IsKeyReleased(Keys.NumPad2))
                scrollViewer.ScrollToEnd(Orientation.Vertical);

            if (Input.IsKeyReleased(Keys.V))
                scrollViewer.ScrollMode = ScrollingMode.Vertical;
            if (Input.IsKeyReleased(Keys.H))
                scrollViewer.ScrollMode = ScrollingMode.Horizontal;
            if (Input.IsKeyReleased(Keys.B))
                scrollViewer.ScrollMode = ScrollingMode.HorizontalVertical;

            if (Input.IsKeyReleased(Keys.Space)) // check that scroll offsets are correctly updated when content gets smaller (and we are at the end of document)
                grid.Height = float.IsNaN(grid.Height) ? 100 : float.NaN;

            if (Input.IsKeyReleased(Keys.Enter)) // check that scrolling works even when IsArrange is false (try this when ScrollMode is in Horizontal mode)
            {
                grid.Height = 1000;
                scrollViewer.ScrollMode = ScrollingMode.Vertical;
                scrollViewer.ScrollToEnd(Orientation.Vertical);
            }
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:35,代码来源:ScrollViewerTest.cs

示例6: Update

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            const float ChangeFactor = 1.1f;
            const float ChangeFactorInverse = 1 / ChangeFactor;

            // change the size of the virtual resolution
            if (Input.IsKeyReleased(Keys.NumPad0))
                UIComponent.VirtualResolution = new Vector3(GraphicsDevice.BackBuffer.Width / 2f, GraphicsDevice.BackBuffer.Height / 2f, 400);
            if (Input.IsKeyReleased(Keys.NumPad1))
                UIComponent.VirtualResolution = new Vector3(GraphicsDevice.BackBuffer.Width, GraphicsDevice.BackBuffer.Height, 400);
            if (Input.IsKeyReleased(Keys.NumPad2))
                UIComponent.VirtualResolution = new Vector3(2 * GraphicsDevice.BackBuffer.Width, 2 * GraphicsDevice.BackBuffer.Height, 400);
            if (Input.IsKeyReleased(Keys.Right))
                UIComponent.VirtualResolution = new Vector3((ChangeFactor * UIComponent.VirtualResolution.X), UIComponent.VirtualResolution.Y, UIComponent.VirtualResolution.Z);
            if (Input.IsKeyReleased(Keys.Left))
                UIComponent.VirtualResolution = new Vector3((ChangeFactorInverse * UIComponent.VirtualResolution.X), UIComponent.VirtualResolution.Y, UIComponent.VirtualResolution.Z);
            if (Input.IsKeyReleased(Keys.Up))
                UIComponent.VirtualResolution = new Vector3(UIComponent.VirtualResolution.X, (ChangeFactor * UIComponent.VirtualResolution.Y), UIComponent.VirtualResolution.Z);
            if (Input.IsKeyReleased(Keys.Down))
                UIComponent.VirtualResolution = new Vector3(UIComponent.VirtualResolution.X, (ChangeFactorInverse * UIComponent.VirtualResolution.Y), UIComponent.VirtualResolution.Z);

            if (Input.IsKeyReleased(Keys.D1))
                decorator.LocalMatrix = Matrix.Scaling(1);
            if (Input.IsKeyReleased(Keys.D2))
                decorator.LocalMatrix = Matrix.Scaling(1.5f);
            if (Input.IsKeyReleased(Keys.D3))
                decorator.LocalMatrix = Matrix.Scaling(2);
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:30,代码来源:DynamicFontTest.cs

示例7: Update

 public override void Update(GameTime gameTime)
 {
     if (SceneInstance != null)
     {
         SceneInstance.Update(gameTime);
     }
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:7,代码来源:SceneSystem.cs

示例8: Draw

        protected override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            if(!ScreenShotAutomationEnabled)
                DrawCustomEffect();
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:7,代码来源:TestCustomEffect.cs

示例9: Update

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (Input.IsKeyReleased(Keys.S))
                SaveTexture(GraphicsDevice.Presenter.BackBuffer, "sprite-font-extern-test.png");
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:7,代码来源:TestExternSpriteFont.cs

示例10: Draw

        protected override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            //var time = (float)gameTime.Total.TotalSeconds;
            //cubeEntity.Transform.Rotation = Quaternion.RotationY(time) * Quaternion.RotationX(time * 0.5f);
        }
开发者ID:cg123,项目名称:xenko,代码行数:7,代码来源:TestFixedSizeUI.cs

示例11: Draw

        protected override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            if (!ScreenShotAutomationEnabled)
                DrawSprites();
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:7,代码来源:TestSpriteBatchResolution.cs

示例12: Update

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            const float depthIncrement = 1f;
            const float rotationIncrement = 0.1f;

            var localMatrix = elements[1].LocalMatrix;

            if (Input.IsKeyPressed(Keys.Up))
                localMatrix.M43 -= depthIncrement;
            if (Input.IsKeyPressed(Keys.Down))
                localMatrix.M43 += depthIncrement;
            if (Input.IsKeyPressed(Keys.NumPad4))
                localMatrix = localMatrix * Matrix.RotationY(-rotationIncrement);
            if (Input.IsKeyPressed(Keys.NumPad6))
                localMatrix = localMatrix * Matrix.RotationY(+rotationIncrement);
            if (Input.IsKeyPressed(Keys.NumPad2))
                localMatrix = localMatrix * Matrix.RotationX(+rotationIncrement);
            if (Input.IsKeyPressed(Keys.NumPad8))
                localMatrix = localMatrix * Matrix.RotationX(-rotationIncrement);
            if (Input.IsKeyPressed(Keys.NumPad1))
                localMatrix = localMatrix * Matrix.RotationZ(-rotationIncrement);
            if (Input.IsKeyPressed(Keys.NumPad9))
                localMatrix = localMatrix * Matrix.RotationZ(+rotationIncrement);

            if (Input.KeyEvents.Any())
            {
                elements[1].LocalMatrix = localMatrix;

                UpdateTextBlockText();
            }
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:33,代码来源:ClickTests.cs

示例13: Draw

        protected override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            if (!ScreenShotAutomationEnabled)
                RenderToTexture();
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:7,代码来源:TestSpriteBatchToTexture.cs

示例14: Draw

        public override void Draw(GameTime gameTime)
        {
            if (SceneInstance == null || MainRenderFrame == null)
            {
                return;
            }

            // If the width or height changed, we have to recycle all temporary allocated resources.
            // NOTE: We assume that they are mostly resolution dependent.
            if (previousWidth != MainRenderFrame.Width || previousHeight != MainRenderFrame.Height)
            {
                // Force a recycle of all allocated temporary textures
                renderContext.Allocator.Recycle(link => true);
            }

            previousWidth = MainRenderFrame.Width;
            previousHeight = MainRenderFrame.Height;

            // Update the entities at draw time.
            renderContext.Time = gameTime;
            SceneInstance.Draw(renderContext);

            // Renders the scene
            SceneInstance.Draw(renderContext, MainRenderFrame);
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:25,代码来源:SceneSystem.cs

示例15: Update

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (Input.IsKeyReleased(Keys.D1))
                element1.ClipToBounds = !element1.ClipToBounds;
            if (Input.IsKeyReleased(Keys.D2))
                element2.ClipToBounds = !element2.ClipToBounds;
            if (Input.IsKeyReleased(Keys.D3))
                element3.ClipToBounds = !element3.ClipToBounds;
            if (Input.IsKeyReleased(Keys.D4))
                element4.ClipToBounds = !element4.ClipToBounds;

            if (Input.IsKeyDown(Keys.Left))
                element3.LocalMatrix = Matrix.Translation(element3.LocalMatrix.TranslationVector - Vector3.UnitX);
            if (Input.IsKeyDown(Keys.Right))
                element3.LocalMatrix = Matrix.Translation(element3.LocalMatrix.TranslationVector + Vector3.UnitX);

            if (Input.IsKeyDown(Keys.Up))
                element3.LocalMatrix = Matrix.Translation(element3.LocalMatrix.TranslationVector - Vector3.UnitY);
            if (Input.IsKeyDown(Keys.Down))
                element3.LocalMatrix = Matrix.Translation(element3.LocalMatrix.TranslationVector + Vector3.UnitY);

            if (Input.IsKeyDown(Keys.NumPad7))
                MoveElementToLeftTopCorner();
            if (Input.IsKeyDown(Keys.NumPad9))
                MoveElementToRightTopCorner();
            if (Input.IsKeyDown(Keys.NumPad5))
                MoveElementToIntersection();
            if (Input.IsKeyDown(Keys.NumPad3))
                MoveElementToRightBottomCorner();
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:32,代码来源:ClippingTest.cs


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