本文整理汇总了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;
}
示例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();
}
}
}
示例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);
}
}
}
}
示例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();
}
示例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);
}
}
示例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);
}
示例7: Update
public override void Update(GameTime gameTime)
{
if (SceneInstance != null)
{
SceneInstance.Update(gameTime);
}
}
示例8: Draw
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
if(!ScreenShotAutomationEnabled)
DrawCustomEffect();
}
示例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");
}
示例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);
}
示例11: Draw
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
if (!ScreenShotAutomationEnabled)
DrawSprites();
}
示例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();
}
}
示例13: Draw
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
if (!ScreenShotAutomationEnabled)
RenderToTexture();
}
示例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);
}
示例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();
}