|
|
@ -25,6 +25,7 @@ namespace Jumpy { |
|
|
|
|
|
|
|
FpsCounter fpsCounter = new FpsCounter(); |
|
|
|
Player player; |
|
|
|
Texture2D grassland; |
|
|
|
|
|
|
|
public JumpyGame() { |
|
|
|
graphics = new GraphicsDeviceManager(this); |
|
|
@ -52,6 +53,7 @@ namespace Jumpy { |
|
|
|
spriteBatch = new SpriteBatch(GraphicsDevice); |
|
|
|
font = Content.Load<SpriteFont>("font"); |
|
|
|
player = new Player(Content.Load<Texture2D>("player_1x")); |
|
|
|
grassland = Content.Load<Texture2D>("grassland"); |
|
|
|
} |
|
|
|
|
|
|
|
// Called once per game. Unloads all game content.
|
|
|
@ -91,7 +93,19 @@ namespace Jumpy { |
|
|
|
GraphicsDevice.SetRenderTarget(renderTarget); |
|
|
|
GraphicsDevice.Clear(Color.CornflowerBlue); |
|
|
|
spriteBatch.Begin(); |
|
|
|
|
|
|
|
// Draw player.
|
|
|
|
player.Draw(gameTime, spriteBatch); |
|
|
|
|
|
|
|
// Draw foreground tiles.
|
|
|
|
int size = 16; |
|
|
|
Rectangle textureSource = new Rectangle(3 * size, 0 * size, size, size); |
|
|
|
for (int i = 0; i < Camera.Width / size; i++) { |
|
|
|
Vector2 drawPos = new Vector2(i * size, Camera.Height - size); |
|
|
|
spriteBatch.Draw(grassland, drawPos, textureSource, Color.White); |
|
|
|
} |
|
|
|
|
|
|
|
// Aaaaand we're done.
|
|
|
|
spriteBatch.End(); |
|
|
|
|
|
|
|
// Draw RenderTarget to screen.
|
|
|
|