This project is read-only.
Project Description
A compact IoC container built specifically for XNA. It has most the features you would expect from a container, life cycle management, singletons, prototypes, auto-wiring, late injection, look up by interface or name and more in about 500 lines of code.
Reflection is minimal so that it is usable in XNA and with the Compact Framework. Also, configuration is code only with no XML in sight. See below for a quick example, there is complete example project that shows most of the features in the repository, see here.

container = new RadialityContainer();

container.Bind<GameConsole>("Console").To(delegate(RadialityContainer r) {
    Game1 game1 = r.Get<Game1>();
    GameConsole console = new GameConsole(game1);
    return console;

r.Bind<SpriteFont>("ConsoleFont").To(delegate {
     Game1 game1 = r.Get<Game1>();
     return game1.Content.Load<SpriteFont>("Fonts/LiberationMono12");

r.Bind<Texture2D>("ConsoleBackgroundTexture").To(delegate {
     Game1 game1 = r.Get<Game1>();
     return game1.Content.Load<Texture2D>("Textures/ConsoleBackground");

container.Bind<Gameplay>().To(delegate(RadialityContainer r) {
    Game1 game1 = r.Get<Game1>();
    Gameplay gameplay = new Gameplay(game1, null, r);
    return gameplay;

Thanks for playing,
Ark @

Last edited Feb 12, 2009 at 8:02 PM by arkarua, version 4