From 5f6be8e23c6ededee1b3e7c2ad50ebf410045799 Mon Sep 17 00:00:00 2001 From: Timofey06 Date: Tue, 15 Aug 2023 16:15:37 +0300 Subject: [PATCH 1/2] FixScaling --- DangerousD/GameCore/GameObjects/LivingEntities/Player.cs | 5 +++++ .../GameCore/GameObjects/MapObjects/TestAnimationDeath.cs | 4 ++-- DangerousD/GameCore/Graphics/GraphicsComponent.cs | 1 + DangerousD/GameCore/Levels/Level1.cs | 2 +- DangerousD/GameCore/Managers/AppManager.cs | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player.cs index 865c044..a36ee64 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player.cs @@ -1,4 +1,5 @@ using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; @@ -9,6 +10,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities { public class Player : LivingEntity { + public Player(Vector2 position): base(position) + { + + } protected override GraphicsComponent GraphicsComponent => throw new NotImplementedException(); public void Kill() diff --git a/DangerousD/GameCore/GameObjects/MapObjects/TestAnimationDeath.cs b/DangerousD/GameCore/GameObjects/MapObjects/TestAnimationDeath.cs index 6937c56..8e9be4d 100644 --- a/DangerousD/GameCore/GameObjects/MapObjects/TestAnimationDeath.cs +++ b/DangerousD/GameCore/GameObjects/MapObjects/TestAnimationDeath.cs @@ -15,8 +15,8 @@ namespace DangerousD.GameCore.GameObjects.MapObjects public TestAnimationDeath(Vector2 position) : base(position) { - Width = 64; - Height = 64; + Width =512; + Height = 512; GraphicsComponent.StartAnimation("deathbear"); diff --git a/DangerousD/GameCore/Graphics/GraphicsComponent.cs b/DangerousD/GameCore/Graphics/GraphicsComponent.cs index e605684..3dfed09 100644 --- a/DangerousD/GameCore/Graphics/GraphicsComponent.cs +++ b/DangerousD/GameCore/Graphics/GraphicsComponent.cs @@ -129,6 +129,7 @@ namespace DangerousD.GameCore.Graphics public void DrawAnimation(Rectangle destinationRectangle, SpriteBatch _spriteBatch) { + _spriteBatch.Draw(textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)], destinationRectangle, sourceRectangle, Color.White); } diff --git a/DangerousD/GameCore/Levels/Level1.cs b/DangerousD/GameCore/Levels/Level1.cs index 5ab7a66..781bb24 100644 --- a/DangerousD/GameCore/Levels/Level1.cs +++ b/DangerousD/GameCore/Levels/Level1.cs @@ -8,7 +8,7 @@ namespace DangerousD.GameCore.Levels { public void InitLevel() { - new Player(); + //new Player(); var Трава = new GrassBlock(new Vector2(0, 128)); var Death = new TestAnimationDeath(new Vector2(128, 128)); diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs index e45a378..cbf0bf6 100644 --- a/DangerousD/GameCore/Managers/AppManager.cs +++ b/DangerousD/GameCore/Managers/AppManager.cs @@ -103,7 +103,7 @@ namespace DangerousD.GameCore LobbyGUI.Draw(_spriteBatch); break; case GameState.Game: - _spriteBatch.Begin(); + _spriteBatch.Begin(SpriteSortMode.Deferred,null/*,SamplerState.PointClamp*/); GameManager.Draw(_spriteBatch); _spriteBatch.End(); break; From 2d33e13283f9beb0952833008cc56f95289364f7 Mon Sep 17 00:00:00 2001 From: Timofey06 Date: Tue, 15 Aug 2023 16:46:41 +0300 Subject: [PATCH 2/2] LastOldWorkVersionOfAnimator --- DangerousD/GameCore/Graphics/AnimationBuilder.cs | 2 ++ DangerousD/GameCore/Managers/AppManager.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DangerousD/GameCore/Graphics/AnimationBuilder.cs b/DangerousD/GameCore/Graphics/AnimationBuilder.cs index 8f35b5a..8f169f6 100644 --- a/DangerousD/GameCore/Graphics/AnimationBuilder.cs +++ b/DangerousD/GameCore/Graphics/AnimationBuilder.cs @@ -21,7 +21,9 @@ namespace DangerousD.GameCore.Graphics string json = reader.ReadToEnd(); AnimationContainer animation = JsonConvert.DeserializeObject(json); Animations.Add(animation); + reader.Close(); } + } } } diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs index cbf0bf6..67a65cf 100644 --- a/DangerousD/GameCore/Managers/AppManager.cs +++ b/DangerousD/GameCore/Managers/AppManager.cs @@ -103,7 +103,7 @@ namespace DangerousD.GameCore LobbyGUI.Draw(_spriteBatch); break; case GameState.Game: - _spriteBatch.Begin(SpriteSortMode.Deferred,null/*,SamplerState.PointClamp*/); + _spriteBatch.Begin(SpriteSortMode.Deferred,null,SamplerState.PointClamp); GameManager.Draw(_spriteBatch); _spriteBatch.End(); break;