Added back the map, movement and zooming. Also changed all Textures to 32bit
@@ -12,6 +12,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" />
|
||||
<PackageReference Include="MonoGame.Extended" Version="3.7.0" />
|
||||
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.8.0.13" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -73,6 +73,390 @@
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man.png
|
||||
|
||||
#begin man/man-0.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-0.png
|
||||
|
||||
#begin man/man-1.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-1.png
|
||||
|
||||
#begin man/man-10.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-10.png
|
||||
|
||||
#begin man/man-11.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-11.png
|
||||
|
||||
#begin man/man-12.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-12.png
|
||||
|
||||
#begin man/man-13.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-13.png
|
||||
|
||||
#begin man/man-14.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-14.png
|
||||
|
||||
#begin man/man-15.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-15.png
|
||||
|
||||
#begin man/man-16.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-16.png
|
||||
|
||||
#begin man/man-17.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-17.png
|
||||
|
||||
#begin man/man-18.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-18.png
|
||||
|
||||
#begin man/man-19.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-19.png
|
||||
|
||||
#begin man/man-2.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-2.png
|
||||
|
||||
#begin man/man-20.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-20.png
|
||||
|
||||
#begin man/man-21.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-21.png
|
||||
|
||||
#begin man/man-22.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-22.png
|
||||
|
||||
#begin man/man-23.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-23.png
|
||||
|
||||
#begin man/man-24.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-24.png
|
||||
|
||||
#begin man/man-25.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-25.png
|
||||
|
||||
#begin man/man-26.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-26.png
|
||||
|
||||
#begin man/man-27.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-27.png
|
||||
|
||||
#begin man/man-28.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-28.png
|
||||
|
||||
#begin man/man-29.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-29.png
|
||||
|
||||
#begin man/man-3.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-3.png
|
||||
|
||||
#begin man/man-30.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-30.png
|
||||
|
||||
#begin man/man-31.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-31.png
|
||||
|
||||
#begin man/man-4.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-4.png
|
||||
|
||||
#begin man/man-5.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-5.png
|
||||
|
||||
#begin man/man-6.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-6.png
|
||||
|
||||
#begin man/man-7.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-7.png
|
||||
|
||||
#begin man/man-8.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-8.png
|
||||
|
||||
#begin man/man-9.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
/processorParam:ColorKeyEnabled=True
|
||||
/processorParam:GenerateMipmaps=False
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:man/man-9.png
|
||||
|
||||
#begin roof.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
Collector/Content/man/man-0.png
Normal file
|
After Width: | Height: | Size: 248 B |
BIN
Collector/Content/man/man-1.png
Normal file
|
After Width: | Height: | Size: 262 B |
BIN
Collector/Content/man/man-10.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Collector/Content/man/man-11.png
Normal file
|
After Width: | Height: | Size: 285 B |
BIN
Collector/Content/man/man-12.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Collector/Content/man/man-13.png
Normal file
|
After Width: | Height: | Size: 281 B |
BIN
Collector/Content/man/man-14.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Collector/Content/man/man-15.png
Normal file
|
After Width: | Height: | Size: 280 B |
BIN
Collector/Content/man/man-16.png
Normal file
|
After Width: | Height: | Size: 248 B |
BIN
Collector/Content/man/man-17.png
Normal file
|
After Width: | Height: | Size: 259 B |
BIN
Collector/Content/man/man-18.png
Normal file
|
After Width: | Height: | Size: 248 B |
BIN
Collector/Content/man/man-19.png
Normal file
|
After Width: | Height: | Size: 263 B |
BIN
Collector/Content/man/man-2.png
Normal file
|
After Width: | Height: | Size: 248 B |
BIN
Collector/Content/man/man-20.png
Normal file
|
After Width: | Height: | Size: 246 B |
BIN
Collector/Content/man/man-21.png
Normal file
|
After Width: | Height: | Size: 262 B |
BIN
Collector/Content/man/man-22.png
Normal file
|
After Width: | Height: | Size: 246 B |
BIN
Collector/Content/man/man-23.png
Normal file
|
After Width: | Height: | Size: 260 B |
BIN
Collector/Content/man/man-24.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Collector/Content/man/man-25.png
Normal file
|
After Width: | Height: | Size: 279 B |
BIN
Collector/Content/man/man-26.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Collector/Content/man/man-27.png
Normal file
|
After Width: | Height: | Size: 285 B |
BIN
Collector/Content/man/man-28.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Collector/Content/man/man-29.png
Normal file
|
After Width: | Height: | Size: 281 B |
BIN
Collector/Content/man/man-3.png
Normal file
|
After Width: | Height: | Size: 263 B |
BIN
Collector/Content/man/man-30.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Collector/Content/man/man-31.png
Normal file
|
After Width: | Height: | Size: 280 B |
BIN
Collector/Content/man/man-4.png
Normal file
|
After Width: | Height: | Size: 267 B |
BIN
Collector/Content/man/man-5.png
Normal file
|
After Width: | Height: | Size: 281 B |
BIN
Collector/Content/man/man-6.png
Normal file
|
After Width: | Height: | Size: 267 B |
BIN
Collector/Content/man/man-7.png
Normal file
|
After Width: | Height: | Size: 283 B |
BIN
Collector/Content/man/man-8.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Collector/Content/man/man-9.png
Normal file
|
After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Collector
|
||||
public const int MovementSpeed = 16;
|
||||
public const int FreeSpeed = 2;
|
||||
public const int KeyDelay = 0;
|
||||
public const int TileSize = 16;
|
||||
public const int TileSize = 32;
|
||||
public const int ChunkSize = 8;
|
||||
public const int SuperChunkSize = 1;
|
||||
public const int TileShift = 5;
|
||||
|
||||
@@ -1,59 +1,91 @@
|
||||
using System.Collections.Generic;
|
||||
using Collector;
|
||||
using Collector.Character;
|
||||
using Collector.Dimension;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using MonoGame.Extended;
|
||||
using Mouse = Collector.Character.Mouse;
|
||||
|
||||
public class InputController : IRestrictions {
|
||||
|
||||
private Player player;
|
||||
private Mouse mouse;
|
||||
//private Dictionary<string, Animation<TextureAtlas.AtlasRegion>> animations;
|
||||
int i = 0;
|
||||
private Player _player;
|
||||
private Mouse _mouse;
|
||||
private OrthographicCamera _cam;
|
||||
private Dictionary<string, Rectangle> animations;
|
||||
public string Input { get; set; }
|
||||
private SpriteBatch _spriteBatch;
|
||||
private ContentManager _content;
|
||||
|
||||
public InputController(Player player, Mouse mouse)
|
||||
public InputController(Player player, Mouse mouse, OrthographicCamera cam, SpriteBatch spriteBatch, ContentManager contentManager)
|
||||
{
|
||||
this.player = player;
|
||||
this.mouse = mouse;
|
||||
_player = player;
|
||||
_mouse = mouse;
|
||||
_cam = cam;
|
||||
_spriteBatch = spriteBatch;
|
||||
_content = contentManager;
|
||||
Input = "Down";
|
||||
|
||||
animations = new Dictionary<string, Rectangle>
|
||||
{
|
||||
["Up"] = new Rectangle(0, 0, 32, 32),
|
||||
["Right"] = new Rectangle(0, 0, 32, 32),
|
||||
["Left"] = new Rectangle(0, 0, 32, 32),
|
||||
["Right"] = new Rectangle(0, 0, 32, 32)
|
||||
};
|
||||
}
|
||||
|
||||
public InputController() {
|
||||
|
||||
/*
|
||||
animations = new HashMap<>();
|
||||
animations.put("Up", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Up")));
|
||||
animations.put("UpRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpRight")));
|
||||
animations.put("UpLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpLeft")));
|
||||
animations.put("Down", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Down")));
|
||||
animations.put("DownRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownRight")));
|
||||
animations.put("DownLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownLeft")));
|
||||
animations.put("Left", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Left")));
|
||||
animations.put("Right", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Right")));
|
||||
*/
|
||||
}
|
||||
|
||||
private void PlayerInput()
|
||||
public void PlayerInput(Main main, SpriteBatch spriteBatch)
|
||||
{
|
||||
if (Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||
var keyboardState = Keyboard.GetState();
|
||||
const int movementSpeed = IRestrictions.MovementSpeed;
|
||||
if (keyboardState.IsKeyDown(Keys.Escape))
|
||||
{
|
||||
Exit();
|
||||
Quit(main);
|
||||
}
|
||||
else if(Keyboard.GetState().IsKeyDown(Keys.W))
|
||||
if (keyboardState.IsKeyDown(Keys.W))
|
||||
{
|
||||
|
||||
Input = "Up";
|
||||
Player.Y += -movementSpeed;
|
||||
_cam.Move(new Vector2(0,-movementSpeed));
|
||||
}
|
||||
else if(Keyboard.GetState().IsKeyDown(Keys.A))
|
||||
if (keyboardState.IsKeyDown(Keys.A))
|
||||
{
|
||||
|
||||
Player.X += -movementSpeed;
|
||||
_cam.Move(new Vector2(-movementSpeed,0));
|
||||
Input = "Left";
|
||||
}
|
||||
else if(Keyboard.GetState().IsKeyDown(Keys.S))
|
||||
if (keyboardState.IsKeyDown(Keys.S))
|
||||
{
|
||||
|
||||
Player.Y += movementSpeed;
|
||||
_cam.Move(new Vector2(0,movementSpeed));
|
||||
Input = "Down";
|
||||
}
|
||||
else if(Keyboard.GetState().IsKeyDown(Keys.D))
|
||||
|
||||
if (keyboardState.IsKeyDown(Keys.D))
|
||||
{
|
||||
|
||||
Player.X += movementSpeed;
|
||||
_cam.Move(new Vector2(movementSpeed, 0));
|
||||
Input = "Right";
|
||||
}
|
||||
|
||||
if (keyboardState.IsKeyDown(Keys.Q))
|
||||
{
|
||||
_cam.ZoomIn(0.05f);
|
||||
}
|
||||
|
||||
if (keyboardState.IsKeyDown(Keys.E))
|
||||
{
|
||||
_cam.ZoomOut(0.05f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void Quit(Game main)
|
||||
{
|
||||
main.Exit();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -138,5 +170,10 @@ public void handleInput() {
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
var texture = _content.Load<Texture2D>("man/man-0");
|
||||
_spriteBatch.Draw(texture,new Vector2(Player.X,Player.Y),Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,33 @@
|
||||
package Collector.Character;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
import Collector.Restrictions;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
namespace Collector.Character
|
||||
{
|
||||
public class Mouse : IRestrictions {
|
||||
private SpriteBatch _spriteBatch;
|
||||
private ContentManager _contentManager;
|
||||
private Texture2D Crosshair { get; set; }
|
||||
|
||||
public class Mouse implements Restrictions {
|
||||
Texture crosshair;
|
||||
public Mouse(ContentManager contentManager, SpriteBatch spriteBatch)
|
||||
{
|
||||
_spriteBatch = spriteBatch;
|
||||
_contentManager = contentManager;
|
||||
Crosshair = _contentManager.Load<Texture2D>("crosshair");
|
||||
}
|
||||
|
||||
public Mouse() {
|
||||
this.crosshair = new Texture("assets/crosshair.png");
|
||||
}
|
||||
public void Draw()
|
||||
{
|
||||
_spriteBatch.Draw(Crosshair, new Vector2(Player.X, Player.Y),Color.Aqua);
|
||||
}
|
||||
|
||||
public Texture getCrosshair() {
|
||||
return crosshair;
|
||||
}
|
||||
|
||||
public int GetSelectedX(Vector3 mousePos) {
|
||||
return ((int)(mousePos.X)>>4)<<4;
|
||||
}
|
||||
|
||||
public int getSelectedX(Vector3 mousePos) {
|
||||
return ((int)(mousePos.x)>>4)<<4;
|
||||
}
|
||||
|
||||
public int getSelectedY(Vector3 mousePos) {
|
||||
return ((int)(mousePos.y)>>4)<<4;
|
||||
public int GetSelectedY(Vector3 mousePos) {
|
||||
return ((int)(mousePos.Y)>>4)<<4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +1,19 @@
|
||||
using Collector;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
public class Player : IRestrictions {
|
||||
private static int X;
|
||||
private static int Y;
|
||||
private string SpriteName;
|
||||
private Inventory playerInventory;
|
||||
namespace Collector.Character
|
||||
{
|
||||
public class Player : IRestrictions
|
||||
{
|
||||
public static int X { get; set; }
|
||||
public static int Y { get; set; }
|
||||
public Dictionary<string,Rectangle> Animation { get; set; }
|
||||
//private Inventory PlayerInventory { get; }
|
||||
|
||||
public Player(int x, int y) {
|
||||
//Player location
|
||||
X = x<<IRestrictions.TileShift;
|
||||
Y = y<<IRestrictions.TileShift;
|
||||
|
||||
//Player Inventory
|
||||
playerInventory = new Inventory();
|
||||
|
||||
//Player animation
|
||||
//spriteName = "man";
|
||||
//textureAtlas = new TextureAtlas("man.atlas");
|
||||
//Array<TextureAtlas.AtlasRegion> keyFrames = textureAtlas.findRegions(spriteName + "_Down");
|
||||
//float frameDuration = 1 / 4f;
|
||||
//animation = new Animation<>(frameDuration, keyFrames);
|
||||
public Player(int x, int y) {
|
||||
X = x<<IRestrictions.TileShift;
|
||||
Y = y<<IRestrictions.TileShift;
|
||||
//PlayerInventory = new Inventory();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getX() {
|
||||
return X;
|
||||
}
|
||||
|
||||
public static int getY() {
|
||||
return Y;
|
||||
}
|
||||
|
||||
public static void addX(int x){
|
||||
X += x;
|
||||
}
|
||||
|
||||
public static void addY(int y){
|
||||
Y += y;
|
||||
}
|
||||
|
||||
/*
|
||||
public String getSpriteName() {
|
||||
return spriteName;
|
||||
}
|
||||
|
||||
public Animation<TextureAtlas.AtlasRegion> getAnimation() {
|
||||
return animation;
|
||||
}
|
||||
|
||||
public void setAnimation(Animation<TextureAtlas.AtlasRegion> animationTemp) {
|
||||
animation = animationTemp;
|
||||
}
|
||||
|
||||
public void dispose(){
|
||||
//textureAtlas.dispose();
|
||||
}
|
||||
|
||||
public TextureAtlas getTextureAtlas() {
|
||||
return textureAtlas;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
|
||||
public class Block {
|
||||
private string name = null;
|
||||
public string Name { get; }
|
||||
|
||||
public Block(string name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public string getName() {
|
||||
return name;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Collector.Dimension
|
||||
//Private so the singleton can't be instantiated
|
||||
internal BlockMaterials() {}
|
||||
|
||||
public static void LoadContent(ContentManager content){
|
||||
public static void Initialize(ContentManager content){
|
||||
Materials.Add("grass",new Block("grass"));
|
||||
Materials.Add("wood",new Block("wood"));
|
||||
Materials.Add("water",new Block("water"));
|
||||
@@ -27,11 +27,11 @@ namespace Collector.Dimension
|
||||
{
|
||||
Textures.Add(name,content.Load<Texture2D>(name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void Draw(string name,SpriteBatch _spriteBatch,int x, int y)
|
||||
{
|
||||
_spriteBatch.Draw(Textures[name],new Vector2(x, y),Color.Aqua);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,36 +7,38 @@ using Collector.ThirdPartyCode;
|
||||
namespace Collector.Dimension
|
||||
{
|
||||
public class Chunks: IRestrictions {
|
||||
public static Dictionary<Tuple<int, int, int>, Block> LoadedChunks = new Dictionary<Tuple<int, int, int>, Block>();
|
||||
public static Dictionary<Tuple<int, int, int>, Block> SavedChunks = new Dictionary<Tuple<int, int, int>, Block>();
|
||||
public static OpenSimplexNoise Gen1 = new OpenSimplexNoise(IRestrictions.Seed+ 1);
|
||||
public static OpenSimplexNoise Gen2 = new OpenSimplexNoise(IRestrictions.Seed);
|
||||
public static Dictionary<Tuple<int, int, int>, Block> LoadedChunks { get; } =
|
||||
new Dictionary<Tuple<int, int, int>, Block>();
|
||||
|
||||
private static readonly Dictionary<Tuple<int, int, int>, Block> SavedChunks = new Dictionary<Tuple<int, int, int>, Block>();
|
||||
private static readonly OpenSimplexNoise _gen1 = new OpenSimplexNoise(IRestrictions.Seed+ 1);
|
||||
private static readonly OpenSimplexNoise _gen2 = new OpenSimplexNoise(IRestrictions.Seed);
|
||||
|
||||
public static void CreateStructures() {
|
||||
var i = 10;
|
||||
const int i = 10;
|
||||
SetBlock(3 + i, 2,1,"wall");
|
||||
SetBlock(4 + i, 2,1,"wall");
|
||||
SetBlock(3 + i, 3,1, "roof");
|
||||
SetBlock(4 + i, 3,1,"roof");
|
||||
}
|
||||
|
||||
public static void SetBlock(int x, int y,int z, String name) {
|
||||
public static void SetBlock(int x, int y,int z, string name) {
|
||||
LoadedChunks.Add(new Tuple<int,int,int>(x, y, z), BlockMaterials.Materials[name]);
|
||||
SavedChunks.Add(new Tuple<int,int,int>(x, y, z), BlockMaterials.Materials[name]);
|
||||
}
|
||||
|
||||
public static void PlaceBlock(int x, int y, String name){
|
||||
public static void PlaceBlock(int x, int y, string name){
|
||||
var triple = new Tuple<int, int, int>(x, y, 1);
|
||||
if (!Chunks.LoadedChunks[triple].getName().Equals("air")) return;
|
||||
Chunks.LoadedChunks[triple] = BlockMaterials.Materials[name];
|
||||
Chunks.SavedChunks[triple] = BlockMaterials.Materials[name];
|
||||
if (!LoadedChunks[triple].Name.Equals("air")) return;
|
||||
LoadedChunks[triple] = BlockMaterials.Materials[name];
|
||||
SavedChunks[triple] = BlockMaterials.Materials[name];
|
||||
}
|
||||
|
||||
public static void RemoveBlock(int x, int y){
|
||||
var triple = new Tuple<int, int, int>(x, y, 1);
|
||||
if (Chunks.LoadedChunks[triple].getName().Equals("air")) return;
|
||||
Chunks.LoadedChunks[triple] = BlockMaterials.Materials["air"];
|
||||
Chunks.SavedChunks[triple] = BlockMaterials.Materials["air"];
|
||||
if (LoadedChunks[triple].Name.Equals("air")) return;
|
||||
LoadedChunks[triple] = BlockMaterials.Materials["air"];
|
||||
SavedChunks[triple] = BlockMaterials.Materials["air"];
|
||||
}
|
||||
|
||||
public static void UngenerateChunk(int x, int y) {
|
||||
@@ -70,7 +72,7 @@ namespace Collector.Dimension
|
||||
for (var i = startX; i != endX; i++) {
|
||||
for (var j = startY; j != endY; j++) {
|
||||
var triple = new Tuple<int, int, int>(i, j, 0);
|
||||
if(SavedChunks[triple] != null){
|
||||
if(SavedChunks.ContainsKey(triple)){
|
||||
LoadedChunks.Add(triple,SavedChunks[triple]);
|
||||
}
|
||||
else {
|
||||
@@ -84,8 +86,8 @@ namespace Collector.Dimension
|
||||
for (var i = startX; i != endX; i++){
|
||||
for (var j = startY; j != endY; j++) {
|
||||
var triple = new Tuple<int, int, int>(i, j,1);
|
||||
LoadedChunks.Add(triple, GetBlocks(i,j,1));
|
||||
SavedChunks.Add(triple, GetBlocks(i,j,1));
|
||||
LoadedChunks[triple] = GetBlocks(i,j,1);
|
||||
SavedChunks[triple] = GetBlocks(i,j,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,11 +97,11 @@ namespace Collector.Dimension
|
||||
}
|
||||
|
||||
private static double Noise1(double nx, double ny) {
|
||||
return Gen1.Evaluate(nx, ny) / 2 + 0.5;
|
||||
return _gen1.Evaluate(nx, ny) / 2 + 0.5;
|
||||
}
|
||||
|
||||
private static double Noise2(double nx, double ny) {
|
||||
return Gen2.Evaluate(nx, ny) / 2 + 0.5;
|
||||
return _gen2.Evaluate(nx, ny) / 2 + 0.5;
|
||||
}
|
||||
|
||||
private static Block GetTerrain(int x, int y) {
|
||||
@@ -174,7 +176,7 @@ namespace Collector.Dimension
|
||||
}
|
||||
|
||||
public static bool IsEmpty(int x, int y){
|
||||
return LoadedChunks[new Tuple<int,int,int>(x * 8, y * 8,0)] == null;
|
||||
return !LoadedChunks.ContainsKey(new Tuple<int,int,int>(x * 8, y * 8,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +1,56 @@
|
||||
using Collector;
|
||||
using Collector.Dimension;
|
||||
using System;
|
||||
using Collector.Character;
|
||||
|
||||
public class World {
|
||||
public static void generateWorld(int x, int y) {
|
||||
if (Chunks.IsEmpty(x, y)) {
|
||||
Chunks.GenerateChunk(x, y);
|
||||
namespace Collector.Dimension
|
||||
{
|
||||
public static class World {
|
||||
private static void GenerateWorld(int x, int y) {
|
||||
if (Chunks.IsEmpty(x, y)) {
|
||||
Chunks.GenerateChunk(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ungenerateWorld(int x, int y) {
|
||||
if (!Chunks.IsEmpty(x, y)) {
|
||||
Chunks.UngenerateChunk(x, y);
|
||||
private static void UngenerateWorld(int x, int y) {
|
||||
if (!Chunks.IsEmpty(x, y)) {
|
||||
Chunks.UngenerateChunk(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadChunks() {
|
||||
for (var i = -(IRestrictions.RenderDistance); i < IRestrictions.RenderDistance; i++) {
|
||||
for (var j = -(IRestrictions.RenderDistance); j < IRestrictions.RenderDistance; j++) {
|
||||
generateWorld(
|
||||
i + Player.getX() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize),
|
||||
j + Player.getY() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)
|
||||
public static void LoadChunks()
|
||||
{
|
||||
for (var i = -(IRestrictions.RenderDistance); i < IRestrictions.RenderDistance; i++) {
|
||||
for (var j = -(IRestrictions.RenderDistance); j < IRestrictions.RenderDistance; j++) {
|
||||
GenerateWorld(
|
||||
i + Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize),
|
||||
j + Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnloadChunks() {
|
||||
for (var i = -IRestrictions.RenderDistance; i < IRestrictions.RenderDistance+1; i++) {
|
||||
//Down
|
||||
UngenerateWorld(
|
||||
Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i,
|
||||
(Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+3
|
||||
);
|
||||
//Up
|
||||
UngenerateWorld(
|
||||
Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i-1,
|
||||
(Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))-4
|
||||
);
|
||||
//Right
|
||||
UngenerateWorld(
|
||||
Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)-4,
|
||||
(Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i
|
||||
);
|
||||
//Left
|
||||
UngenerateWorld(
|
||||
Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+3,
|
||||
(Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void unloadChunks() {
|
||||
for (var i = -IRestrictions.RenderDistance; i < IRestrictions.RenderDistance+1; i++) {
|
||||
//Down
|
||||
ungenerateWorld(
|
||||
Player.getX() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i,
|
||||
(Player.getY() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+3
|
||||
);
|
||||
//Up
|
||||
ungenerateWorld(
|
||||
Player.getX() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i-1,
|
||||
(Player.getY() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))-4
|
||||
);
|
||||
//Right
|
||||
ungenerateWorld(
|
||||
Player.getX() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)-4,
|
||||
(Player.getY() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i
|
||||
);
|
||||
//Left
|
||||
ungenerateWorld(
|
||||
Player.getX() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+3,
|
||||
(Player.getY() / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +1,66 @@
|
||||
using System.Linq;
|
||||
using Collector.Character;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using MonoGame.Extended;
|
||||
|
||||
namespace Collector.Dimension
|
||||
{
|
||||
public class WorldRenderer : IRestrictions {
|
||||
//private Mouse mouse;
|
||||
//private InputController inputController;
|
||||
//private Player _player;
|
||||
public class WorldRenderer : IRestrictions
|
||||
{
|
||||
private Mouse _mouse;
|
||||
private InputController _inputController;
|
||||
private Player _player;
|
||||
private SpriteBatch _spriteBatch;
|
||||
private Main _main;
|
||||
private OrthographicCamera _orthographicCamera;
|
||||
|
||||
/*
|
||||
public WorldRenderer(InputController inputController, Mouse mouse, Player player) {
|
||||
this.inputController = inputController;
|
||||
this.mouse = mouse;
|
||||
this.player = player;
|
||||
}
|
||||
*/
|
||||
public void DrawWorld(SpriteBatch batch, int layer)
|
||||
public WorldRenderer(Mouse mouse, InputController inputController, Player player, SpriteBatch spriteBatch, Main main, OrthographicCamera orthographicCamera)
|
||||
{
|
||||
/*
|
||||
foreach (var chunkpair in Chunks.LoadedChunks.Keys.Where(chunkpair => chunkpair.Item3 == layer))
|
||||
_mouse = mouse;
|
||||
_inputController = inputController;
|
||||
_player = player;
|
||||
_spriteBatch = spriteBatch;
|
||||
_main = main;
|
||||
_orthographicCamera = orthographicCamera;
|
||||
}
|
||||
|
||||
private static void DrawWorld(SpriteBatch batch, int layer)
|
||||
{
|
||||
batch.draw(
|
||||
//BlockMaterials.Textures[Chunks.LoadedChunks[chunkpair].getName()],
|
||||
chunkpair.Item1 << IRestrictions.TileShift,
|
||||
chunkpair.Item2 << IRestrictions.TileShift
|
||||
);
|
||||
foreach (var chunkpair in Chunks.LoadedChunks.Keys.Where(chunkpair => chunkpair.Item3 == layer))
|
||||
{
|
||||
batch.Draw(
|
||||
BlockMaterials.Textures[Chunks.LoadedChunks[chunkpair].Name],
|
||||
new Rectangle(
|
||||
chunkpair.Item1 << IRestrictions.TileShift,
|
||||
chunkpair.Item2 << IRestrictions.TileShift,
|
||||
IRestrictions.TileSize, IRestrictions.TileSize
|
||||
),
|
||||
Color.White
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private void mouseCrosshair(SpriteBatch batch)
|
||||
{
|
||||
Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
|
||||
Main.cam.unproject(mousePos);
|
||||
int x = mouse.getSelectedX(mousePos);
|
||||
int y = mouse.getSelectedY(mousePos);
|
||||
batch.draw(mouse.getCrosshair(), x, y);
|
||||
}
|
||||
*/
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
//Higher means draws in a lower layer
|
||||
DrawWorld(_spriteBatch, 0);
|
||||
_inputController.Draw();
|
||||
DrawWorld(_spriteBatch, 1);
|
||||
//mouseCrosshair(batch);
|
||||
_inputController.PlayerInput(_main,_spriteBatch);
|
||||
}
|
||||
|
||||
/*
|
||||
private void mouseCrosshair(SpriteBatch batch) {
|
||||
Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
|
||||
Main.cam.unproject(mousePos);
|
||||
int x = mouse.getSelectedX(mousePos);
|
||||
int y = mouse.getSelectedY(mousePos);
|
||||
batch.draw(mouse.getCrosshair(), x, y);
|
||||
}
|
||||
|
||||
public void render(SpriteBatch batch, float timeSinceLastUpdate) {
|
||||
//Higher means draws in a lower layer
|
||||
drawWorld(batch,0);
|
||||
batch.draw(player.getAnimation().getKeyFrame(timeSinceLastUpdate, true), Player.x, Player.y,TILE_SIZE,TILE_SIZE);
|
||||
drawWorld(batch,1);
|
||||
mouseCrosshair(batch);
|
||||
inputController.handleInput();
|
||||
batch.setProjectionMatrix(Main.cam.combined);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||