// Constructor public GUIManager(World world, ViewportManager viewportManager, GraphicsDevice graphicsDevice) { spriteBatch = new SpriteBatch(graphicsDevice); controls = new List <Control>(); this.world = world; inputController = new InputController(world, viewportManager, graphicsDevice); AddControl(new Button(new Rectangle(10, 10 + controls.Count * (10 + 30), 150, 30), "BRK"), (control, manager) => { System.Console.WriteLine("BREAKPOINT"); }); for (int i = 0; i < 5; i++) { Button speedButton = new Button(new Rectangle(10 + (i * (10 + 50)), 10 + (controls.Count - i) * (10 + 30), 50, 30), (i == 0 ? "*" : i + "x")); speedButton.SetUserInfo("targetSpeed", (float)i); if (i == 1) { speedButton.SetActive(true); } AddControl(speedButton, (button, manager) => { world.SetGameSpeed((float)button.UserInfo["targetSpeed"]); manager.Controls.ForEach((ctr) => { Button b = (Button)ctr; if (b != null && b != button && b.UserInfo.ContainsKey("targetSpeed")) { b.SetActive(false); } }); button.SetActive(true); }); } }
// Constructor public InputController(World world, ViewportManager viewportManager, GraphicsDevice graphicsDevice) { this.world = world; this.viewportManager = viewportManager; spriteBatch = new SpriteBatch(graphicsDevice); selectedObjects = new List <ISelectable>(); targetsSelected = new List <ISelectable>(); }
public WorldRenderer(World world, ViewportManager viewportManager, GraphicsDevice graphicsDevice) { this.world = world; this.viewportManager = viewportManager; spriteBatch = new SpriteBatch(graphicsDevice); ShapeManager.Setup(graphicsDevice); lightTexture = AssetManager.GetAsset <Texture2D>("lightmask"); lightEffect = AssetManager.GetAsset <Effect>("fx_world"); lightsTarget = new RenderTarget2D(spriteBatch.GraphicsDevice, viewportManager.Viewport.Width, viewportManager.Viewport.Height); mainTarget = new RenderTarget2D(spriteBatch.GraphicsDevice, viewportManager.Viewport.Width, viewportManager.Viewport.Height); }