From 1c0dede449084756fc16d9cd98f93d7114c1c3c6 Mon Sep 17 00:00:00 2001 From: Tim Sarbin Date: Sat, 24 Nov 2018 20:22:03 -0500 Subject: [PATCH] fixed rendering --- OpenDiablo2.SDL2/SDL2Sprite.cs | 3 ++- OpenDiablo2.Scenes/Game.cs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/OpenDiablo2.SDL2/SDL2Sprite.cs b/OpenDiablo2.SDL2/SDL2Sprite.cs index ce54dec9..d973de05 100644 --- a/OpenDiablo2.SDL2/SDL2Sprite.cs +++ b/OpenDiablo2.SDL2/SDL2Sprite.cs @@ -137,6 +137,7 @@ namespace OpenDiablo2.SDL2_ mapTileOffset = new Point(minX, minY); texture = SDL.SDL_CreateTexture(renderer, SDL.SDL_PIXELFORMAT_ARGB8888, (int)SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STREAMING, FrameSize.Width, FrameSize.Height); + SDL.SDL_SetTextureBlendMode(texture, SDL.SDL_BlendMode.SDL_BLENDMODE_BLEND); if (texture == IntPtr.Zero) throw new ApplicationException($"Unaple to initialize texture: {SDL.SDL_GetError()}"); @@ -165,7 +166,7 @@ namespace OpenDiablo2.SDL2_ if (index < 0) continue; var color = palette.Colors[block.PixelData[xx + (yy * 32)]]; - if ((color >> 24) > 0) + if ((color & 0xFFFFFF) > 0) data[index] = color; } } diff --git a/OpenDiablo2.Scenes/Game.cs b/OpenDiablo2.Scenes/Game.cs index b4d3b00a..7d87df85 100644 --- a/OpenDiablo2.Scenes/Game.cs +++ b/OpenDiablo2.Scenes/Game.cs @@ -57,11 +57,11 @@ namespace OpenDiablo2.Scenes renderWindow.Draw(panelSprite, 5, new Point(685, 600)); // Render the health bar - renderWindow.Draw(healthManaSprite, 0, new Point(28, 590)); + renderWindow.Draw(healthManaSprite, 0, new Point(30, 587)); renderWindow.Draw(gameGlobeOverlapSprite, 0, new Point(28, 595)); // Render the mana bar - renderWindow.Draw(healthManaSprite, 1, new Point(691, 590)); + renderWindow.Draw(healthManaSprite, 1, new Point(692, 588)); renderWindow.Draw(gameGlobeOverlapSprite, 1, new Point(693, 591)); } @@ -87,7 +87,7 @@ namespace OpenDiablo2.Scenes for (int x = 0; x < gameState.MapData.Width; x++) { testSprite[idx] = renderWindow.GenerateMapCell(gameState.MapData, x, y, eRenderCellType.Floor, gameState.CurrentPalette); - testSprite[idx].Location = new Point(((x - y) * 80) - 1200, ((x + y) * 40) - 1200); + testSprite[idx].Location = new Point(((x - y) * 80) - 900, ((x + y) * 40) - 900); idx++; } }