Code Monkey home page Code Monkey logo

monogame.runtimebuilder's Introduction

Banner

Welcome to the MonoGame.RuntimeBuilder!

NuGet

The MonoGame.RuntimeBuilder builds your raw content asynchronously to the .XNB format during runtime.

This library is a part of the MonoGame.Forms project, but it is fully usable without the MonoGame.Forms library!

Sample Project


Tutorial

Using the MonoGame.RuntimeBuilder is fairly easy:

// 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 class is actually just a wrapper around the original MGCB 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 as an example :)

There is generally a sample project 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

monogame.runtimebuilder's People

Contributors

blizzcrafter avatar sqrmin1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.