Project DescriptionThe Rainweaver Framework is a collection of common and not so common utilities for game developers using the .NET Framework. Contains an Entity System implementation (work in progress).
Important: this library is free for non-commercial use.
The Entity System project is going through major changes. Stay tuned for future releases.
If you find this project useful, helpful, please consider donating!A Rain Song - Author's blogA glimpse of the utilities contained in the libraries:
Many useful (and some
exotic)
extension methods (please browse the Rainweaver.Extension folder under the main project for further details).
ServiceContainer (IoC with autowiring)
// ...
public MainWindowController(IEventAggregator events)
: base("MainWindowController")
{
Ensure.That(events).IsNotNull().ElseFailWith(new ArgumentNullException("events"));
this.Events = events;
this.Events.RegisterListener(this, typeof(CreateNewProjectEventArgs));
}
// ...
ServiceContainer.Register(new EventAggregator() { AsyncOperation = AsyncOperationManager.CreateOperation(null) });
ServiceContainer.Register<MainWindowController>(); // the IEventAggregator instance is autowired to MainWindowController
// ...
this.controller = ServiceContainer.Get<MainWindowController>();
CVarDictionary
internal class Configuration
: CVarDictionary
{
// ...
public Configuration()
{
this.AddCVar("g_width", 800, Int32Validator);
this.AddCVar("g_fullscreen", false, BooleanValidator);
this.Load(cfgPath);
}
// ...
}
InputHandler
Program.Input = ServiveContainer.Register(new InputHandler(Program.Screen));
// ...
Program.Input.KeyDown += keyHandlerExitOnEsc;
StateFlow
Program.StateFlow = ServiceContainer.Register(new StateFlow() { ExitApplicationAfterLastState = true });
// ...
Program.StateFlow.EnterState(new AppStates.InitState());
// ...
Program.StateFlow.SwitchToState(new MainMenuState());
// ...
if (arg.KeyCode == Keys.Escape)
{
Program.StateFlow.ExitCurrentState();
}
ILog implementations
Program.Log = ServiceContainer.Register(new FileLog("arcana.log", false) { PrefixDateTime = true });
Usable
- ServiceContainer, FileLog, CVarConsole, ApplicationStateManager, InputHandler