コード例 #1
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     graphics.PreferredBackBufferWidth = 900;  // set this value to the desired width of your window
     graphics.PreferredBackBufferHeight = 900;
     graphics.ApplyChanges();
     camera = new Camera();
 }
コード例 #2
0
ファイル: Explosion.cs プロジェクト: kn222gp/1DV437
        public Explosion(Texture2D explosionTexture, Camera camera)
        {
            _explosionTexture = explosionTexture;
            _camera = camera;
            timeElapsed = 0;

            frameWidth = _explosionTexture.Width / numFramesX;
            frameHeight = _explosionTexture.Height / numFramesY;
        }
コード例 #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);

            // TODO: use this.Content to load your game content here
            smokeTexture = Content.Load<Texture2D>("particlesmoke.png");
            splitterTexture = Content.Load<Texture2D>("spark.png");
            explosionTexture = Content.Load<Texture2D>("explosion.png");
            shockwaveTexture = Content.Load<Texture2D>("Shockwave.png");

            camera = new Camera(graphics.GraphicsDevice.Viewport);
            applicationView = new ApplicationView(smokeTexture, splitterTexture, explosionTexture, shockwaveTexture, camera, spriteBatch);
        }
コード例 #4
0
 public SplitterSystem(Texture2D spark, Texture2D secondSpark, SpriteBatch spriteBatch, Camera camera, float scale, Vector2 startLocation)
 {
     int i = 0;
     while(particles.Count < maxParticles)
     {
         if (i % 2 == 0)
         {
             particles.Add(new SplitterParticle(spark, rand, spriteBatch, camera, scale, startLocation, particlesLifeTime));
         }
         else
         {
             particles.Add(new SplitterParticle(secondSpark, rand, spriteBatch, camera, scale, startLocation, particlesLifeTime));
         }
         i++;
     }
 }
コード例 #5
0
        public ExplosionView(ContentManager content, Camera camera, SpriteBatch spriteBatch, Vector2 startLocation, float scale)
        {
            _content = content;
            _camera = camera;
            _spriteBatch = spriteBatch;

            splitterSecondTexture = _content.Load<Texture2D>("Spark2");
            splitterTexture = _content.Load<Texture2D>("Spark3");
            splitterSystem = new SplitterSystem(splitterTexture, splitterSecondTexture, _spriteBatch, _camera, scale, startLocation);

            smokeTexture = _content.Load<Texture2D>("Smoketest");
            smokeSystem = new SmokeSystem(smokeTexture, scale, startLocation);

            explosionTexture = _content.Load<Texture2D>("Fixforshittyschoolcomputer");
            explosion = new Explosion2d(_spriteBatch, explosionTexture, _camera, scale, startLocation);

            shockwaveTexture = _content.Load<Texture2D>("Shockwave2");
            shockwave = new shockwave(_spriteBatch, shockwaveTexture, _camera, scale, startLocation);
        }