Example #1
0
        protected override void Initialize()
        {
            base.Initialize();

            GameLevel simpleTest = new GameLevel();
            //AdvancedDemo1 advancedDemo1 = new AdvancedDemo1();
            //AdvancedDemo2 advancedDemo2 = new AdvancedDemo2();
            //AdvancedDemo3 advancedDemo3 = new AdvancedDemo3();
            //AdvancedDemo4 advancedDemo4 = new AdvancedDemo4();
            //AdvancedDemo5 advancedDemo5 = new AdvancedDemo5();


            MenuScreen menuScreen = new MenuScreen("Samples");

            menuScreen.AddMenuItem(simpleTest.GetTitle(), EntryType.Screen, simpleTest);
            //menuScreen.AddMenuItem(advancedDemo1.GetTitle(), EntryType.Screen, advancedDemo1);
            //menuScreen.AddMenuItem(advancedDemo2.GetTitle(), EntryType.Screen, advancedDemo2);
            //menuScreen.AddMenuItem(advancedDemo3.GetTitle(), EntryType.Screen, advancedDemo3);
            //menuScreen.AddMenuItem(advancedDemo4.GetTitle(), EntryType.Screen, advancedDemo4);
            //menuScreen.AddMenuItem(advancedDemo5.GetTitle(), EntryType.Screen, advancedDemo5);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Exit", EntryType.ExitItem, null);

            ScreenManager.AddScreen(new BackgroundScreen());
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.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()
        {
            base.Initialize();

            SimpleLevel samplelevel1 = new SimpleLevel(this);

            OptionsMenu optionsScreen = GlobalGameOptions.OptionsMenu;

            MenuScreen menuScreen = new MenuScreen("", true);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);

            menuScreen.AddMenuItem("Game Levels", EntryType.Separator, null);
            menuScreen.AddMenuItem(samplelevel1.GetTitle(), EntryType.Screen, samplelevel1);

            menuScreen.AddMenuItem(optionsScreen.MenuTitle, EntryType.Screen, optionsScreen);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Exit", EntryType.GlobalExitItem, null);
            
            ScreenManager.AddScreen(new BackgroundScreen());
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.0)));
        }
Example #3
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()
        {
            // TODO: Add your initialization logic here

            base.Initialize();

            //LabyrinthDemo labyrinthDemo = new LabyrinthDemo();

            MenuScreen menuScreen = new MenuScreen("Labyrinth Game");

            //menuScreen.AddMenuItem("Labyrinth Samples", EntryType.Separator, null);ommo
            //menuScreen.AddMenuItem(labyrinthDemo.GetTitle(), EntryType.Screen, labyrinthDemo);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Exit", EntryType.ExitItem, null);

            ScreenManager.AddScreen(new BackgroundScreen());
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.0)));
        }
Example #4
0
        protected override void Initialize()
        {
            base.Initialize();

            _graphics.PreferredBackBufferWidth  = 1280;
            _graphics.PreferredBackBufferHeight = 720;
            _graphics.IsFullScreen = false;
            _graphics.ApplyChanges();

            Main = new Main(_graphics, GraphicsDevice, Content);

            MenuScreen menuScreen = new MenuScreen();

            menuScreen.AddMenuItem("Resume", EntryType.Action, () => Main.State == GameState.Running, () => {
                Main.ScreenState       = ScreenState.Active;
                menuScreen.ScreenState = ScreenState.Hidden;
            });
            menuScreen.AddMenuItem("New Game", EntryType.Action, () => true, () => {
                Main.CreateLevel();
                Main.ScreenState          = ScreenState.Active;
                menuScreen.ScreenState    = ScreenState.Hidden;
                Main.GameOver.ScreenState = ScreenState.Hidden;
                Main.GameWon.ScreenState  = ScreenState.Hidden;
            });
            menuScreen.AddMenuItem("Exit", EntryType.Action, () => true, () => Exit());
            menuScreen.AddMenuItem("", EntryType.Separator, () => true, () => { });

            ScreenManager.AddScreen(new BackgroundScreen()
            {
                ScreenState = ScreenState.Active
            });
            ScreenManager.AddScreen(Main);
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(Main.GameOver);
            ScreenManager.AddScreen(Main.GameWon);

            Main.Menu = menuScreen;

            menuScreen.ScreenState = ScreenState.Active;
        }
