some tutorial fixes
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
be028dd21c
commit
6c13f42a90
|
@ -32,7 +32,7 @@ namespace MyGame.Renderers
|
|||
this.gridSize = 16;
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
if (SomeComponent<EditorModeComponent>() && SomeComponent<MouseComponent>())
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace PongFE.Renderers
|
|||
{
|
||||
public class Texture2DRenderer : Renderer
|
||||
{
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -59,13 +59,14 @@ namespace PongFE.Renderers
|
|||
_spriteBatch = spriteBatch;
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
|
||||
|
||||
foreach (ref readonly var entity in ReadEntities<Texture2DComponent>())
|
||||
{
|
||||
ref readonly var positionComponent = ref GetComponent<PositionComponent>(entity);
|
||||
ref readonly var textureComponent = ref GetComponent<Texture2DComponent>(entity);
|
||||
|
||||
_spriteBatch.Draw(
|
||||
textureComponent.Texture,
|
||||
|
@ -129,7 +130,6 @@ Now we can rewrite our SpriteBatch draw call:
|
|||
using PongFE.Extensions;
|
||||
|
||||
...
|
||||
|
||||
_spriteBatch.Draw(
|
||||
textureComponent.Texture,
|
||||
positionComponent.Position.ToXNAVector(),
|
||||
|
|
|
@ -98,23 +98,19 @@ Remove Width and Height from Texture2DComponent, and add a ScaleComponent in bot
|
|||
Then, in **Texture2DRenderer.cs** we can do:
|
||||
|
||||
```cs
|
||||
public override void Render(Entity entity, in Texture2DComponent textureComponent)
|
||||
{
|
||||
ref readonly var positionComponent = ref GetComponent<PositionComponent>(entity);
|
||||
ref readonly var scaleComponent = ref GetComponent<ScaleComponent>(entity);
|
||||
ref readonly var scaleComponent = ref GetComponent<ScaleComponent>(entity);
|
||||
|
||||
_spriteBatch.Draw(
|
||||
textureComponent.Texture,
|
||||
positionComponent.Position.ToXNAVector(),
|
||||
null,
|
||||
Color.White,
|
||||
0,
|
||||
Vector2.Zero,
|
||||
new Vector2(scaleComponent.Width, scaleComponent.Height),
|
||||
SpriteEffects.None,
|
||||
0
|
||||
);
|
||||
}
|
||||
_spriteBatch.Draw(
|
||||
textureComponent.Texture,
|
||||
positionComponent.Position.ToXNAVector(),
|
||||
null,
|
||||
Color.White,
|
||||
0,
|
||||
Vector2.Zero,
|
||||
new Vector2(scaleComponent.Width, scaleComponent.Height),
|
||||
SpriteEffects.None,
|
||||
0
|
||||
);
|
||||
```
|
||||
|
||||
Now, in **PongFE/Engines/AngledBounceEngine.cs**:
|
||||
|
|
|
@ -185,7 +185,7 @@ namespace PongFE.Renderers
|
|||
InstructionFont = instructionFont;
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
ref readonly var gameStateComponent = ref ReadComponent<GameStateComponent>();
|
||||
ref readonly var playAreaComponent = ref ReadComponent<PlayAreaComponent>();
|
||||
|
@ -215,7 +215,7 @@ namespace PongFE.Renderers
|
|||
And let's tweak the *CenterLineRenderer.Render* method a bit.
|
||||
|
||||
```cs
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
ref readonly var gameStateComponent = ref ReadComponent<GameStateComponent>();
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace PongFE.Renderers
|
|||
SpriteBatch = spriteBatch;
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Nonpremultiplied);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace PongFE.Renderers
|
|||
WhitePixel = whitePixel;
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
ref readonly var playAreaComponent = ref ReadComponent<PlayAreaComponent>();
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ Go through the rest of **PongFEGame.cs** and replace the magic values 1280 and 7
|
|||
Let's revise our **ScoreRenderer** too.
|
||||
|
||||
```cs
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
int? playerOneScore = null;
|
||||
int? playerTwoScore = null;
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace PongFE.Renderers
|
|||
Font = font;
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
public override void Render(double dt, double alpha)
|
||||
{
|
||||
int? playerOneScore = null;
|
||||
int? playerTwoScore = null;
|
||||
|
|
Loading…
Reference in New Issue