From 3b543131a5b7b4f3e1c1e5c68b8ef85761a837c3 Mon Sep 17 00:00:00 2001 From: Tim Sarbin Date: Tue, 27 Nov 2018 01:04:27 -0500 Subject: [PATCH] Forgot to commit the rest of the files.. --- OpenDiablo2.Common/Interfaces/ITexture.cs | 13 +++++++++++++ OpenDiablo2.Common/Models/MapCellInfo.cs | 22 ++++++++++++++++++++++ OpenDiablo2.SDL2/SDL2Extensions.cs | 11 +++++++++++ OpenDiablo2.SDL2/SDL2Texture.cs | 10 ++++++++++ 4 files changed, 56 insertions(+) create mode 100644 OpenDiablo2.Common/Interfaces/ITexture.cs create mode 100644 OpenDiablo2.Common/Models/MapCellInfo.cs create mode 100644 OpenDiablo2.SDL2/SDL2Extensions.cs create mode 100644 OpenDiablo2.SDL2/SDL2Texture.cs diff --git a/OpenDiablo2.Common/Interfaces/ITexture.cs b/OpenDiablo2.Common/Interfaces/ITexture.cs new file mode 100644 index 00000000..ba1b98a9 --- /dev/null +++ b/OpenDiablo2.Common/Interfaces/ITexture.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenDiablo2.Common.Interfaces +{ + // This allows external systems to store their texture data in other services for later use + public interface ITexture + { + } +} diff --git a/OpenDiablo2.Common/Models/MapCellInfo.cs b/OpenDiablo2.Common/Models/MapCellInfo.cs new file mode 100644 index 00000000..e9a73fdc --- /dev/null +++ b/OpenDiablo2.Common/Models/MapCellInfo.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using OpenDiablo2.Common.Interfaces; + +namespace OpenDiablo2.Common.Models +{ + // Represents a single cell on a map + public sealed class MapCellInfo + { + public Guid TileId; + public int OffX; + public int OffY; + public int FrameWidth; + public int FrameHeight; + public Rectangle Rect; + public ITexture Texture; + } +} diff --git a/OpenDiablo2.SDL2/SDL2Extensions.cs b/OpenDiablo2.SDL2/SDL2Extensions.cs new file mode 100644 index 00000000..f936042e --- /dev/null +++ b/OpenDiablo2.SDL2/SDL2Extensions.cs @@ -0,0 +1,11 @@ +using System.Drawing; +using SDL2; + +namespace OpenDiablo2.SDL2_ +{ + public static class SDL2Extensions + { + public static SDL.SDL_Rect ToSDL2Rect(this Rectangle src) => new SDL.SDL_Rect { x = src.X, y = src.Y, w = src.Width, h = src.Height }; + public static Rectangle ToRectangle(this SDL.SDL_Rect src) => new Rectangle { X = src.x, Y = src.y, Width = src.w, Height = src.h }; + } +} diff --git a/OpenDiablo2.SDL2/SDL2Texture.cs b/OpenDiablo2.SDL2/SDL2Texture.cs new file mode 100644 index 00000000..9b8d94c1 --- /dev/null +++ b/OpenDiablo2.SDL2/SDL2Texture.cs @@ -0,0 +1,10 @@ +using System; +using OpenDiablo2.Common.Interfaces; + +namespace OpenDiablo2.SDL2_ +{ + public sealed class SDL2Texture : ITexture + { + public IntPtr Pointer { get; set; } + } +}