Example #5
0
        protected override void Initialize()
        {
            MenuScreen menuScreen = new MenuScreen("Cow Farm Game");

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Start Game", EntryType.Screen, new CowGameScreen(Content, _graphics));
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("About", EntryType.Screen, new AboutScreen(Content, _graphics));

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Exit", EntryType.ExitItem, null);


            ScreenManager.AddScreen(new BackgroundScreen());
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(2.0)));

            base.Initialize();
        }
Example #6
0
        protected override void Initialize()
        {
            base.Initialize();

            GlobalDevices._GameState = GameState.MAINMENU;
            GameSettings.InitParser();
            GlobalDevices._GraphicsDeviceManager.IsFullScreen = GameSettings._FullScreen;
            GlobalDevices._GraphicsDeviceManager.ApplyChanges();
            SoundEffects.LoadSoundEffects(ScreenManager.Content);
            Level      level      = new Level();
            MenuScreen menuScreen = new MenuScreen("CaveWizard");

            menuScreen.AddMenuItem("Main Menu", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Level", EntryType.Screen, level);
            menuScreen.AddMenuItem("Settings", EntryType.Screen, new SettingsMenu("Settings"));
            //   menuScreen.AddMenuButton(ButtonType.CheckBox, "Textures/Checkbox", "Test");
            menuScreen.AddMenuItem("Exit", EntryType.ExitItem, null);
            ScreenManager.AddScreen(menuScreen);

            //_camera.Zoom = 4f;
        }
Example #7
0
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentWrapper.Initialize(this);

            _spriteBatch  = new SpriteBatch(GraphicsDevice);
            _lineBatch    = new LineBatch(GraphicsDevice);
            _quadRenderer = new QuadRenderer(GraphicsDevice);

            _input.LoadContent(GraphicsDevice.Viewport);
#if WINDOWS
            _counter.LoadContent();
#endif

            // Create rendertarget for transitions
            PresentationParameters pp = GraphicsDevice.PresentationParameters;
            _transitions.Add(new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, SurfaceFormat.Color, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents));

            _menuScreen = new MenuScreen();

            List <Type> DemosToLoad      = new List <Type>();
            Assembly    samplesFramework = Assembly.GetExecutingAssembly();
            foreach (Type sampleType in samplesFramework.GetTypes())
            {
                if (sampleType.IsSubclassOf(typeof(PhysicsDemoScreen)))
                {
                    DemosToLoad.Add(sampleType);
                }
            }
            DemosToLoad.Add(DemosToLoad[0]); // HACK: Load the first sample two times, since some delayed creation stuff with the rendertargets always breaks the first preview picture.
            bool firstPreview = true;
            foreach (Type sampleType in DemosToLoad)
            {
                PhysicsDemoScreen demoScreen = samplesFramework.CreateInstance(sampleType.ToString()) as PhysicsDemoScreen;
#if WINDOWS
                if (!firstPreview)
                {
                    Console.WriteLine("Loading demo: " + demoScreen.GetTitle());
                }
#endif
                RenderTarget2D preview = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth / 2, pp.BackBufferHeight / 2, false, SurfaceFormat.Color, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);

                demoScreen.Framework = this;
                demoScreen.IsExiting = false;

                demoScreen.Sprites = _spriteBatch;
                demoScreen.Lines   = _lineBatch;
                demoScreen.Quads   = _quadRenderer;

                demoScreen.LoadContent();

                // "Abuse" transition rendertarget to render screen preview
                GraphicsDevice.SetRenderTarget(_transitions[0]);
                GraphicsDevice.Clear(Color.Transparent);

                _quadRenderer.Begin();
                _quadRenderer.Render(Vector2.Zero, new Vector2(_transitions[0].Width, _transitions[0].Height), null, true, ContentWrapper.Grey, Color.White * 0.3f);
                _quadRenderer.End();

                // Update ensures that the screen is fully visible, we "cover" it so that no physics are run
                demoScreen.Update(new GameTime(demoScreen.TransitionOnTime, demoScreen.TransitionOnTime), true, false);
                demoScreen.Draw(new GameTime());
                demoScreen.Draw(new GameTime());

                GraphicsDevice.SetRenderTarget(preview);
                GraphicsDevice.Clear(Color.Transparent);

                _spriteBatch.Begin();
                _spriteBatch.Draw(_transitions[0], preview.Bounds, Color.White);
                _spriteBatch.End();

                GraphicsDevice.SetRenderTarget(null);

                demoScreen.ExitScreen();
                demoScreen.Update(new GameTime(demoScreen.TransitionOffTime, demoScreen.TransitionOffTime), true, false);
                if (!firstPreview)
                {
                    _menuScreen.AddMenuItem(demoScreen, preview);
                }
                else
                {
                    firstPreview = false;
                }
            }

            AddScreen(new BackgroundScreen());
            AddScreen(_menuScreen);

            //TODO: This can't be called at this point in time in MonoGame
            //ResetElapsedTime();
        }
