Exemplo 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()
        {
            Logger.Log("Loading Content");
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new ZSpriteBatch(GraphicsDevice);

            GraphicsDispenser.LoadTextureData(Content);
            GraphicsDispenser.LoadFontData(Content);

            MessageLog.Font = GraphicsDispenser.GetFont("MessageBarFont");
            LoadData();
            StateFactory.Init(this);
            this.AddState(StateFactory.CreatePlayState(camera));
        }
Exemplo n.º 2
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 ZSpriteBatch(GraphicsDevice);

            DirectoryInfo di = new DirectoryInfo(Content.RootDirectory);

            foreach (FileInfo fi in di.GetFiles("*_bmp.xnb"))
            {
                GraphicsDispenser.addTexture(fi.Name.Remove(fi.Name.Length - 4), Content.Load <Texture2D>(Content.RootDirectory + "/" + fi.Name.Remove(fi.Name.Length - 4)));
            }

            font = Content.Load <SpriteFont>("Courier New");
            GraphicsDispenser.AddFont("Courier New", font);
            GraphicsDispenser.AddFont("Default", font);
            MessageLog.Font = font;
            LoadData();
            StateFactory.Init(this);
            this.AddState(StateFactory.CreatePlayState(camera));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Render map centered on focus with line of sight
        /// </summary>
        public void Draw(ZSpriteBatch spriteBatch)
        {
            UpdateLoS();

            // draw map
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    //spriteBatch.Draw(map.GetBlockAt(x, y).Graphic.Texture, new Vector2(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE), Color.White);
                    //player.Location.Coordinates.X + x, y);
                    //Coord coord = new Coord(focus.Location.Coordinates.X + x - Game.VISIBLE_MAP_OFFSET, focus.Location.Coordinates.Y + y - Game.VISIBLE_MAP_OFFSET);
                    Coord coord = this[x, y];
                    int   r     = GameMap.LightMap[x, y].R;
                    if (map.IsInMap(coord) && visiblePositions[x, y])
                    {
                        Texture2D texture = map.GetBlockAt(coord).Graphic.Texture;
                        spriteBatch.Draw(texture,
                                         new Rectangle(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE),
                                         GameMap.LightMap[coord.X, coord.Y]);
                    }
                    else if (map.IsInMap(coord))
                    {
                        Texture2D texture = map.GetBlockAt(coord).Graphic.Texture;
                        spriteBatch.DrawRectangle(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Color.Gray);
                        //spriteBatch.Draw(texture,
                        //                 new Rectangle(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE),
                        //                 Color.White);
                    }
                    else
                    {
                        spriteBatch.Draw(GraphicsDispenser.getTexture("void_bmp"),
                                         new Rectangle(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE),
                                         Color.White);
                    }
                }
            }
            this.ResetVision();
        }
Exemplo n.º 4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            Logger.Log("Loading Content");
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new ZSpriteBatch(GraphicsDevice);

            GraphicsDispenser.LoadTextureData(Content);
            GraphicsDispenser.LoadFontData(Content);

            MessageLog.Font = GraphicsDispenser.GetFont("MessageBarFont");
            LoadData();
            StateFactory.Init(this);
            this.AddState(StateFactory.CreatePlayState(camera));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Render map centered on focus with line of sight
        /// </summary>
        public void Draw(ZSpriteBatch spriteBatch)
        {
            UpdateLoS();

            // draw map
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    //spriteBatch.Draw(map.GetBlockAt(x, y).Graphic.Texture, new Vector2(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE), Color.White);
                    //player.Location.Coordinates.X + x, y);
                    //Coord coord = new Coord(focus.Location.Coordinates.X + x - Game.VISIBLE_MAP_OFFSET, focus.Location.Coordinates.Y + y - Game.VISIBLE_MAP_OFFSET);
                    Coord coord = this[x,y];
                    //int r = GameMap.LightMap[x, y].R;
                    if (map.IsInMap(coord) && visiblePositions[x, y])
                    {
                        Texture2D texture = map.GetBlockAt(coord).Graphic.Texture;
                        spriteBatch.Draw(texture,
                                         new Rectangle(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE),
                                         GameMap.LightMap[coord.X,coord.Y]);
                    }
                    else if (map.IsInMap(coord))
                    {
                        Texture2D texture = map.GetBlockAt(coord).Graphic.Texture;
                        spriteBatch.DrawRectangle(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Color.Gray);
                        //spriteBatch.Draw(texture,
                        //                 new Rectangle(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE),
                        //                 Color.White);
                    }
                    else
                    {
                        spriteBatch.Draw(GraphicsDispenser.GetTexture("void_bmp"),
                                         new Rectangle(x * Game.MAP_BLOCK_SIZE, y * Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE, Game.MAP_BLOCK_SIZE),
                                         Color.White);
                    }
                }
            }
            this.ResetVision();
        }