Пример #1
0
        public Console(GraphicsDevice graphicsDevice, int w, int h)
        {
            box = new Texture2D(graphicsDevice, w, (h/3));
            text = new TextObject(m_text, Game1.font, Color.Black, false);
            Color[] data = new Color[w * (h/3)];
            for (int i = 0; i < data.Length; ++i) data[i] = Color.White * 0.2f;
            box.SetData(data);
            text.Position = Vector2.Zero + new Vector2(0, 120);

            activated = false;

            m_text = "";
        }
Пример #2
0
        /// <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);
            font = Content.Load<SpriteFont>("Courier New");
            snapshot = new StateSnapshot();
            soundPlayer.InitSoundLibrary(Content);
            scoreLabel = new TextObject("Score: " + score, font, Color.Black, false);

            t_ball = this.Content.Load<Texture2D>("Ball");
            t_block = this.Content.Load<Texture2D>("Block");
            t_paddle = this.Content.Load<Texture2D>("Paddle");
            WinScreen = this.Content.Load<Texture2D>("WinScreen");
            LoseScreen = this.Content.Load<Texture2D>("LoseScreen");
            StartScreen = this.Content.Load<Texture2D>("StartScreen");
            HighScoreScreen = this.Content.Load<Texture2D>("HighScoreScreen");

            paddle = new Sprite(t_paddle, new Vector2(0, graphics.GraphicsDevice.Viewport.Height - t_paddle.Height));
            paddle.PhysType = PhysicsTransform.PhysicsType.Solid;

            controller = new SpriteController(paddle);

            console = new Assgn01.Console(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height);

            ball = new Sprite(t_ball,
                                    new Vector2(graphics.GraphicsDevice.Viewport.Width / 2 - t_ball.Width, graphics.GraphicsDevice.Viewport.Height / 2 - t_ball.Height)
                                    , PhysicsTransform.PhysicsType.Elastic, true);
            ball.Velocity = new Vector2(0, 0.3f);

            gameStarted = false;
            gameOver = true;
            soundPlayer.LoopMusic("BG1");
            //ResetGame();
        }