Exemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="device">Current graphics device to use for rendering</param>
 public SelectLevelView(ContentManager content, GraphicsDevice device)
 {
     m_content = content;
     m_graphicsDevice = device;
     // Create a new SpriteBatch, which can be used to draw textures.
     m_spriteBatch = new SpriteBatch(m_graphicsDevice);
     // Load textures
     m_tileSheet = m_content.Load<Texture2D>("tilesheet");
     m_levelBackground = m_content.Load<Texture2D>("levelbackground");
     m_background = m_content.Load<Texture2D>("background");
     m_buttonPlayDown = m_content.Load<Texture2D>("playbuttondown");
     m_buttonPlayUp = m_content.Load<Texture2D>("playbuttonup");
     m_font = m_content.Load<SpriteFont>("default");
     // Retrieve screen size and calculate the camera viewport
     m_camera = new Camera(m_graphicsDevice.Viewport.Width, m_graphicsDevice.Viewport.Height);
     m_camera.SetScale(1, 1);
     m_camera.Translate(m_graphicsDevice.Viewport.Width / 2, m_graphicsDevice.Viewport.Height / 2);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="content">Content manager for loading resources</param>
 /// <param name="device">Current graphics device to use for rendering</param>
 public GameView(ContentManager content, GraphicsDevice device)
 {
     m_content = content;
     m_graphicsDevice = device;
     // Create a new SpriteBatch, which can be used to draw textures.
     m_spriteBatch = new SpriteBatch(m_graphicsDevice);
     // Load textures
     m_tileSheet = m_content.Load<Texture2D>("tilesheet");
     m_background = m_content.Load<Texture2D>("background");
     m_character = m_content.Load<Texture2D>("character");
     m_levelComplete = m_content.Load<Texture2D>("levelcomplete");
     m_levelCompleteNewRecord = m_content.Load<Texture2D>("levelcomplete_newrecord");
     m_font = m_content.Load<SpriteFont>("default");
     // Retrieve screen size and calculate the camera viewport
     m_camera = new Camera(m_graphicsDevice.Viewport.Width, m_graphicsDevice.Viewport.Height);
     m_camera.SetScale(1, 1);
     m_camera.Translate(m_graphicsDevice.Viewport.Width / 2, m_graphicsDevice.Viewport.Height / 2);
     // allocate particle system array
     m_particleSystem = new FireworkParticleSystem[MAX_NUMBER_OF_PARTICLE_SYSTEMS];
     // Nullify all fireworks, this will make them be created when level is complete.
     for (int n = 0; n < MAX_NUMBER_OF_PARTICLE_SYSTEMS; n++)
         m_particleSystem[n] = null;
 }