mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 01:39:23 +01:00
moved raw content handling to MLEM.Data
This commit is contained in:
parent
534194b3ea
commit
3b382a46cf
9 changed files with 11 additions and 12 deletions
|
@ -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> {
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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 {
|
||||
|
|
@ -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> {
|
||||
|
|
@ -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> {
|
||||
|
|
@ -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> {
|
||||
|
|
@ -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 {
|
||||
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue