internal void UpdateAndDraw(double a_elapsedTimeTotalSeconds, SpriteBatch m_spriteBatch, Camera m_camera, float displaceMentY) { for (int i = 0; i < MAX_PARTICLES; i++)//Går igenom alla partiklar { //Update particle speed and position m_particles[i].Update(a_elapsedTimeTotalSeconds); //Get view coordinates of particle Vector2 particleModelPositions = m_particles[i].getPosition(); Vector2 viewCoordinates = m_camera.translateCoordinates(m_particles[i].getPosition(), 960, 640, displaceMentY); //Create destination rectangle Rectangle dest = new Rectangle((int)viewCoordinates.X, (int)viewCoordinates.Y, 10, 10); Rectangle dest2 = new Rectangle(320,450, 32, 32); //Print particle m_spriteBatch.Draw(m_particle, dest, Color.White); m_spriteBatch.DrawString(font, "Particle 1 Y: " + viewCoordinates.Y.ToString(), new Vector2(240, 500), Color.White); m_spriteBatch.DrawString(font, "Particle 1 X: " + viewCoordinates.X.ToString(), new Vector2(240, 540), Color.White); } }
public MainView(GraphicsDevice a_graphicsDevice) { //Members initialization m_spriteBatch = new SpriteBatch(a_graphicsDevice); m_windowWidth = a_graphicsDevice.Viewport.Width; m_windowHeight = a_graphicsDevice.Viewport.Height; m_camera = new Camera(); }