public LevelBuilder(Game1 game) { Game = game; CreateNewLevel(); _draggingSelectedObject = false; _currentLevelName = "new level"; Crosshair = new Crosshair(null); Crosshair.Debug = true; InputManager.AddKeyboardCallback(Keys.Space, RotateSelection, InputManager.InputState.OnInputDown); InputManager.AddMouseCallback(InputManager.MouseButtons.LeftButton, OnMouseDown, InputManager.InputState.OnInputDown); InputManager.AddMouseCallback(InputManager.MouseButtons.LeftButton, OnMouseUp, InputManager.InputState.OnInputUp); InputManager.AddKeyboardCallback(Keys.S, Keys.LeftControl, SaveLevel, InputManager.InputState.OnInputDown); InputManager.AddKeyboardCallback(Keys.O, Keys.LeftControl, OpenLevel, InputManager.InputState.OnInputDown); InputManager.AddKeyboardCallback(Keys.Delete, OnDelete, InputManager.InputState.OnInputDown); InputManager.AddKeyboardCallback(Keys.OemPlus, RescaleScreen, InputManager.InputState.OnInputDown); InputManager.AddKeyboardCallback(Keys.OemMinus, RescaleScreen, InputManager.InputState.OnInputDown); InputManager.AddMouseCallback(InputManager.MouseButtons.RightButton, OnRightMouseChange, InputManager.InputState.OnInputChange); InitOnChangeSizeCallbacks(); InitColorChangeCallbacks(); InitAddObjectCallbacks(); InitArrowKeyPressCallbacks(); }
private void initialize(string id) { Id = id; _children = new List<PhysicalObject2D>(); MenuElements = new List<Sprite>(); try { if (!TextureManager.HasTexture("crosshair")) TextureManager.LoadTexture("crosshair"); crosshair = new Crosshair(this); crosshair.Initialize(); } catch(NullReferenceException) { //Needed to ignore contentmanager in test } }