/// <summary> /// Where the program starts. Starts logging if necessary and runs game loop. /// </summary> private static void Main(string[] args) { var mugenOptions = new MugenOptions(); var shouldShowHelp = false; var options = new OptionSet { { "h|help", "Displays help", h => shouldShowHelp = h != null }, { "p3|player3=", "Loads a character named VALUE as player3", name => mugenOptions.Player3 = name }, { "p4|player4=", "Loads a character named VALUE as player4", name => mugenOptions.Player4 = name }, { "s|stage=", "Loads a stage named VALUE.def in stages/", s => mugenOptions.Stage = s }, }; try { // parse the command line var extra = options.Parse(args); if (extra.Count > 1) { mugenOptions.Player1 = extra[0]; mugenOptions.Player2 = extra[1]; } else if (extra.Count > 0) { mugenOptions.Player1 = extra[0]; } } catch (OptionException e) { // output some error message Console.Write("xnaMugen: "); Console.WriteLine(e.Message); Console.WriteLine("Try `xnaMugen --help' for more information."); return; } if (shouldShowHelp) { ShowHelp(options); return; } #if DEBUG Log.Start(); using (Game g = new Mugen(mugenOptions)) g.Run(); #else try { Log.Start(); using (Game g = new Mugen(mugenOptions)) g.Run(); } catch (Exception e) { Log.WriteException(e); System.Windows.Forms.MessageBox.Show(e.ToString(), "xnaMugen"); } #endif }
/// <summary> /// Initializes a new instance of this class. Sets game timing and default screen size. /// </summary> public Mugen(MugenOptions options) { Options = options; IsFixedTimeStep = true; TargetElapsedTime = TimeSpan.FromTicks(TimeSpan.TicksPerSecond / 60); IsMouseVisible = true; var graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = ScreenSize.X; graphics.PreferredBackBufferHeight = ScreenSize.Y; graphics.ApplyChanges(); DebugDraw = false; m_takescreeshot = false; }