Browse Source

TextureRef: make Get a property rather than a function

GitOrigin-RevId: a36369c33b
master
Colin McMillen 4 years ago
parent
commit
ed7afd2fa1
  1. 2
      Shared/Player.cs
  2. 4
      Shared/Scene.cs
  3. 4
      Shared/Textures.cs
  4. 2
      Shared/World.cs

2
Shared/Player.cs

@ -237,7 +237,7 @@ namespace SemiColinGames {
Vector2 spriteCenter = new Vector2(spriteWidth / 2, spriteHeight / 2 + spriteCenterYOffset);
SpriteEffects effect = Facing == 1 ?
SpriteEffects.FlipHorizontally : SpriteEffects.None;
spriteBatch.Draw(Textures.Player.Get(), position.ToVector2(), textureSource, Color.White, 0f,
spriteBatch.Draw(Textures.Player.Get, position.ToVector2(), textureSource, Color.White, 0f,
spriteCenter, Vector2.One, effect, 0f);
}
}

4
Shared/Scene.cs

@ -60,10 +60,10 @@ namespace SemiColinGames {
float xScale = 1f / 16;
for (int i = 0; i < Textures.Backgrounds.Length; i++) {
int yOffset = Textures.Backgrounds[i].Get().Height - camera.Height - 24;
int yOffset = Textures.Backgrounds[i].Get.Height - camera.Height - 24;
Rectangle bgSource = new Rectangle(
(int) (camera.Left * xScale), yOffset, camera.Width, camera.Height);
spriteBatch.Draw(Textures.Backgrounds[i].Get(), bgTarget, bgSource, Color.White);
spriteBatch.Draw(Textures.Backgrounds[i].Get, bgTarget, bgSource, Color.White);
xScale *= 2;
}
spriteBatch.End();

4
Shared/Textures.cs

@ -22,8 +22,8 @@ namespace SemiColinGames {
this.contentPath = contentPath;
}
public Texture2D Get() {
return texture;
public Texture2D Get {
get { return texture; }
}
private void Load(ContentManager content) {

2
Shared/World.cs

@ -75,7 +75,7 @@ namespace SemiColinGames {
public void Draw(SpriteBatch spriteBatch) {
spriteBatch.Draw(
Terrain.Texture.Get(), Position.Location.ToVector2(), Terrain.TextureSource, Color.White);
Terrain.Texture.Get, Position.Location.ToVector2(), Terrain.TextureSource, Color.White);
}
}

Loading…
Cancel
Save