コード例 #1
0
ファイル: XmasPuzzle.cs プロジェクト: allanfrost/xmaspuzzle
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            if (!_initialized)
            {
                _initialized = true;

                _spriteBatchHelper = CreateSpriteBatchHelper();
            }

            _spriteBatchHelper.Begin();

            _snowFlakesLayer2.ForEach(s =>
                                          {
                                              var alpha = 0.4f;
                                              if (s.Position.Y > ScreenHeight - 300)
                                                  alpha = 0.4f*(ScreenHeight-s.Position.Y)/300;

                _spriteBatchHelper.Draw(s, Color.White * alpha, 0.6f, 0, 0);

            });
            _snowFlakesLayer1.ForEach(s =>
                                    {
                                        var alpha = 0.6f;
                                        if (s.Position.Y > ScreenHeight - 300)
                                            alpha = 0.6f * (ScreenHeight - s.Position.Y) / 300;

                                        _spriteBatchHelper.Draw(s, Color.White * alpha, 0.8f, 0, 0);

                                    });

            _spriteBatchHelper.End();
        }
コード例 #2
0
ファイル: Puzzle.cs プロジェクト: allanfrost/xmaspuzzle
        public override void Draw(GameTime gameTime)
        {
            if (!_initialized)
            {

                _spriteBatchHelper = CreateSpriteBatchHelper();

                PuzzleBackground.Position = Center;

                InitializePuzzleBrickPositions();

                _initialized = true;
            }

            ClearScreen(Color.Teal);

            _spriteBatchHelper.Begin();

            _spriteBatchHelper.Draw(PuzzleBackground, Color.White,0);

            PuzzleBricks.Where(x => x.Position==x.TargetLocation).ToList().ForEach(brick => _spriteBatchHelper.Draw(brick, Color.White, 0));

            PuzzleBricks.Where(x => x.Position!=x.TargetLocation).ToList().ForEach(brick =>
                                     {
                                         if (_carriedBrick != null && brick.Id != _carriedBrick.Id && brick.Position != brick.TargetLocation)
                                             _spriteBatchHelper.Draw(brick, Color.White * brick.Alpha, 0);
                                         else
                                             _spriteBatchHelper.Draw(brick, Color.White, 0);

                                     });

            _spriteBatchHelper.End();
        }
コード例 #3
0
ファイル: IntroScreen.cs プロジェクト: allanfrost/xmaspuzzle
        public override void Draw(GameTime gameTime)
        {
            if (!_initialized)
            {
                _initialized = true;

                _spriteBatchHelper = CreateSpriteBatchHelper();
            }

            ClearScreen(Color.Teal);

            _spriteBatchHelper.Begin();

            _puzzleButtons.ForEach(sprite =>
                                       {
                                           _spriteBatchHelper.Draw(sprite,Color.White, 1f,0, -100);

                                       });

            _spriteBatchHelper.End();
        }