Example #1
0
        static void Main(string[] args)
        {
            _framework = Framework.XNA;
            System.Windows.Forms.Application.EnableVisualStyles();
            if (args != null && args.Length != 0)
            {
                if (args[0].ToLower() == "enced")
                {
                    Settings.startAsEncEdit = true;
                }
            }
            using (Main game = new Main())
            {
                //TODO reenable
                //try
                //{
                    game.Run();
                /*
                }
                catch (Exception e)
                {
                    MicroWorld.Main.game.IsMouseVisible = true;
                    if (!System.IO.Directory.Exists("debug"))
                        System.IO.Directory.CreateDirectory("debug");
                    String fn = "debug/error" + DateTime.Now.Ticks.ToString() + ".log";
                    System.IO.StreamWriter sw = new System.IO.StreamWriter(fn);
                    sw.WriteLine(e.Message);
                    sw.WriteLine();
                    sw.WriteLine(e.Source);
                    sw.WriteLine();
                    sw.WriteLine(e.StackTrace);
                    sw.WriteLine();
                    sw.Close();

                    System.Windows.Forms.MessageBox.Show("Oops! Something was where it was not supposed to be.\r\nCrash log has been saved to debug/error.log.\r\nPlease, consider submitting it.");
                }//*/
                /*
                }
                catch (Exception e)
                {
                    MicroWorld.Main.game.IsMouseVisible = true;
                    if (!System.IO.Directory.Exists("debug")) System.IO.Directory.CreateDirectory("debug");
                    String fn = "debug/error" + DateTime.Now.Ticks.ToString() + ".log";
                    System.IO.StreamWriter sw = new System.IO.StreamWriter(fn);
                    sw.WriteLine(e.Message);
                    sw.WriteLine();
                    sw.WriteLine(e.Source);
                    sw.WriteLine();
                    sw.WriteLine(e.StackTrace);
                    sw.WriteLine();
                    sw.Close();

                    //System.Windows.Forms.MessageBox.Show("Oops! Something was where it was not supposed to be.\r\nCrash log has been saved");
                    Debug.ReportSender rs = new Debug.ReportSender();
                    rs.ErrorFileName = fn;
                    rs.ShowDialog();
                }//*/
            }
        }
Example #2
0
        int tps = 0; //ticks

        #endregion Fields

        #region Constructors

        public Main()
        {
            _startMS = DateTime.Now.Millisecond;

            Settings.CheckVersionFormat();
            Settings.Load();
            IO.Log.Initialize();

            Settings.CheckFolders();

            IO.Log.Write("Entering constructor");

            IO.Log.Write("Setting graphics device");
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            IO.Log.Write("Initializing resource manager");
            ResourceManager.Initialize(Content);
            window = Window;
            //Window.Title = "MicroWorld    Version " + Settings.VERSION;
            Window.Title = "MicroWorld";//    Version " + Settings.VERSION;

            //this.IsMouseVisible = true;
            game = this;

            cd = new CircuitDebug();
            //cd.Show();
            mv = new Debug.MatrixViewer();
            //mv.Show();

            //graphics.SynchronizeWithVerticalRetrace = true;
            //graphics.PreferredBackBufferWidth = 1024;
            //graphics.PreferredBackBufferHeight = 768;
            //graphics.PreferredBackBufferWidth = 800;
            //graphics.PreferredBackBufferHeight = 480;
            IO.Log.Write("Setting graphics stencil format");
            Main.graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
            //graphics.PreferredBackBufferWidth = 1920;
            //graphics.PreferredBackBufferHeight = 1080;
            //graphics.IsFullScreen = true;
            windowWidth = graphics.PreferredBackBufferWidth;
            windowHeight = graphics.PreferredBackBufferHeight;

            Settings.ChangeResolution();

            Utilities.Reflection.RegisterAssembly(System.Reflection.Assembly.GetExecutingAssembly());
            GlobalEvents.onResolutionChanged += new GlobalEvents.ResolutionEventHandler(GlobalEvents_onResolutionChanged);

            lastSecond = DateTime.Now.Second;

            IO.Log.Write("Leaving constructor");
            //vvm.Show();

            Logics.CircuitPart.ttt();
        }