Added back the map, movement and zooming. Also changed all Textures to 32bit

This commit is contained in:
2020-04-21 13:39:42 -06:00
parent 2892570539
commit 85af72cfa1
56 changed files with 659 additions and 241 deletions

View File

@@ -1,7 +1,11 @@
using Collector.Dimension;
using Collector.Character;
using Collector.Dimension;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonoGame.Extended;
using MonoGame.Extended.ViewportAdapters;
using Mouse = Collector.Character.Mouse;
namespace Collector
{
@@ -10,9 +14,13 @@ namespace Collector
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
private InputController _inputController;
private Player _player;
private Mouse _mouse;
private OrthographicCamera _cam;
private WorldRenderer WorldRenderer { get; set; }
public Main()
{
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
@@ -20,33 +28,38 @@ namespace Collector
protected override void Initialize()
{// TODO: Add your initialization logic here
base.Initialize();
BlockMaterials.Initialize(Content);
var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480);
_player = new Player(0,0);
_cam = new OrthographicCamera(viewportAdapter);
_cam.LookAt(new Vector2(Player.X,Player.Y));
_spriteBatch = new SpriteBatch(GraphicsDevice);
_mouse = new Mouse(Content,_spriteBatch);
_inputController = new InputController(_player,_mouse,_cam,_spriteBatch,Content);
WorldRenderer = new WorldRenderer(_mouse,_inputController,_player,_spriteBatch,this,_cam);
}
protected override void LoadContent()
{// TODO: use this.Content to load your game content here
_spriteBatch = new SpriteBatch(GraphicsDevice);
BlockMaterials.LoadContent(Content);
}
protected override void Update(GameTime gameTime)
{// TODO: Add your update logic here/*
_inputController.PlayerInput();
base.Update(gameTime);
_inputController.PlayerInput(this,_spriteBatch);
World.LoadChunks();
World.UnloadChunks();
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
{// TODO: Add your drawing code here
var transformMatrix = _cam.GetViewMatrix();
base.Draw(gameTime);
_spriteBatch.Begin();
BlockMaterials.Draw("grass",_spriteBatch,0,0);
GraphicsDevice.Clear(Color.CornflowerBlue);
_spriteBatch.Begin(transformMatrix: transformMatrix);
_mouse.Draw();
WorldRenderer.Draw();
_spriteBatch.End();
}
}