Esempio n. 1
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
			_floorTex = Content.Load<Texture2D> ("floor");
			_wallTex = Content.Load<Texture2D> ("wall");
			_playerTex = Content.Load<Texture2D> ("player");
			_doorTex = Content.Load<Texture2D> ("door");

			_level = Level.Generate (101, 101);
			_level.Player = new GameObject ();
			_player = _level.Player;

			var emptyTile = _level.GetRandomEmptyTile ();
			_player.Position = new Vector2 (emptyTile.CellData.X, emptyTile.CellData.Y);

			_level.UpdatePlayerFov ();

			Level.Camera.SpriteWidth = 64;
			Level.Camera.SpriteHeight = 64;

			Level.Camera.CenterOn (emptyTile);

            _world = new RTWorld(5, spriteBatch);
            var entity = _world.CreateEntity();

            _world.EntityMasks[entity].ClearAll();
            _world.SpatialComponents[entity].Position = new Vector2(50, 50);
		    _world.SpriteComponents[entity].Texture = _playerTex;
		    _world.SpriteComponents[entity].Tint = Color.Red;
		}
Esempio n. 2
0
		public RoguelikeGame ()
		{
			graphics = new GraphicsDeviceManager (this);
			graphics.PreferredBackBufferWidth = 1280;  // set this value to the desired width of your window
			graphics.PreferredBackBufferHeight = 720;   // set this value to the desired height of your window
			graphics.ApplyChanges ();
			Content.RootDirectory = "Content";	            
			//graphics.IsFullScreen = true;
			_inputState = new InputState ();
            _testGO = new GameObject();
            //_testGO.AttachComponent(new SpatialComponent(Vector2.One));


            
		}