本文整理汇总了C#中SharpDX.Toolkit.GameTime类的典型用法代码示例。如果您正苦于以下问题:C# GameTime类的具体用法?C# GameTime怎么用?C# GameTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameTime类属于SharpDX.Toolkit命名空间,在下文中一共展示了GameTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(GameTime gametime)
{
game.GraphicsDevice.SetVertexBuffer(vertices);
game.GraphicsDevice.SetVertexInputLayout(inputLayout);
effect.CurrentTechnique.Passes[0].Apply();
game.GraphicsDevice.Draw(PrimitiveType.TriangleList, vertices.ElementCount);
}
示例2: PostUpdate
public override void PostUpdate(GameTime gameTime)
{
if (parent != null)
{
parent.WorldBound = parent.WorldBound.Merge(this.WorldBound);
}
}
示例3: Update
public void Update(GameTime gameTime)
{
if (Screens.Count > 0)
{
Screen foregroundScreen = Screens.Peek();
List<Screen> Temp = Screens.ToList();
foreach (Screen screen in Temp)
{
if (screen.State == Screen.States.FullyClosed)
{
if (screen == foregroundScreen)
Screens.Pop();
else
continue;
}
screen.Update(gameTime, screen == foregroundScreen);
}
}
if (toOpenWhenCleared != null && Screens.Count == 0)
{
OpenScreen(toOpenWhenCleared);
toOpenWhenCleared = null;
}
}
示例4: Draw
public void Draw(GameTime gameTime)
{
foreach (var ctrl in Controls)
{
ctrl.Draw();
}
}
示例5: Draw
protected override void Draw(GameTime gameTime)
{
// Use time in seconds directly
var time = (float) gameTime.TotalGameTime.TotalSeconds;
// Clears the screen with the Color.CornflowerBlue
GraphicsDevice.Clear(Color.CornflowerBlue);
GraphicsDevice.SetRasterizerState(_wireframe ? GraphicsDevice.RasterizerStates.WireFrame : GraphicsDevice.RasterizerStates.Default);
_fx.Parameters["World"].SetValue(Matrix.Scaling(2.0f, 2.0f, 2.0f)*
Matrix.RotationX(0.4f*(float) Math.Sin(time*1.45))*
Matrix.RotationY(time*0.9f)*
Matrix.Translation(-2, 0, -4));
foreach (var effectPass in _fx.CurrentTechnique.Passes)
{
effectPass.Apply();
GraphicsDevice.SetVertexBuffer(_vertexBuffer);
GraphicsDevice.SetVertexInputLayout(_vertexInputLayout);
GraphicsDevice.Draw(PrimitiveType.TriangleList, _vertexBuffer.ElementCount);
}
base.Draw(gameTime);
}
示例6: Update
public override void Update(Camera camera, GameTime gameTime)
{
base.Update(camera, gameTime);
foreach (var item in Items)
item.Age += (float) gameTime.ElapsedGameTime.TotalSeconds;
Items.RemoveAll(_ => _.Age > _.TimeToLive);
}
示例7: Draw
public void Draw(GameTime gameTime)
{
foreach (var o in Children.ToList())
{
o.Draw(gameTime);
}
}
示例8: Update
public override void Update(GameTime gameTime, int x, int y)
{
base.Update(gameTime, x, y);
if (x != X || y != Y)
throw new ArgumentException("Wrong coordinate");
Update(gameTime);
}
示例9: Update
public void Update(Camera camera, GameTime gameTime, ref IGameState gameState)
{
_turnAround ^= _serpents.Camera.KeyboardState.IsKeyPressed(Keys.Down);
SerpentCamera.Move(gameTime);
_serpents.Update(camera, gameTime);
_serpents.UpdateScore();
//camera.UpdateFreeFlyingCamera(gameTime);
switch (_serpents.GameStatus())
{
case Serpents.Result.LevelComplete:
_delayAfterLevelComplete += (float) gameTime.ElapsedGameTime.TotalSeconds;
if (_delayAfterLevelComplete > 3)
{
_serpents.PlayerSerpent.DirectionTaker = null;
gameState = new LevelCompleteState(_serpents);
}
break;
case Serpents.Result.PlayerDied:
_serpents.PlayerSerpent.DirectionTaker = null;
gameState = new DieState(_serpents);
break;
}
}
示例10: Update
public override void Update(GameTime gametime)
{
this.PhysicsDescription.ApplyImpulse(PhysicsSystem.toJVector(game.inputManager.SecondaryDirection() * 400f), PhysicsSystem.toJVector(Vector3.Zero));
this.PhysicsDescription.ApplyImpulse(PhysicsSystem.toJVector(game.inputManager.Acceleration() * 400f), PhysicsSystem.toJVector(Vector3.Zero));
base.Update(gametime);
}
示例11: Draw
public void Draw(GameTime gametime)
{
// Some objects such as the Enemy Controller have no model and thus will not be drawn
if (model != null)
{
// Setup the vertices
//game.GraphicsDevice.SetVertexBuffer(0, myModel.vertices, myModel.vertexStride);
//game.GraphicsDevice.SetVertexInputLayout(myModel.inputLayout);
// Apply the basic effect technique and draw the object
basicEffect.CurrentTechnique.Passes[0].Apply();
//game.GraphicsDevice.Draw(PrimitiveType.TriangleList, myModel.vertices.ElementCount);
// Draw the model
if (type != GameObjectType.Player)
model.Draw(game.GraphicsDevice, basicEffect.World, game.camera.View, game.camera.Projection);
else
model.Draw(game.GraphicsDevice, basicEffect.World, Matrix.LookAtLH(Camera.originalPos, Camera.originalTarget, Camera.originalUp),
game.camera.Projection);
}
else if (texture != null)
{
Vector2 pos2D = new Vector2(pos.X, pos.Y);
game.spriteBatch.Begin();
game.spriteBatch.Draw(texture, pos2D, Color.White);
game.spriteBatch.End();
}
}
示例12: Draw
/// <summary>
/// Draws game content.
/// </summary>
/// <param name="gameTime">Structure containing information about elapsed game time.</param>
protected override void Draw(GameTime gameTime)
{
// clear the scene to a CornflowerBlue color
GraphicsDevice.Clear(Color.CornflowerBlue);
base.Draw(gameTime);
}
示例13: Draw
public void Draw(SpriteBatch _spriteBatch, GameTime gameTime)
{
foreach (Entity e in entities)
{
e.Render(_spriteBatch);
}
}
示例14: Update
public override void Update(Camera camera, GameTime gameTime)
{
_angle += (float) gameTime.ElapsedGameTime.TotalSeconds;
if (_angle > MathUtil.TwoPi)
_angle -= MathUtil.TwoPi;
_animatedBone.Transform = Matrix.RotationZ(_angle)*_originalBoneTransformation;
}
示例15: Draw
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch, int x, int y, Rectangle destinationRect)
{
base.Draw(gameTime, spriteBatch, x, y, destinationRect);
if (x != X || y != Y)
throw new ArgumentException("Wrong coordinate");
Draw(gameTime, spriteBatch, destinationRect);
}