Example #1
0
        //The constructor is private because when we want to use a loadingscreen we should use the static Load function
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow, GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
Example #2
0
        //This function is to be used when we want to use a loadingscreen
        public static void Load(ScreenManager screenManager, bool loadingIsSlow, params GameScreen[] screensToLoad)
        {
            //Tell all screens to transition off
            foreach (GameScreen screen in screenManager.GetScreens())
                screen.ExitScreen();

            //Create the loadingscreen
            LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad);

            //and finally activate the loadingscreen
            screenManager.AddScreen(loadingScreen);
        }
Example #3
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            screenManager = new ScreenManager(this);
            screenManager.SpriteBatch = spriteBatch;
            screenManager.Font = Content.Load<SpriteFont>("GUI Textures/Fonts/DejaVuSans_20");
            screenManager.BlankTexture = Content.Load<Texture2D>("GUI Textures/BlankTexture");
            //screenManager.TraceEnabled = true;

            screenManager.AddScreen(new BackgroundScreen());
            screenManager.AddScreen(new MainMenuScreen());

            Camera.Initialize(GraphicsDevice);
            Camera.Limits = new Rectangle(0, 0, 800, 600);
            Camera.LoadStuff(Content);
            // TODO: use this.Content to load your game content here

            var pp = GraphicsDevice.PresentationParameters;
            ShaderTarget = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight);
            MainTarget = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight);
        }