private void LoadGriddy() { Stream gridDataStream = new FileStream("Content/Maps/demoLevel.tmx", FileMode.Open, FileAccess.Read); Stream tileBankStream = new FileStream("Content/Maps/tileBank.xml", FileMode.Open, FileAccess.Read); GridData gridData = GridData.NewFromStreamAndWorldPosition(gridDataStream, new Vector2(1, 0)); TileBank tileBank = TileBank.CreateFromSerializedData(tileBankStream, ScreenManager.Game.Content); gridDataStream.Position = 0; SerializedGridFactory gridFactory = SerializedGridFactory.NewFromData(gridDataStream, gridData, tileBank); level = Grid.NewGrid(gridData, gridFactory, DefaultGridDrawer.NewFromGridData(gridData, ScreenManager.Game.Content, Color.Black)); /* GraphicsDeviceManager.PreferredBackBufferWidth = gridData.BoundingBox.Width; graphics.PreferredBackBufferHeight = gridData.BoundingBox.Height; graphics.ApplyChanges(); */ }
void GameStart() { //myPic = Texture2D.FromStream(ScreenManager.GraphicsDevice, MainMenuScreen.myProfile.GetGamerPicture()); // Set the position of the camera in world space, for our view matrix. cameraPosition = new Vector3(0.0f, 0.0f, 5000.0f); graphicsDevice = ScreenManager.GraphicsDevice; thisViewport = graphicsDevice.Viewport; a1 = new Asteroids(thisViewport, asteroidsModel, cameraPosition); a2 = new Asteroids(thisViewport, asteroidsModel, cameraPosition); a3 = new Asteroids(thisViewport, asteroidsModel, cameraPosition); FirstPlayer = new Player(thisViewport, Player1Texture, new Vector2(thisViewport.Width / 2, thisViewport.Height / 2), BulletTexture, PlayerIndex.One); EntityManager.Add(FirstPlayer); PlayerStatus.Reset(); ParticleManager = new ParticleManager<ParticleState>(1024 * 20, ParticleState.UpdateParticle); Pixel = new Texture2D(ScreenManager.GraphicsDevice, 1, 1); Pixel.SetData(new[] { Color.White }); Vector2 gridSpacing = new Vector2((float)Math.Sqrt(thisViewport.Width * thisViewport.Height / 1600)); GridManager = new Grid(thisViewport.Bounds, gridSpacing); enemySpawner = new EnemySpawner(thisViewport); }