/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { spriteBatch = new SpriteBatch(Game.GraphicsDevice); levelBuilder = new LevelBuilder(); _collisionHelper = new CollisionHelper(); buffer = 0; base.Initialize(); }
public MapEditor() { InitializeComponent(); //Find config file IniFile.SetConfigurationPath( @".\MapEditor.ini"); //Load the editor options editorOptions = new EditorOptions(); //Load the entity creator creator = new EntityCreator(objectTree.Nodes); //Create a new xna window to render into xna = new XnaForms(pnlOutput.Handle, pnlOutput.Width, pnlOutput.Height); xna.Content.RootDirectory = @"Content"; camera = new Camera(); spriteBatch = new SpriteBatch(xna.GraphicsDevice); //Adjust the current size previousSize = Size; levelBuilder = new LevelBuilder(); ScreenHeight = 800; gameStateManager = new GameStateManager(xna.Content, false); movementManager = new MovementManager(); gameStateManager.setMovementManager(movementManager); selectedItems = new List<WorldObject>(); closeHandeler += GetMapProperties; //Mouse handeling initializing mousePosition = Vector2.Zero; prevMousePosition = Vector2.Zero; mouseButtonDown = MouseButtons.None; Level level = new Level(); gameStateManager.Level = level; LoadTextures(); RenderFrame(); }