Example #8
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()
        {
            base.Initialize();

            SimpleDemo1 simple1 = new SimpleDemo1();
            SimpleDemo2 simple2 = new SimpleDemo2();
            SimpleDemo3 simple3 = new SimpleDemo3();
            SimpleDemo4 simple4 = new SimpleDemo4();
            SimpleDemo5 simple5 = new SimpleDemo5();
            SimpleDemo6 simple6 = new SimpleDemo6();
            SimpleDemo7 simple7 = new SimpleDemo7();
            SimpleDemo8 simple8 = new SimpleDemo8();
            SimpleDemo9 simple9 = new SimpleDemo9();

            AdvancedDemo1 advanced1 = new AdvancedDemo1();
            AdvancedDemo2 advanced2 = new AdvancedDemo2();
            AdvancedDemo3 advanced3 = new AdvancedDemo3();
            AdvancedDemo4 advanced4 = new AdvancedDemo4();
            AdvancedDemo5 advanced5 = new AdvancedDemo5();

            GameDemo1 game1 = new GameDemo1();

            MenuScreen menuScreen = new MenuScreen("Farseer Samples");

            menuScreen.AddMenuItem("Simple Samples", EntryType.Separator, null);
            menuScreen.AddMenuItem(simple1.GetTitle(), EntryType.Screen, simple1);
            menuScreen.AddMenuItem(simple2.GetTitle(), EntryType.Screen, simple2);
            menuScreen.AddMenuItem(simple3.GetTitle(), EntryType.Screen, simple3);
            menuScreen.AddMenuItem(simple4.GetTitle(), EntryType.Screen, simple4);
            menuScreen.AddMenuItem(simple5.GetTitle(), EntryType.Screen, simple5);
            menuScreen.AddMenuItem(simple6.GetTitle(), EntryType.Screen, simple6);
            menuScreen.AddMenuItem(simple7.GetTitle(), EntryType.Screen, simple7);
            menuScreen.AddMenuItem(simple8.GetTitle(), EntryType.Screen, simple8);
            menuScreen.AddMenuItem(simple9.GetTitle(), EntryType.Screen, simple9);

            menuScreen.AddMenuItem("Advanced Samples", EntryType.Separator, null);
            menuScreen.AddMenuItem(advanced1.GetTitle(), EntryType.Screen, advanced1);
            menuScreen.AddMenuItem(advanced2.GetTitle(), EntryType.Screen, advanced2);
            menuScreen.AddMenuItem(advanced3.GetTitle(), EntryType.Screen, advanced3);
            menuScreen.AddMenuItem(advanced4.GetTitle(), EntryType.Screen, advanced4);
            menuScreen.AddMenuItem(advanced5.GetTitle(), EntryType.Screen, advanced5);

            menuScreen.AddMenuItem("Game Samples", EntryType.Separator, null);
            menuScreen.AddMenuItem(game1.GetTitle(), EntryType.Screen, game1);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Exit", EntryType.ExitItem, null);

            ScreenManager.AddScreen(new BackgroundScreen());
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.0)));
        }
Example #9
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()
        {
            base.Initialize();

            var menuScreen = new MenuScreen("Menu Test");

            menuScreen.AddMenuItem("Section 1", EntryType.Separator, null);
            //menuScreen.AddMenuItem(simple1.GetTitle(), EntryType.Screen, simple1);
            menuScreen.AddMenuItem("Warlords Revenge", EntryType.Screen, new WarlordsRevengeGameScreen());
            menuScreen.AddMenuItem("Section 2", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 3", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 4", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 5", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 6", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 7", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 8", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 9", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 10", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 11", EntryType.Separator, null);
            menuScreen.AddMenuItem("Section 12", EntryType.Separator, null);
            //menuScreen.AddMenuItem("Section 13", EntryType.Separator, null);
            //menuScreen.AddMenuItem("Section 14", EntryType.Separator, null);
            //menuScreen.AddMenuItem("Section 15", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Exit", EntryType.ExitItem, null);

            ScreenManager.AddScreen(new BackgroundScreen());
            //ScreenManager.AddScreen(new WarlordsRevengeGameScreen());
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(1.0)));
        }
