Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blizzcrafter/monogame.runtimebuilder
The MonoGame.RuntimeBuilder builds your raw content asynchronously to the .XNB format during runtime.
https://github.com/blizzcrafter/monogame.runtimebuilder
editor editors engine engines monogame monogame-community monogame-forms monogame-framework nuget windows-forms
Last synced: about 2 months ago
JSON representation
The MonoGame.RuntimeBuilder builds your raw content asynchronously to the .XNB format during runtime.
- Host: GitHub
- URL: https://github.com/blizzcrafter/monogame.runtimebuilder
- Owner: BlizzCrafter
- License: other
- Created: 2019-09-05T09:27:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T06:57:51.000Z (9 months ago)
- Last Synced: 2024-10-10T17:15:24.999Z (2 months ago)
- Topics: editor, editors, engine, engines, monogame, monogame-community, monogame-forms, monogame-framework, nuget, windows-forms
- Language: C#
- Homepage:
- Size: 21.7 MB
- Stars: 10
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Banner](https://raw.githubusercontent.com/sqrMin1/MonoGame.Forms/master/Logos/Logo_Banner_800.png)
# Welcome to the MonoGame.RuntimeBuilder!
[![NuGet](https://img.shields.io/badge/NuGet-MonoGame.RuntimeBuilder-blue.svg?style=flat-square&logo=NuGet&colorA=3260c4&colorB=77c433)](https://www.nuget.org/packages/MonoGame.RuntimeBuilder)
The MonoGame.RuntimeBuilder **builds** your **raw** content **asynchronously** to the **.XNB** format **during runtime**.
> This library is a part of the [MonoGame.Forms](https://github.com/sqrMin1/MonoGame.Forms) project,
but it is fully usable without the MonoGame.Forms library!![Sample Project](doc/sample_project.png)
---
### TutorialUsing the MonoGame.RuntimeBuilder is fairly easy:
```c
// Creating the property.
private RuntimeBuilder _RuntimeBuilder { get; set; }// Initialize the RuntimeBuilder.
_RuntimeBuilder = new RuntimeBuilder(
Path.Combine(Application.StartupPath, "working"), // working directory
Path.Combine(Application.StartupPath, "working", "obj"), // intermediate directory
Path.Combine(Application.StartupPath, "Content"), // output directory
TargetPlatform.Windows, // target platform
GraphicsProfile.Reach, // graphics profile
true) // compress the content
{
Logger = new StringBuilderLogger() // logger
};
// Pick Files & Build Content.
private async void ButtonPickFiles_Click(object sender, System.EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
await _RuntimeBuilder.BuildContent(openFileDialog.FileNames);
}
}
```And... that's it!
A content build list will be generated for you so that in case you just want to rebuild your files, you simply need to call **_RuntimeBuilder.BuildContent();** (without parameters) again.
The [RuntimeBuilder.cs](https://github.com/sqrMin1/MonoGame.RuntimeBuilder/blob/master/MonoGame.RuntimeBuilder/RuntimeBuilder.cs#L12-L16) class is actually just a wrapper around the original [MGCB](https://github.com/MonoGame/MonoGame/tree/develop/Tools/MGCB "MonoGame.Content.Builder") tool, so it contains all of its features and functionality. Take a look at it and you will see that everything is pretty self-explanatory.
Just one note:
To get log information you need to use a **ContentBuildLogger**. You can also inherit from this class to build your own logger.
Fortunately this library already contains a [StringBuilderLogger](https://github.com/sqrMin1/MonoGame.RuntimeBuilder/blob/master/MonoGame.RuntimeBuilder/StringBuilderLogger.cs#L8-L13) as an example :)
There is generally a [sample project](https://github.com/sqrMin1/MonoGame.RuntimeBuilder/blob/master/MonoGame.RuntimeBuilder.Sample/Sample.cs#L8) included in this repo, which shows pretty much everything. It's fully documented (comments) as well as the most important parts of the library.
### Now Have Fun with the MonoGame.RuntimeBuilder!
![Logo](https://raw.githubusercontent.com/sqrMin1/MonoGame.Forms/master/Logos/Logo_Shadow_256.png)