public GameStateDungeonGame(Game game, IUIManager ui) : base(CreateDrawingService(game)) { this.ui = ui; gd = new DungeonGameData(); var contentLoader = new MonoGameContentLoader(game.Content); var textureOps = new MonoGameTextureOperations(game.GraphicsDevice); var tileProducer = new MonoGameTileProducer(textureOps); var renderFactory = new DefaultGameRenderCallbackFactory <Nothing>(game); var tileSet = new DungeonTileSet <MonoGameTile, XnaTexture, XnaRawTexture>(contentLoader, tileProducer); var config = new GameRenderingConfig(RenderType.IsoDiamond, new Range(0, gd.Map.Width), new Range(0, gd.Map.Height)); var grf = new DungeonGameRenderingFactory <MonoGameTile>(config, gd, tileSet); gameRendering = new GameRendering(game, grf.RenderingConfig, grf.RenderControl); gameRendering.AddLayers(grf.Create(renderFactory, Nothing.Instance, Nothing.Instance)); gameRendering.TrackScreenSize(); gameRendering.DrawOrder = -10; overlay = new DebugOverlayRenderer(game) { DrawOrder = -5 }; var navigationUI = new NavigationUI(ui, gameRendering); rootComponent = navigationUI.RootComponent; }
StrategyGameTileSet <MonoGameTile> CreateTileSet(Game game, MonoGameTileProducer tileProducer) { var contentLoader = new MonoGameContentLoader(game.Content); var tp = new TexturePackLoader <MonoGameTile, XnaTexture, XnaRawTexture>(contentLoader, tileProducer, game.Content.RootDirectory).Read("Tiles/Civ/tiles.xml"); var rt = tp.TextureType == TextureType.Grid ? RenderType.Grid : RenderType.IsoDiamond; var tileSet = new StrategyGameTileSet <MonoGameTile>(tp, rt); tileSet.InitializeBlendingRules(gd.Rules); return(tileSet); }
public GameStateStrategyGame(Game game, IUIManager ui) : base(new BatchedDrawingService(game)) { this.ui = ui; gd = new StrategyGameData(); var textureOperations = new MonoGameTextureOperations(game.GraphicsDevice); var tileProducer = new MonoGameTileProducer(textureOperations); var tileSet = CreateTileSet(game, tileProducer); var grf = CreateRenderingFactory(gd, tileSet, tileProducer, textureOperations); var mapComponent = new Group(ui.UIStyle) { Anchor = AnchoredRect.Full }; gameRendering = new GameRendering(game, grf.RenderingConfig, grf.RenderControl); gameRendering.AddLayers(grf.Create(new DefaultGameRenderCallbackFactory <Nothing>(game))); gameRendering.AddLayer(new CityBarRenderingFactory(grf.RenderingConfig, gd, tileSet.TileSize, mapComponent).CreateCityBarRenderer()); gameRendering.TrackScreenSize(new Insets(10, 10, 10, 10)); gameRendering.CenterPointInMapCoordinates = gd.Settlements[1].Location; gameRendering.DrawOrder = -10; overlay = new DebugOverlayRenderer(game) { DrawOrder = -5 }; var navigationUI = CreateNavigationUi(ui); rootContent = new Group(ui.UIStyle) { mapComponent, navigationUI.RootComponent }; }
StrategyGameRenderingFactory <MonoGameTile, XnaTexture, Color> CreateRenderingFactory(StrategyGameData gameData, StrategyGameTileSet <MonoGameTile> tileSet, MonoGameTileProducer tileProducer, MonoGameTextureOperations textureOperations) { var config = new GameRenderingConfig(tileSet.RenderType, new Range(0, gameData.TerrainWidth), new Range(0, gameData.TerrainHeight)); return(new StrategyGameRenderingFactory <MonoGameTile, XnaTexture, Color>(config, gameData, tileSet, tileProducer, textureOperations)); }