static void Main(string[] args) { IConfigurationManager ConfigurationManager = ConfigurationManagerFactory.CreateDefault(); using (Root _root = new Root("game.log")) { ConfigurationManager.RestoreConfiguration(_root); if (ConfigurationManager.ShowConfigDialog(_root)) { ConfigurationManager.SaveConfiguration(_root); using (RenderWindow _renderWindow = _root.Initialize(true, "Illisian.Niva")) { var game = new Game(_root, _renderWindow); WindowEventMonitor.Instance.RegisterListener(_renderWindow, game); game.OnLoad(); game.CreateScene(); _root.FrameRenderingQueued += game.OnRenderFrame; _root.FrameStarted += game.UpdateInput; _root.FrameStarted += game.UpdateOverlay; _root.FrameEnded += game.OnRenderFrameEnd; _root.StartRendering(); game.OnUnload(); } } } }
private static void Main() { using (var r = new Root()) { r.RenderSystem = r.RenderSystems[0]; using (r.Initialize(true)) { var win = new DemoWindow(r); win.OnLoad(); r.FrameRenderingQueued += win.OnRenderFrame; r.StartRendering(); win.OnUnload(); } } }
public void Start(string host, bool userConfigure, bool debugSettings) { // HACK: Use an English culture so that Axiom.Overlays.Elements.BorderPanel works. System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; // HACK: Get assembly Axiom.Platforms.Win32.dll loaded before any dynamically created assembly. // This is to avoid an exception getting thrown from the Root constructor. System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(Axiom.Platforms.Win32.Win32InputReader).TypeHandle); var service = Connect(host); var configuration = ConfigurationManagerFactory.CreateDefault(); using (var root = new Root("MOOLGOSS.log")) using (Globals.Input = new Input()) { root.RenderSystem = root.RenderSystems[0]; root.RenderSystem.ConfigOptions["VSync"].Value = "Yes"; root.RenderSystem.ConfigOptions["Full Screen"].Value = "Yes"; var bestMode = root.RenderSystem.ConfigOptions["Video Mode"].PossibleValues .Where(x => x.Value.Contains("32-bit color")) .LastOrDefault().Value; if (bestMode != null) root.RenderSystem.ConfigOptions["Video Mode"].Value = bestMode; if (debugSettings) { root.RenderSystem.ConfigOptions["Full Screen"].Value = "No"; root.RenderSystem.ConfigOptions["Video Mode"].Value = "800 x 600 @ 32-bit color"; } if (userConfigure && !configuration.ShowConfigDialog(root)) return; var window = CreateRenderWindow(root.RenderSystem.ConfigOptions["Video Mode"].Value == "Yes"); Globals.Input.Initialize(window, ownMouse: !debugSettings); ResourceGroupManager.Instance.AddResourceLocation("Media", "Folder", true); ResourceGroupManager.Instance.InitializeAllResourceGroups(); Globals.Scene = root.CreateSceneManager(SceneType.Generic); Globals.UI = new UserInterface(); Globals.UI.AddMode(new TitleScreen()); Globals.UI.AddMode(new Gameplay(service)); Globals.UI.AddMode(new Docked()); Globals.UI.SetMode("Title Screen"); CreateCamera(window); root.FrameStarted += FrameStartedHandler; root.StartRendering(); } }
private static void Main() { using (var r = new Root()) { if (r.RenderSystems.Count == 0) throw new Exception("No Rendersystem found"); Console.WriteLine("Select a Rendersystem"); for (var i = 0; i < r.RenderSystems.Count; i++) Console.WriteLine("{0}: {1}", i + 1, r.RenderSystems[i].Name); while (true) { int index; if (!int.TryParse(Console.ReadKey(true).KeyChar.ToString(), out index)) continue; if (index < 1) continue; index--; if (index >= r.RenderSystems.Count) continue; r.RenderSystem = r.RenderSystems[index]; break; } using (r.Initialize(true)) { var win = new DemoWindow(r, r.AutoWindow); win.OnLoad(); r.FrameRenderingQueued += win.OnRenderFrame; r.StartRendering(); win.OnUnload(); } } }