1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 04:53:29 +01:00

moved raw content handling to MLEM.Data

This commit is contained in:
Ell 2020-09-16 23:39:01 +02:00
parent 534194b3ea
commit 3b382a46cf
9 changed files with 11 additions and 12 deletions

View file

@ -2,7 +2,7 @@
Sometimes, there's a good reason for wanting to load game assets directly rather than using the MonoGame Content Pipeline, which packs files into a binary `xnb` format. Those reasons include, for example, making your game easily moddable or allowing for texture packs.
The **MLEM** package contains a solution for this: `RawContentManager`.
The **MLEM.Data** package contains a solution for this: `RawContentManager`.
## What it does
A raw content manager works very similarly to a regular `ContentManager`: You can load different types of assets through the `Load<T>` method, and they will automatically be managed and disposed when the game closes.
@ -31,12 +31,12 @@ By default, the raw content manager supports the following types, as long as the
- `SoundEffect` (ogg, wav, mp3)
- `Song` (gg, wav, mp3)
- Any XML files (xml)
- Any JSON files (json) if `MLEM.Data` is used
- Any JSON files (json)
To add more content types that can be loaded by the raw content manager, you simply have to extend either `RawContentReader` or the generic version, `RawContentReader<T>`. For example, this is a content reader that loads a `txt` file as a string:
```cs
using System.IO;
using MLEM.Content;
using MLEM.Data.Content;
namespace Test {
public class StringReader : RawContentReader<string> {

View file

@ -6,7 +6,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace MLEM.Content {
namespace MLEM.Data.Content {
/// <summary>
/// Represents a version of <see cref="ContentManager"/> that doesn't load content binary <c>xnb</c> files, but rather as their regular formats.
/// </summary>

View file

@ -2,7 +2,7 @@ using System;
using System.IO;
using Microsoft.Xna.Framework.Content;
namespace MLEM.Content {
namespace MLEM.Data.Content {
/// <summary>
/// Represents a way for any kind of raw content file to be read using a <see cref="RawContentManager"/>
/// </summary>

View file

@ -1,9 +1,8 @@
using System;
using System.IO;
using MLEM.Content;
using Newtonsoft.Json;
namespace MLEM.Data.Json {
namespace MLEM.Data.Content {
/// <inheritdoc />
public class RawJsonReader : RawContentReader {

View file

@ -2,7 +2,7 @@ using System;
using System.IO;
using Microsoft.Xna.Framework.Media;
namespace MLEM.Content {
namespace MLEM.Data.Content {
/// <inheritdoc />
public class SongReader : RawContentReader<Song> {

View file

@ -1,7 +1,7 @@
using System.IO;
using Microsoft.Xna.Framework.Audio;
namespace MLEM.Content {
namespace MLEM.Data.Content {
/// <inheritdoc />
public class SoundEffectReader : RawContentReader<SoundEffect> {

View file

@ -1,7 +1,7 @@
using System.IO;
using Microsoft.Xna.Framework.Graphics;
namespace MLEM.Content {
namespace MLEM.Data.Content {
/// <inheritdoc />
public class Texture2DReader : RawContentReader<Texture2D> {

View file

@ -2,7 +2,7 @@ using System;
using System.IO;
using System.Xml.Serialization;
namespace MLEM.Content {
namespace MLEM.Data.Content {
/// <inheritdoc />
public class XmlReader : RawContentReader {

View file

@ -5,8 +5,8 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MLEM.Cameras;
using MLEM.Content;
using MLEM.Data;
using MLEM.Data.Content;
using MLEM.Extended.Extensions;
using MLEM.Extended.Font;
using MLEM.Extended.Tiled;