コード例 #1
0
 public MeteorsManager(Game game, ref Texture2D theTexture)
     : base(game)
 {
     meteorTexture = theTexture;
     meteors = new List<Meteor>();
     audio = (AudioLibrary) Game.Services.GetService(typeof (AudioLibrary));
 }
コード例 #2
0
        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            _audio = new AudioLibrary();
            _graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;

            _graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;

            // graphics.IsFullScreen = true;
            Content.RootDirectory = "Content";
        }
コード例 #3
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="game">The main game object</param>
        /// <param name="theTexture">Texture with the sprite elements</param>
        /// <param name="backgroundTexture">Texture for the background</param>
        /// <param name="font">Font used in the score</param>
        public ActionScene(Game game, Texture2D theTexture,
            Texture2D backgroundTexture, SpriteFont font)
            : base(game)
        {
            background = new ImageComponent(game, backgroundTexture,
                ImageComponent.DrawMode.Stretch);
            Components.Add(background);

            actionTexture = theTexture;

            // Get the current sprite batch
            spriteBatch = (SpriteBatch)
                Game.Services.GetService(typeof(SpriteBatch));

            // Get the audio library
            audio = (AudioLibrary)
                Game.Services.GetService(typeof(AudioLibrary));

            meteors = new MeteorsManager(Game, ref actionTexture);
            Components.Add(meteors);

            player1 = new Player(Game, ref actionTexture, PlayerIndex.One,
                new Rectangle(323, 15, 30, 30));
            player1.Initialize();
            Components.Add(player1);

            player2 = new Player(Game, ref actionTexture, PlayerIndex.Two,
                new Rectangle(360, 17, 30, 30));
            player2.Initialize();
            Components.Add(player2);

            scorePlayer1 = new Score(game, font, Color.Blue);
            scorePlayer1.Position = new Vector2(10, 10);
            Components.Add(scorePlayer1);
            scorePlayer2 = new Score(game, font, Color.Red);
            scorePlayer2.Position = new Vector2(
                Game.Window.ClientBounds.Width - 200, 10);
            Components.Add(scorePlayer2);

            rumblePad = new SimpleRumblePad(game);
            Components.Add(rumblePad);

            powerSource = new PowerSource(game, ref actionTexture);
            powerSource.Initialize();
            Components.Add(powerSource);
        }
コード例 #4
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="game">Main game object</param>
        /// <param name="smallFont">Font for the menu items</param>
        /// <param name="largeFont">Font for the menu selcted item</param>
        /// <param name="background">Texture for background image</param>
        /// <param name="elements">Texture with the foreground elements</param>
        public StartScene(Game game, SpriteFont smallFont, SpriteFont largeFont,
                            Texture2D background, Texture2D elements)
            : base(game)
        {
            this.elements = elements;
            Components.Add(new ImageComponent(game, background,
                                            ImageComponent.DrawMode.Center));

            // Create the Menu
            string[] items = { "One Player", "Two Players", "Help", "Quit" };
            menu = new TextMenuComponent(game, smallFont, largeFont);
            menu.SetMenuItems(items);
            Components.Add(menu);

            // Get the current spritebatch
            spriteBatch = (SpriteBatch)Game.Services.GetService(
                                            typeof(SpriteBatch));

            // Get the audio library
            audio = (AudioLibrary)
                Game.Services.GetService(typeof(AudioLibrary));
        }
コード例 #5
0
ファイル: Game1.cs プロジェクト: Meshed/RockRainEnhanced
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(_graphics.GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), _spriteBatch);

            _audio = new AudioLibrary();
            _audio.LoadContent(this.Content);
            Services.AddService(typeof(AudioLibrary), _audio);

            helpBackgroundTexture = Content.Load<Texture2D>("helpbackground");
            helpForegroundTexture = Content.Load<Texture2D>("helpforeground");
            _helpScene = new HelpScene(this, helpBackgroundTexture, helpForegroundTexture);
            Components.Add(_helpScene);

            // Create the Start scene
            smallFont = Content.Load<SpriteFont>("menuSmall");
            largeFont = Content.Load<SpriteFont>("menuLarge");
            startBackgroundTexture = Content.Load<Texture2D>("startBackground");
            startElementsTexture = Content.Load<Texture2D>("startSceneElements");
            _startScene = new StartScene(this, smallFont, largeFont, startBackgroundTexture, startElementsTexture);
            Components.Add(_startScene);
            _creditScene = new CreditScene(this, smallFont, largeFont, startBackgroundTexture, startElementsTexture);
            Components.Add(_creditScene);

            actionElementsTexture = Content.Load<Texture2D>("rockrainenhanced");
            actionBackgroundTexture = Content.Load<Texture2D>("spacebackground");
            scoreFont = Content.Load<SpriteFont>("score");
            scoreFont = Content.Load<SpriteFont>("score");
            //_actionScene = new ActionScene(this, actionElementsTexture, actionBackgroundTexture, _scoreFont);
            //Components.Add(_actionScene);

            _joinScene = new JoinScene(this, largeFont, menuControllers);
            Components.Add(_joinScene);
            _startScene.Show();
            _activeScene = _startScene;
        }
コード例 #6
0
ファイル: Game1.cs プロジェクト: asherrd/Rock-Rain-Enhanced
        /// <summary>
        /// LoadContent will be called once per game and is the place to load all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), spriteBatch);

            // Load audio elements
            audio = new AudioLibrary();
            audio.LoadContent(Content);
            Services.AddService(typeof(AudioLibrary), audio);

            // Create help screens
            helpBackgroundTexture = Content.Load<Texture2D>("helpbackground");
            helpForegroundTexture = Content.Load<Texture2D>("helpforeground");
            helpScene = new HelpScene(this, helpBackgroundTexture, helpForegroundTexture);
            Components.Add(helpScene);

            // Create the Start Scene
            smallFont = Content.Load<SpriteFont>("menuSmall");
            largeFont = Content.Load<SpriteFont>("menuLarge");
            startBackgroundTexture = Content.Load<Texture2D>("startbackground");
            startElementsTexture = Content.Load<Texture2D>("startSceneElements");
            startScene = new StartScene(this, smallFont, largeFont,
                startBackgroundTexture, startElementsTexture);
            Components.Add(startScene);

            // Create the Action Scene
            scoreFont = Content.Load<SpriteFont>("score");
            actionElementsTexture = Content.Load<Texture2D>("rockrainenhanced");
            actionBackgroundTexture = Content.Load<Texture2D>("SpaceBackground");
            actionScene = new ActionScene(this, actionElementsTexture,
                actionBackgroundTexture, scoreFont);
            Components.Add(actionScene);

            // Starts the game
            startScene.Show();
            activeScene = startScene;
        }