예제 #1
0
파일: GameView.cs 프로젝트: shjelm/1DV437
 public GameView(SpriteBatch spriteBatch, Texture2D texture, Camera camera)
 {
     this.spriteBatch = spriteBatch;
     this.texture = texture;
     this.cam = camera;
     //explosionSystem = new ExplosionSystem(modelStartPosition);
     explosion = new Explosion(modelStartPosition);
 }
예제 #2
0
파일: Explosion.cs 프로젝트: shjelm/1DV437
        internal void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D texture)
        {
            Vector2 viewPosition = camera.GetVisualPositions(position);
            Vector2 explosionViewSize = camera.GetVisualPositions(explosionSize);

            Rectangle explosionRect = new Rectangle(frameX * size, frameY * size, size, size);
            Rectangle rect = new Rectangle((int)viewPosition.X, (int)viewPosition.Y, (int)explosionViewSize.X, (int)explosionViewSize.Y);

            spriteBatch.Draw(texture, rect, explosionRect, Color.White);
        }
예제 #3
0
파일: Game1.cs 프로젝트: shjelm/1DV437
        /// <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>("explosion");

            cam = new Camera(400, 400);

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

            // TODO: use this.Content to load your game content here
        }