Example #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            ProjectData.InitJCRDrivers();
            ProjectData.SetGame(this);

            #region Screen Size
            //graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
            //graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            graphics.HardwareModeSwitch = false;
            graphics.IsFullScreen       = true;
            graphics.ApplyChanges();
            #endregion

            #region TeddyBear Draw MonoGame Driver
            TeddyBear.TeddyDraw_MonoGame.Init();
            #endregion

            // Sprite Batch
            SB = new SpriteBatch(GraphicsDevice);

            // Mouse Pointer
            MousePointer = ProjectData.GetTex(GraphicsDevice, "MousePointer.png");

            // TQMG
            TQMG.Init(graphics, GraphicsDevice, SB, ProjectData.JCR);
            TQMG.RegLog(ProjectData.Log);

            // Exporter
            TeddyXport.XPort.init();

            // Unknown
            TeddyBear.TeddyDraw_MonoGame.SetUnknown(TQMG.GetImage("Unknown.png"));
            TeddyBear.TeddyDraw_MonoGame.Log = ProjectData.Log;


            // Do we have a project and a map?
#if DEBUG
            if (false)
            {
            }              // just some crap as things are different while debugging.
#else
            if (ProjectData.args.Length < 3)
            {
                Crash.Error(this, "No arguments given!\nUsage: TeddyEdit <project> <map>\n \n If you are not sure how to use this tool, use the launcher in stead!");
            }
#endif
            else
            {
#if DEBUG
                ProjectData.Project = "Test";
#else
                ProjectData.Project = ProjectData.args[1];
#endif
                if (!ProjectData.AllWell)
                {
                    Crash.Error(this, $"Project loading failed! {ProjectData.Project}");
                }
                else
                {
#if DEBUG
                    ProjectData.MapFile = $"{Dirry.AD(ProjectData.ProjectConfig.C("LevelDir"))}/Test Map";
#else
                    ProjectData.MapFile = $"{Dirry.AD(ProjectData.ProjectConfig.C("LevelDir"))}/{ProjectData.args[2]}";
#endif
                }
            }


            // Teddy Save Log
            TeddyBear.TeddySave.SetLog(ProjectData.Log);

            // Final
            base.Initialize();

            if (ProjectData.AllWell)
            {
                SetStage(Main.Me);
            }
        }