コード例 #1
0
        public void Draw(MapLayer layer, int mapx, int mapy)
        {
            Rectangle onScreen = getScreenMapPart(layer, mapx, mapy);

            for (int x = onScreen.Left; x < onScreen.Right; x++)
            {
                for (int y = onScreen.Top; y < onScreen.Bottom; y++)
                {
                    if (!getTile(x, y).isEmpty)
                    {
                        layer.Draw(tileSet.Texture, new Rectangle(mapx * w * Tile.STANDARD_GTILE_WIDTH + x * tileSet[mapTiles[x, y].ID].Width, mapy * h * Tile.STANDARD_GTILE_HEIGHT + y * tileSet[mapTiles[x, y].ID].Height, tileSet[mapTiles[x, y].ID].Width, tileSet[mapTiles[x, y].ID].Height), tileSet[mapTiles[x, y].ID].Source, Color.White, 0f, Vector2.Zero, mapTiles[x, y].Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1f);
                    }

                    if (getTile(x, y).HasEvents)
                    {
                        Engine.Event.EventTile e = (Engine.Event.EventTile)getTile(x, y);
                        layer.Draw(tileSet.Texture, new Rectangle(mapx * w * Tile.STANDARD_GTILE_WIDTH + x * tileSet[mapTiles[x, y].ID].Width, mapy * h * Tile.STANDARD_GTILE_HEIGHT + y * tileSet[mapTiles[x, y].ID].Height, tileSet[mapTiles[x, y].ID].Width, tileSet[mapTiles[x, y].ID].Height), tileSet[mapTiles[x, y].ID].Source, new Color(128, 128, 128, 128), 0f, Vector2.Zero, mapTiles[x, y].Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.95f);
                        layer.DrawString(layer.World.Game.DefaultFont, e.Events[0].DisplayName, new Vector2(mapx * w * Tile.STANDARD_GTILE_WIDTH + x * tileSet[mapTiles[x, y].ID].Width, mapy * h * Tile.STANDARD_GTILE_HEIGHT + y * tileSet[mapTiles[x, y].ID].Height), Color.Gray, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.9f);
                    }

                    //sb.Draw(ts, new Rectangle(x * 32, y * 32, 32, 32), new Rectangle(mapTiles[x, y].ID * 32, 0, 32, 32), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 1f);
                }
            }
        }
コード例 #2
0
        public void render(Engine.Entity.Entity entity)
        {
            MapLayer entLay = getEntityLayer();

            entity.Draw(entLay);
        }