diff --git a/Collector.sln.DotSettings.user b/Collector.sln.DotSettings.user index 5af94cd..7b5f6af 100644 --- a/Collector.sln.DotSettings.user +++ b/Collector.sln.DotSettings.user @@ -1,4 +1,6 @@  True + True + True True True \ No newline at end of file diff --git a/Collector/Collector.csproj b/Collector/Collector.csproj index 49d6549..9520261 100644 --- a/Collector/Collector.csproj +++ b/Collector/Collector.csproj @@ -12,6 +12,7 @@ + diff --git a/Collector/Content/Content.mgcb b/Collector/Content/Content.mgcb index 62e11c6..f6fb229 100644 --- a/Collector/Content/Content.mgcb +++ b/Collector/Content/Content.mgcb @@ -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 diff --git a/Collector/Content/air.png b/Collector/Content/air.png index 22d5f8a..4cd04ce 100644 Binary files a/Collector/Content/air.png and b/Collector/Content/air.png differ diff --git a/Collector/Content/crosshair.png b/Collector/Content/crosshair.png index 5635c25..02a82cd 100644 Binary files a/Collector/Content/crosshair.png and b/Collector/Content/crosshair.png differ diff --git a/Collector/Content/grass.png b/Collector/Content/grass.png index a554e52..85e4972 100644 Binary files a/Collector/Content/grass.png and b/Collector/Content/grass.png differ diff --git a/Collector/Content/jungleGrass.png b/Collector/Content/jungleGrass.png index ecff7a2..fb2e1ae 100644 Binary files a/Collector/Content/jungleGrass.png and b/Collector/Content/jungleGrass.png differ diff --git a/Collector/Content/man/man-0.png b/Collector/Content/man/man-0.png new file mode 100644 index 0000000..3f2ee32 Binary files /dev/null and b/Collector/Content/man/man-0.png differ diff --git a/Collector/Content/man/man-1.png b/Collector/Content/man/man-1.png new file mode 100644 index 0000000..bd111f1 Binary files /dev/null and b/Collector/Content/man/man-1.png differ diff --git a/Collector/Content/man/man-10.png b/Collector/Content/man/man-10.png new file mode 100644 index 0000000..bcfe857 Binary files /dev/null and b/Collector/Content/man/man-10.png differ diff --git a/Collector/Content/man/man-11.png b/Collector/Content/man/man-11.png new file mode 100644 index 0000000..94c3b2f Binary files /dev/null and b/Collector/Content/man/man-11.png differ diff --git a/Collector/Content/man/man-12.png b/Collector/Content/man/man-12.png new file mode 100644 index 0000000..6dddff9 Binary files /dev/null and b/Collector/Content/man/man-12.png differ diff --git a/Collector/Content/man/man-13.png b/Collector/Content/man/man-13.png new file mode 100644 index 0000000..0c84de9 Binary files /dev/null and b/Collector/Content/man/man-13.png differ diff --git a/Collector/Content/man/man-14.png b/Collector/Content/man/man-14.png new file mode 100644 index 0000000..6dddff9 Binary files /dev/null and b/Collector/Content/man/man-14.png differ diff --git a/Collector/Content/man/man-15.png b/Collector/Content/man/man-15.png new file mode 100644 index 0000000..53243c6 Binary files /dev/null and b/Collector/Content/man/man-15.png differ diff --git a/Collector/Content/man/man-16.png b/Collector/Content/man/man-16.png new file mode 100644 index 0000000..e126b67 Binary files /dev/null and b/Collector/Content/man/man-16.png differ diff --git a/Collector/Content/man/man-17.png b/Collector/Content/man/man-17.png new file mode 100644 index 0000000..946c134 Binary files /dev/null and b/Collector/Content/man/man-17.png differ diff --git a/Collector/Content/man/man-18.png b/Collector/Content/man/man-18.png new file mode 100644 index 0000000..e126b67 Binary files /dev/null and b/Collector/Content/man/man-18.png differ diff --git a/Collector/Content/man/man-19.png b/Collector/Content/man/man-19.png new file mode 100644 index 0000000..86abe9b Binary files /dev/null and b/Collector/Content/man/man-19.png differ diff --git a/Collector/Content/man/man-2.png b/Collector/Content/man/man-2.png new file mode 100644 index 0000000..3f2ee32 Binary files /dev/null and b/Collector/Content/man/man-2.png differ diff --git a/Collector/Content/man/man-20.png b/Collector/Content/man/man-20.png new file mode 100644 index 0000000..18fe18e Binary files /dev/null and b/Collector/Content/man/man-20.png differ diff --git a/Collector/Content/man/man-21.png b/Collector/Content/man/man-21.png new file mode 100644 index 0000000..3149474 Binary files /dev/null and b/Collector/Content/man/man-21.png differ diff --git a/Collector/Content/man/man-22.png b/Collector/Content/man/man-22.png new file mode 100644 index 0000000..18fe18e Binary files /dev/null and b/Collector/Content/man/man-22.png differ diff --git a/Collector/Content/man/man-23.png b/Collector/Content/man/man-23.png new file mode 100644 index 0000000..2bc82ce Binary files /dev/null and b/Collector/Content/man/man-23.png differ diff --git a/Collector/Content/man/man-24.png b/Collector/Content/man/man-24.png new file mode 100644 index 0000000..bcfe857 Binary files /dev/null and b/Collector/Content/man/man-24.png differ diff --git a/Collector/Content/man/man-25.png b/Collector/Content/man/man-25.png new file mode 100644 index 0000000..a28e72f Binary files /dev/null and b/Collector/Content/man/man-25.png differ diff --git a/Collector/Content/man/man-26.png b/Collector/Content/man/man-26.png new file mode 100644 index 0000000..bcfe857 Binary files /dev/null and b/Collector/Content/man/man-26.png differ diff --git a/Collector/Content/man/man-27.png b/Collector/Content/man/man-27.png new file mode 100644 index 0000000..94c3b2f Binary files /dev/null and b/Collector/Content/man/man-27.png differ diff --git a/Collector/Content/man/man-28.png b/Collector/Content/man/man-28.png new file mode 100644 index 0000000..6dddff9 Binary files /dev/null and b/Collector/Content/man/man-28.png differ diff --git a/Collector/Content/man/man-29.png b/Collector/Content/man/man-29.png new file mode 100644 index 0000000..0c84de9 Binary files /dev/null and b/Collector/Content/man/man-29.png differ diff --git a/Collector/Content/man/man-3.png b/Collector/Content/man/man-3.png new file mode 100644 index 0000000..cded3cf Binary files /dev/null and b/Collector/Content/man/man-3.png differ diff --git a/Collector/Content/man/man-30.png b/Collector/Content/man/man-30.png new file mode 100644 index 0000000..6dddff9 Binary files /dev/null and b/Collector/Content/man/man-30.png differ diff --git a/Collector/Content/man/man-31.png b/Collector/Content/man/man-31.png new file mode 100644 index 0000000..53243c6 Binary files /dev/null and b/Collector/Content/man/man-31.png differ diff --git a/Collector/Content/man/man-4.png b/Collector/Content/man/man-4.png new file mode 100644 index 0000000..09a2a89 Binary files /dev/null and b/Collector/Content/man/man-4.png differ diff --git a/Collector/Content/man/man-5.png b/Collector/Content/man/man-5.png new file mode 100644 index 0000000..47e60f7 Binary files /dev/null and b/Collector/Content/man/man-5.png differ diff --git a/Collector/Content/man/man-6.png b/Collector/Content/man/man-6.png new file mode 100644 index 0000000..09a2a89 Binary files /dev/null and b/Collector/Content/man/man-6.png differ diff --git a/Collector/Content/man/man-7.png b/Collector/Content/man/man-7.png new file mode 100644 index 0000000..f68f4a8 Binary files /dev/null and b/Collector/Content/man/man-7.png differ diff --git a/Collector/Content/man/man-8.png b/Collector/Content/man/man-8.png new file mode 100644 index 0000000..bcfe857 Binary files /dev/null and b/Collector/Content/man/man-8.png differ diff --git a/Collector/Content/man/man-9.png b/Collector/Content/man/man-9.png new file mode 100644 index 0000000..a28e72f Binary files /dev/null and b/Collector/Content/man/man-9.png differ diff --git a/Collector/Content/roof.png b/Collector/Content/roof.png index 21534ab..debd59c 100644 Binary files a/Collector/Content/roof.png and b/Collector/Content/roof.png differ diff --git a/Collector/Content/sand.png b/Collector/Content/sand.png index 3d354ca..1295fe8 100644 Binary files a/Collector/Content/sand.png and b/Collector/Content/sand.png differ diff --git a/Collector/Content/snow.png b/Collector/Content/snow.png index 0100539..7f02c23 100644 Binary files a/Collector/Content/snow.png and b/Collector/Content/snow.png differ diff --git a/Collector/Content/stone.png b/Collector/Content/stone.png index 7e65b12..4c83b3f 100644 Binary files a/Collector/Content/stone.png and b/Collector/Content/stone.png differ diff --git a/Collector/Content/wall.png b/Collector/Content/wall.png index df0596d..b29aa1e 100644 Binary files a/Collector/Content/wall.png and b/Collector/Content/wall.png differ diff --git a/Collector/Content/water.png b/Collector/Content/water.png index 8a04451..a7221d7 100644 Binary files a/Collector/Content/water.png and b/Collector/Content/water.png differ diff --git a/Collector/Content/wood.png b/Collector/Content/wood.png index ec7e94c..f6ce37d 100644 Binary files a/Collector/Content/wood.png and b/Collector/Content/wood.png differ diff --git a/Collector/Main.cs b/Collector/Main.cs index 58938b2..39c1ec4 100644 --- a/Collector/Main.cs +++ b/Collector/Main.cs @@ -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(); } } diff --git a/Collector/Restrictions.cs b/Collector/Restrictions.cs index 5244c99..0e2d43e 100644 --- a/Collector/Restrictions.cs +++ b/Collector/Restrictions.cs @@ -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; diff --git a/Collector/src/Character/InputController.cs b/Collector/src/Character/InputController.cs index 1c45df1..118e7ef 100644 --- a/Collector/src/Character/InputController.cs +++ b/Collector/src/Character/InputController.cs @@ -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> animations; - int i = 0; + private Player _player; + private Mouse _mouse; + private OrthographicCamera _cam; + private Dictionary 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 + { + ["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("man/man-0"); + _spriteBatch.Draw(texture,new Vector2(Player.X,Player.Y),Color.White); + } } diff --git a/Collector/src/Character/Mouse.cs b/Collector/src/Character/Mouse.cs index 2f7f713..e7a366f 100644 --- a/Collector/src/Character/Mouse.cs +++ b/Collector/src/Character/Mouse.cs @@ -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("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; + } } } diff --git a/Collector/src/Character/Player.cs b/Collector/src/Character/Player.cs index eb04caa..6b5f3a0 100644 --- a/Collector/src/Character/Player.cs +++ b/Collector/src/Character/Player.cs @@ -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 Animation { get; set; } + //private Inventory PlayerInventory { get; } - public Player(int x, int y) { - //Player location - X = x< keyFrames = textureAtlas.findRegions(spriteName + "_Down"); - //float frameDuration = 1 / 4f; - //animation = new Animation<>(frameDuration, keyFrames); + public Player(int x, int y) { + X = x< getAnimation() { - return animation; - } - - public void setAnimation(Animation animationTemp) { - animation = animationTemp; - } - - public void dispose(){ - //textureAtlas.dispose(); - } - - public TextureAtlas getTextureAtlas() { - return textureAtlas; - } - */ } diff --git a/Collector/src/Dimension/Block.cs b/Collector/src/Dimension/Block.cs index 26acd57..f91c5c3 100644 --- a/Collector/src/Dimension/Block.cs +++ b/Collector/src/Dimension/Block.cs @@ -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; } } diff --git a/Collector/src/Dimension/BlockMaterials.cs b/Collector/src/Dimension/BlockMaterials.cs index 3a8379e..b38699e 100644 --- a/Collector/src/Dimension/BlockMaterials.cs +++ b/Collector/src/Dimension/BlockMaterials.cs @@ -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(name)); } + } public static void Draw(string name,SpriteBatch _spriteBatch,int x, int y) { - _spriteBatch.Draw(Textures[name],new Vector2(x, y),Color.Aqua); } } } diff --git a/Collector/src/Dimension/Chunks.cs b/Collector/src/Dimension/Chunks.cs index 41f0d14..1c7d263 100644 --- a/Collector/src/Dimension/Chunks.cs +++ b/Collector/src/Dimension/Chunks.cs @@ -7,36 +7,38 @@ using Collector.ThirdPartyCode; namespace Collector.Dimension { public class Chunks: IRestrictions { - public static Dictionary, Block> LoadedChunks = new Dictionary, Block>(); - public static Dictionary, Block> SavedChunks = new Dictionary, Block>(); - public static OpenSimplexNoise Gen1 = new OpenSimplexNoise(IRestrictions.Seed+ 1); - public static OpenSimplexNoise Gen2 = new OpenSimplexNoise(IRestrictions.Seed); + public static Dictionary, Block> LoadedChunks { get; } = + new Dictionary, Block>(); + + private static readonly Dictionary, Block> SavedChunks = new Dictionary, 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(x, y, z), BlockMaterials.Materials[name]); SavedChunks.Add(new Tuple(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(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(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(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(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(x * 8, y * 8,0)] == null; + return !LoadedChunks.ContainsKey(new Tuple(x * 8, y * 8,0)); } } } diff --git a/Collector/src/Dimension/World.cs b/Collector/src/Dimension/World.cs index 1e1de6f..d6d39c3 100644 --- a/Collector/src/Dimension/World.cs +++ b/Collector/src/Dimension/World.cs @@ -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 - ); - } - - } } diff --git a/Collector/src/Dimension/WorldRenderer.cs b/Collector/src/Dimension/WorldRenderer.cs index 2690a5a..694070a 100644 --- a/Collector/src/Dimension/WorldRenderer.cs +++ b/Collector/src/Dimension/WorldRenderer.cs @@ -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); - } - */ - } -} +} \ No newline at end of file