Wang
This commit is contained in:
@@ -27,7 +27,8 @@ namespace Collector
|
||||
private Gui _gui;
|
||||
private World _world;
|
||||
private WorldRenderer WorldRenderer { get; set; }
|
||||
public static Dictionary<Blocks, Texture2D> Materials { get; } = new Dictionary<Blocks, Texture2D>();
|
||||
public static Dictionary<string, Texture2D> Materials { get; } = new Dictionary<string, Texture2D>();
|
||||
public static readonly List<Blocks> Wang = new List<Blocks>();
|
||||
|
||||
|
||||
public Main()
|
||||
@@ -44,13 +45,13 @@ namespace Collector
|
||||
protected override void Initialize()
|
||||
{
|
||||
_gui = new Gui(_desktop);
|
||||
// Wang.Add(Blocks.BlockGrass);
|
||||
// Wang.Add(Blocks.BlockSnow);
|
||||
// Wang.Add(Blocks.BlockSand);
|
||||
|
||||
base.Initialize();
|
||||
|
||||
foreach (Blocks name in Enum.GetValues(typeof(Blocks)))
|
||||
{
|
||||
Materials.Add(name, Content.Load<Texture2D>(name.ToString()));
|
||||
}
|
||||
InitializeMaterials();
|
||||
|
||||
_virtualWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
|
||||
_virtualHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
|
||||
@@ -64,15 +65,25 @@ namespace Collector
|
||||
|
||||
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
_playerMouse = new PlayerMouse(Content, _spriteBatch, _cam);
|
||||
_inputController = new InputController(_cam, _spriteBatch, Content, this,_world,Player1,_playerMouse);
|
||||
WorldRenderer = new WorldRenderer(_playerMouse, _inputController, _spriteBatch, this,_world);
|
||||
_inputController = new InputController(_cam, _spriteBatch, Content, this, _world, Player1);
|
||||
WorldRenderer = new WorldRenderer(_playerMouse, _inputController, _spriteBatch, _world);
|
||||
}
|
||||
|
||||
private void InitializeMaterials()
|
||||
{
|
||||
foreach (Blocks name in Enum.GetValues(typeof(Blocks)))
|
||||
{
|
||||
Materials.Add(name.ToString(),
|
||||
Wang.Contains(name)
|
||||
? Content.Load<Texture2D>("Wang/" + name)
|
||||
: Content.Load<Texture2D>(name.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadContent()
|
||||
{
|
||||
base.LoadContent();
|
||||
MyraEnvironment.Game = this;
|
||||
|
||||
_gui.LoadGui();
|
||||
}
|
||||
|
||||
@@ -95,6 +106,7 @@ namespace Collector
|
||||
var transformMatrix = _cam.GetViewMatrix();
|
||||
base.Draw(gameTime);
|
||||
GraphicsDevice.Clear(Color.CornflowerBlue);
|
||||
|
||||
//Turn on Anti-aliasing by changing SamplerState.PointClamp
|
||||
_spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp,
|
||||
DepthStencilState.None, RasterizerState.CullNone, transformMatrix: transformMatrix);
|
||||
|
||||
Reference in New Issue
Block a user