本文整理汇总了C#中SiliconStudio.Paradox.Games.GameTime类的典型用法代码示例。如果您正苦于以下问题:C# GameTime类的具体用法?C# GameTime怎么用?C# GameTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameTime类属于SiliconStudio.Paradox.Games命名空间,在下文中一共展示了GameTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (Input.KeyEvents.Count > 0)
toggle.IsThreeState = !toggle.IsThreeState;
}
示例2: 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);
}
}
}
}
示例3: Draw
public override void Draw(GameTime gameTime)
{
if (SceneInstance == 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);
}
示例4: Update
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (Input.IsKeyReleased(Keys.S))
SaveTexture(GraphicsDevice.BackBuffer, "sprite-font-bitmap-test.png");
}
示例5: 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);
}
示例6: 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;
}
示例7: 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();
}
}
示例8: Update
public override void Update(GameTime gameTime)
{
if (SceneInstance != null)
{
SceneInstance.Update(gameTime);
}
}
示例9: Draw
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
if(!ScreenShotAutomationEnabled)
DrawImages();
}
示例10: 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);
}
}
示例11: Update
public override void Update(GameTime gameTime)
{
scriptsToStartCopy.Clear();
scriptsToStartCopy.AddRange(scriptsToStart);
// Start new scripts
foreach (var script in scriptsToStartCopy)
{
// Start the script
script.Start();
// Start a microthread with execute method if it's an async script
var asyncScript = script as AsyncScript;
if (asyncScript != null)
{
script.MicroThread = AddTask(asyncScript.Execute);
}
}
scriptsToStart.Clear();
// Run current micro threads
Scheduler.Run();
syncScriptsCopy.Clear();
syncScriptsCopy.AddRange(syncScripts);
// Execute sync scripts
foreach (var script in syncScriptsCopy)
{
script.Update();
}
}
示例12: 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();
}
示例13: 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();
}
示例14: Draw
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
if (!ScreenShotAutomationEnabled)
RenderToTexture();
}
示例15: ManualUpdates
public void ManualUpdates(double elapsedSeconds, int updateTimes)
{
var elapsedSpan = TimeSpan.FromSeconds(elapsedSeconds);
var gameTime = new GameTime(elapsedSpan, elapsedSpan);
for (int i = 0; i < updateTimes; i++)
base.Update(gameTime);
}