public void LoadContent(ContentOrganizer content) { this.content = content; //Load image(s) background background.LoadContent(); //Load content of things foreach (var thing in things) { thing.LoadContent(); } }
public void LoadContent(ContentOrganizer content) { this.content = content; //Add buttons controls = new List <Control.Control_Abstract>(); Texture2D rectTexture = content.textures["rect,200,80"]; SpriteFont font = content.fonts["consolas"]; //controls.Add(new Control.Button(rectTexture, font, 100, 100, 200, 80, "Sauvegarder", delegate () { Save(Environment.CurrentDirectory + @"\TEST.bin"); })); //controls.Add(new Control.Button(rectTexture, font, 100, 200, 200, 80, "Charger", delegate () { Load(Environment.CurrentDirectory + @"\TEST.bin"); })); //controls.Add(new Control.TextBox(rectTexture, font, 100, 300, 206, 30, "textbox with a very long text that cannot be displayed")); //controls.Add(new Control.TextBox(rectTexture, font, 100, 400, 206, 30, "dsfsdfqs")); }
protected override void Initialize() { content = new ContentOrganizer(GraphicsDevice); //Prepare what texture and fonts will be loaded texturesToLoad = new string[] { "collines1", "collines2", "collines3", "collines4", "collines5", "collines6", "player", "dirt" }; fontsToLoad = new string[] { "arial", "consolas" }; IsMouseVisible = true; rnd = new Random(); //Window size graphics.PreferredBackBufferWidth = 1200; graphics.PreferredBackBufferHeight = 800; //graphics.PreferredBackBufferWidth = 800; //graphics.PreferredBackBufferHeight = 600; graphics.ApplyChanges(); //FPS IsFixedTimeStep = true; TargetElapsedTime = TimeSpan.FromSeconds(1d / 60d); //FPS counter frameCounter = new FrameCounter(); //Create world world = new World(Window.ClientBounds, 150, 25, rnd); int visibleBlocsHorizontaly = world.wdowDimensions.Width / Bloc.SIZE + 1; int visibleBlocsVerticaly = world.wdowDimensions.Height / Bloc.SIZE + 1; world.debugGrid = Tools.GenerateGridTexture2D(GraphicsDevice, visibleBlocsHorizontaly, visibleBlocsVerticaly, Bloc.SIZE, Color.White); world.debugRectangleBackground = Tools.GenerateFilledRectangleTexture2D(GraphicsDevice, 200, 130, Color.White); editor = new Editor(world); base.Initialize(); }