Ejemplo n.º 1
0
 public GameView(SpriteBatch spriteBatch, Texture2D texture, Camera camera)
 {
     this.spriteBatch = spriteBatch;
     this.texture = texture;
     this.cam = camera;
     splitterSystem = new SplitterSystem(modelStartPosition);
 }
Ejemplo n.º 2
0
 public void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D texture)
 {
     for (int i = 0; i < MAX_PARTICLES; i++)
     {
         particles[i].Draw(spriteBatch, camera, texture);
     }
 }
Ejemplo n.º 3
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);
            texture = Content.Load<Texture2D>("spark");

            cam = new View.Camera(400,400);

            view = new View.GameView(spriteBatch, texture, cam);

            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 4
0
        internal void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D texture)
        {
            Vector2 viewPosition = camera.GetVisualPositions(position);

            Vector2 visualRadius = camera.GetVisualPositions(radius);

            Rectangle rect = new Rectangle((int)viewPosition.X, (int)viewPosition.Y, (int)visualRadius.X, (int)visualRadius.Y);

            float t = timeLivedSeconds/maxLifeTime;
            if (t > 1.0)
            {
                t = 1.0f;
            }
            float endValue = 0.0f;
            float startValue = 1.0f;
            float visibility = endValue * t + (1.0f - t) * startValue;

            Color color = new Color(visibility, visibility, visibility, visibility);

            spriteBatch.Draw(texture, rect, color);
        }