public SubTextureSelector(EditorScreen parentScreen, SpriteBatch spriteBatch, TileSelector tileSelector, int layerIndex, int subLayerIndex)
            : base(parentScreen, spriteBatch, new RectangleF())
        {
            this.Color = Microsoft.Xna.Framework.Graphics.Color.White;
            textureService = (ITextureService)Game.Services.GetService(typeof(ITextureService));
            this.isSelectingSubTexture = false;
            this.layerIndex = layerIndex;
            this.subLayerIndex = subLayerIndex;

            this.tileSelector = tileSelector;

            // We make the silly assumption that there is at least one Sheet loaded. he-he-he.
            this.selectingSheet = textureService.SheetsArray[0];

            // Generate our position based on the layer/subLayer-index we have.
            int padding = 10;
            int hzOffset = -(TileMap.TileWidth + padding);
            int oneDown = padding + TileMap.TileHeight;
            int vtOffset = layerIndex*(TileMap.SubLayerCount*oneDown + 2*padding) + (subLayerIndex * oneDown) + padding;
            Position = new Vector2(tileSelector.Bounds.Left + hzOffset, tileSelector.Bounds.Top + vtOffset);

            Microsoft.Xna.Framework.Rectangle rect =
                new Microsoft.Xna.Framework.Rectangle(0, 0, TileMap.TileWidth, TileMap.TileHeight);
            this.Bounds = new RectangleF(Position.X, Position.Y, rect.Width, rect.Height);
        }
        public DestructableToggler(EditorScreen parentScreen, SpriteBatch spriteBatch, RectangleF bounds, TileSelector tileSelector)
            : base(parentScreen, spriteBatch, bounds)
        {
            this.tileSelector = tileSelector;
            this.textureService = (ITextureService)Game.Services.GetService(typeof(ITextureService));

            destructable = false;
            conflict = false;
        }
        public WorldObjectMover(EditorScreen parentScreen, SpriteBatch spriteBatch, WorldObject worldObject)
            : base(parentScreen, spriteBatch, 
            new RectangleF(worldObject.ScreenPosition.X, worldObject.ScreenPosition.Y, MIN_BOUNDS.Width, MIN_BOUNDS.Height))
        {
            this.worldObject = worldObject;
            base.Draggable[0] = true; // Draggable with the left mouse button!

            removable = !(worldObject is Player);
        }
        public TileSelector(EditorScreen parentScreen, SpriteBatch spriteBatch, RectangleF bounds, TileMapLayer tileMapLayer, InputMonitor inputMonitor)
            : base(parentScreen, spriteBatch, bounds)
        {
            this.tileMapLayer = tileMapLayer;
            this.tilePropertyComponents = new List<ITilePropertyComponent>();
            this.inputMonitor = inputMonitor;

            this.selectButton = -1;
            this.selectedTileCoordinates = new List<int[]>();
            this.selectingTileCoordinates = new List<int[]>();
        }
        public EdgeToggler(EditorScreen parentScreen, SpriteBatch spriteBatch, RectangleF bounds, TileSelector tileSelector)
            : base(parentScreen, spriteBatch, bounds)
        {
            this.tileSelector = tileSelector;
            this.textureService = (ITextureService)Game.Services.GetService(typeof(ITextureService));

            // By default, solid:
            this.edges = new bool[4];
            edges[0] = edges[1] = edges[2] = edges[3] = true;
            edgesConflict = false;
        }
 public EditorUIComponent(EditorScreen parentScreen, SpriteBatch spriteBatch, RectangleF bounds)
     : base(parentScreen, spriteBatch, new Vector2(bounds.X, bounds.Y))
 {
     this.Color = Microsoft.Xna.Framework.Graphics.Color.White;
     this.mouseWasInside = false;
     this.bounds = bounds;
     this.heldTime = new int[3];
     this.insideTime = 0;
     this.draggable = new bool[3];
     this.dragging = new bool[3];
     this.didClickInside = new bool[3];
 }
        public WorldObjectPlacer(EditorScreen parentScreen, SpriteBatch spriteBatch, RectangleF bounds, World world)
            : base(parentScreen, spriteBatch, bounds)
        {
            this.index = 1;
            this.world = world;
            this.drawObjectCursor = true;

            object[] defaultParams = new object[] { World, SpriteBatch, new Vector2(bounds.X - 30, bounds.Y + 20) };

            int i = 0;
            worldObjects = new WorldObject[World.WorldObjectCtorInfos.Length];
            foreach (ConstructorInfo ci in World.WorldObjectCtorInfos)
            {
                worldObjects[i] = (WorldObject)World.WorldObjectCtorInfos[i].Invoke(defaultParams);
                ++i;
            }
        }
 public SaveButton(EditorScreen parentScreen, SpriteBatch spriteBatch, RectangleF bounds, World world)
     : base(parentScreen, spriteBatch, bounds)
 {
     this.world = world;
     this.textureService = (ITextureService)Game.Services.GetService(typeof(ITextureService));
 }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            fullScreenSettings = new ResolutionSettings(320, 240, this.GraphicsDevice.DisplayMode.Width, this.GraphicsDevice.DisplayMode.Height, true);

            //Initialization Logic

            // Set our XNA content directory
            Content.RootDirectory = "Content";

            // create our services
            CreateServices();
            #if !XBOX
            // create our screens
            Screen editorScreen = new EditorScreen(this, EditorScreen.ScreenName);
            this.screenList.Add(editorScreen);
            #endif
            Screen gameScreen = new GameScreen(this, GameScreen.ScreenName);
            this.screenList.Add(gameScreen);

            Screen titleScreen = new StoryboardScreen("TitleScreen", "Introduction", @"StoryboardXML\TitleScreenStoryboard");
            this.screenList.Add(titleScreen);

            Screen introScreen = new StoryboardScreen("Introduction", "Game", @"StoryboardXML\IntroductionStoryboard");
            this.screenList.Add(introScreen);

            Screen midpoint = new StoryboardScreen("MidPoint", "Game", @"StoryboardXML\MidPointStoryboard");
            this.screenList.Add(midpoint);

            Screen endScreen = new StoryboardScreen("Ending", "Game", @"StoryboardXML\EndingStoryboard");
            this.screenList.Add(endScreen);

            this.AddScreenToDisplay(titleScreen);

            resolutionService = new ScreenResolutionService(graphics, ScreenManager.WindowedSettings);
            this.Services.AddService(typeof(IScreenResolutionService), resolutionService);

            sb = new SpriteBatch(GraphicsDevice);

            //For profiling:
            /*
            this.IsFixedTimeStep = false;
            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.ApplyChanges();
            */

            // Initialize all components
            base.Initialize();
        }