示例#1
0
        public EditableMap(int side, MouseRectangle mouse, List<Rectangle> tiles, List<string> tileIDs, int windowWidth, int windowHeight, bool XML, EditableSquare[][] grid)
        {
            this.side = side;
            this.mouse = mouse;
            mapGrid = new EditableSquare[side][];

            if (!XML)
            {
                for (int y = 0; y < side; y++)
                {
                    mapGrid[y] = new EditableSquare[side];
                    for (int x = 0; x < side; x++)
                    {
                        //mapGrid[y][x] = new EditableSquare(x * 32, y * 32, 32, 32, tiles[0], mouse, tileIDs[0]);
                        mapGrid[y][x] = new EditableSquare(x * 32, y * 32, 32, 32, tiles[0], mouse, tileIDs[0]);
                    }
                }

            }
            else
            {
                mapGrid = grid;
            }
            options = new TextureHolder[tiles.Count];

            for (int y = 0; y < tiles.Count; y++)
            {
                options[y] = new TextureHolder(windowWidth - 32, y * 32, 32, 32, tiles[y], mouse, tileIDs[y]);
            }
        }
示例#2
0
        private bool typingStarted; // Stated whether the user has started typing valid input for saving a file

        #endregion Fields

        #region Constructors

        public FileNameEntry(MouseRectangle mouse, OptionsMenu ops, Rectangle possible, string name)
        {
            menu = ops;

            if(possible == null)
            {
            rec = new Rectangle((menu.game.gameWidth / 2) - 100, (menu.game.gameHeight / 2) - 100, 200, 200);
            }
            else
            {
                rec = possible;
            }

            location = new Vector2((float)rec.X, (float)rec.Y);
            this.mouse = mouse;
            this.name = name;

            typingStarted = false; // The file name entry starts with no typing yet

            backspaceHeld = false;
            totalTime = 45;
            holdTime = 0;

            cursor = '|';
            cursorFlashTime = 33;
            cursorTime = 0;
        }
示例#3
0
 public SetUpBox(int size, int x, int y, OptionsMenu o, MouseRectangle m)
 {
     options = o;
         this.size = size;
         rec = new Rectangle(x, y, 32, 32);
         mouse = m;
         TileID = size + "";
         options = o;
 }
示例#4
0
 public MapSelectTile(int x, int y, int w, String sw, MouseRectangle m, GraphicsDevice graphicsDevice)
 {
     rec = new Rectangle(x, y, 32, 32); mouse = m; width = w;
     widthValue = sw; placeholder = new Texture2D(graphicsDevice, 30, 30);
     valuestringLocation = new Vector2(x, y);
 }
示例#5
0
 /// <summary>
 /// Constructs the textureHolder. 
 /// </summary>
 /// <param name="x">X value of holder's rectangle.</param>
 /// <param name="y">Y value of the holder's rectangle.</param>
 /// <param name="width">Width of holder's rectangle.</param>
 /// <param name="height">Height of the rectangle.</param>
 /// <param name="s">Texture to use.</param>
 /// <param name="m">MouseRectangle used in this program.</param>
 /// <param name="tile">TileID of sprite in this textureholder. Important.</param>
 public TextureHolder(int x, int y, int width, int height, Rectangle s, MouseRectangle m, String tile)
 {
     rec = new Rectangle(x, y, width, height); sourceRec = s; mouse = m; tileID = tile; spriteSheet = mouse.SpriteSheet;
 }
示例#6
0
 /// <summary>
 /// Constructor for editable grid of tiles, these tiles take textures from the mouse
 /// rather than giving them.
 /// </summary>
 /// <param name="x">X value of rectangle</param>
 /// <param name="y">Y value of rectangle</param>
 /// <param name="width">rectangle's width</param>
 /// <param name="height">rectangle's height</param>
 /// <param name="s">Source Rectangle to be loaded</param>
 /// <param name="m">MouseRectangle used by the program</param>
 public EditableSquare(int x, int y, int width, int height, Rectangle s, MouseRectangle m, string ID)
 {
     rec = new Rectangle(x, y, width, height); sourceRec = s; mouse = m; tileID = ID; spriteSheet = mouse.SpriteSheet;
 }
示例#7
0
        /// <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()
        {
            spriteSheet = Content.Load<Texture2D>("Sprites/Spritesheet");
            font = Content.Load<SpriteFont>("Fonts/Font");
            IsMouseVisible = true;
            mouse = new MouseRectangle(spriteSheet);
            menu = new OptionsMenu(this);
            for(int y = 0; y < 4; y++)
            {
                for(int x = 0; x < 5; x++)
                {
                    tiles.Add(new Rectangle(32 * x, (32 * y) + 1, 32, 31));
                }
            }

                tileIDs.Add( "grass");
                tileIDs.Add( "mountaingrass");
                tileIDs.Add( "hill");
                tileIDs.Add( "NWroadgrass");
                tileIDs.Add( "NWroadwater");
                tileIDs.Add( "NSroadgrass");
                tileIDs.Add( "WEroadgrass");
                tileIDs.Add( "NEroadgrass");
                tileIDs.Add( "SEroadgrass");
                tileIDs.Add( "SWroadgrass");
                tileIDs.Add( "NSroadwater");
                tileIDs.Add( "WEroadwater");
                tileIDs.Add( "NEroadwater");
                tileIDs.Add("SEroadwater");
                tileIDs.Add("SWroadwater");
                tileIDs.Add( "mountainsand");
                tileIDs.Add( "sand");
                tileIDs.Add( "water");
                tileIDs.Add("water");
                tileIDs.Add("water");

            base.Initialize();
        }