Example #10
0
File: Game1.cs Project: grzdrz/gms
        protected override void Initialize()
        {
            base.Initialize();

            GameLevel     simpleTest    = new GameLevel();
            GameLevel1    gameLevel1    = new GameLevel1();
            SimpleDemo1   simpleDemo1   = new SimpleDemo1();
            SimpleDemo2   simpleDemo2   = new SimpleDemo2();
            SimpleDemo3   simpleDemo3   = new SimpleDemo3();
            SimpleDemo4   simpleDemo4   = new SimpleDemo4();
            SimpleDemo5   simpleDemo5   = new SimpleDemo5();
            SimpleDemo6   simpleDemo6   = new SimpleDemo6();
            SimpleDemo7   simpleDemo7   = new SimpleDemo7();
            SimpleDemo8   simpleDemo8   = new SimpleDemo8();
            SimpleDemo9   simpleDemo9   = new SimpleDemo9();
            SimpleDemo10  simpleDemo10  = new SimpleDemo10();
            AdvancedDemo1 advancedDemo1 = new AdvancedDemo1();
            AdvancedDemo2 advancedDemo2 = new AdvancedDemo2();
            AdvancedDemo3 advancedDemo3 = new AdvancedDemo3();
            AdvancedDemo4 advancedDemo4 = new AdvancedDemo4();
            AdvancedDemo5 advancedDemo5 = new AdvancedDemo5();


            MenuScreen menuScreen = new MenuScreen("Samples");

            menuScreen.AddMenuItem(simpleTest.GetTitle(), EntryType.Screen, simpleTest, "1");
            menuScreen.AddMenuItem(gameLevel1.GetTitle(), EntryType.Screen, gameLevel1, "2");
            menuScreen.AddMenuItem(simpleDemo1.GetTitle(), EntryType.Screen, simpleDemo1, "3");
            menuScreen.AddMenuItem(simpleDemo2.GetTitle(), EntryType.Screen, simpleDemo2, "4");
            menuScreen.AddMenuItem(simpleDemo3.GetTitle(), EntryType.Screen, simpleDemo3, "5");
            menuScreen.AddMenuItem(simpleDemo4.GetTitle(), EntryType.Screen, simpleDemo4, "6");
            menuScreen.AddMenuItem(simpleDemo5.GetTitle(), EntryType.Screen, simpleDemo5, "7");
            menuScreen.AddMenuItem(simpleDemo6.GetTitle(), EntryType.Screen, simpleDemo6, "8");
            menuScreen.AddMenuItem(simpleDemo7.GetTitle(), EntryType.Screen, simpleDemo7, "9");
            menuScreen.AddMenuItem(simpleDemo8.GetTitle(), EntryType.Screen, simpleDemo8, "10");
            menuScreen.AddMenuItem(simpleDemo9.GetTitle(), EntryType.Screen, simpleDemo9, "11");
            menuScreen.AddMenuItem(simpleDemo10.GetTitle(), EntryType.Screen, simpleDemo10, "12");
            menuScreen.AddMenuItem(advancedDemo1.GetTitle(), EntryType.Screen, advancedDemo1, "13");
            menuScreen.AddMenuItem(advancedDemo2.GetTitle(), EntryType.Screen, advancedDemo2, "14");
            menuScreen.AddMenuItem(advancedDemo3.GetTitle(), EntryType.Screen, advancedDemo3, "15");
            menuScreen.AddMenuItem(advancedDemo4.GetTitle(), EntryType.Screen, advancedDemo4, "16");
            menuScreen.AddMenuItem(advancedDemo5.GetTitle(), EntryType.Screen, advancedDemo5, "17");


            menuScreen.AddMenuItem("", EntryType.Separator, null, "");
            menuScreen.AddMenuItem("Exit", EntryType.ExitItem, null, "");

            MainMenuScreen mainMenuScreen = new MainMenuScreen("MainMenu");

            mainMenuScreen.AddMenuItem(EntryType.Screen, menuScreen);
            mainMenuScreen.AddMenuItem(EntryType.ExitItem, null);

            ScreenManager.AddScreen(background = new BackgroundScreen());
            ScreenManager.AddScreen(mainMenuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.0)));
        }