TextureRef: make Get a property rather than a function

GitOrigin-RevId: a36369c33b0c23859768c7bd7b1548b7d834cbb3
This commit is contained in:
Colin McMillen 2020-02-20 16:39:12 -05:00
parent e72b8999e4
commit ed7afd2fa1
4 changed files with 6 additions and 6 deletions

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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) {

View File

@ -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);
}
}