1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-16 04:25:23 +00:00

Switched to software rendering.

This commit is contained in:
Tim Sarbin 2018-11-25 10:03:30 -05:00
parent 0b3a15403c
commit 6e7dccfe5d
3 changed files with 7 additions and 4 deletions

View File

@ -90,8 +90,8 @@ namespace OpenDiablo2.Core
sw.Start();
while (getRenderWindow().IsRunning)
{
while (sw.ElapsedMilliseconds < 40)
Thread.Sleep((int)Math.Min(1, 40 -sw.ElapsedMilliseconds)); // The original runs at about 25 fps.
while (sw.ElapsedMilliseconds < 33)
Thread.Sleep((int)Math.Min(1, 33 -sw.ElapsedMilliseconds)); // Lock to 30fps
var ms = sw.ElapsedMilliseconds;

View File

@ -98,7 +98,10 @@ namespace OpenDiablo2.Core.Map_Engine
continue;
var floorLayer = gameState.MapData.FloorLayers[0];
var floor = floorLayer.Props[x + (y * gameState.MapData.Width)];
var idx = x + (y * gameState.MapData.Width);
if (idx >= floorLayer.Props.Length)
break;
var floor = floorLayer.Props[idx];
if (floor.Prop1 == 0)
return;

View File

@ -53,7 +53,7 @@ namespace OpenDiablo2.SDL2_
if (window == IntPtr.Zero)
throw new ApplicationException($"Unable to create SDL Window: {SDL.SDL_GetError()}");
renderer = SDL.SDL_CreateRenderer(window, -1, SDL.SDL_RendererFlags.SDL_RENDERER_ACCELERATED);
renderer = SDL.SDL_CreateRenderer(window, -1, SDL.SDL_RendererFlags.SDL_RENDERER_SOFTWARE);
if (renderer == IntPtr.Zero)
throw new ApplicationException($"Unable to create SDL Window: {SDL.SDL_GetError()}");