public LoadButton(OptionsMenu op) { menu = op; rec = new Rectangle((menu.game.gameWidth / 2) - 100, menu.game.gameHeight - 100, 100, 20); drawString = new Vector2((float)(rec.X), (float)(rec.Y)); mouse = menu.game.mouse; DirectoryInfo d = new DirectoryInfo(Environment.CurrentDirectory); while (d.ToString() != "dynasty") { d = d.Parent; } string p = d.FullName + @"\GameData\Maps\"; d = new DirectoryInfo(p); FileInfo[] files = d.GetFiles(); int x = 0; filenames = new FileNameEntry[files.Length]; foreach(FileInfo file in files) { Rectangle rect = new Rectangle(menu.game.gameWidth/2, x*30, 100, 30); filenames[x] = new FileNameEntry(menu.game.mouse, menu, rect , file.Name); x++; } }
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; }
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; }
public SaveButton(OptionsMenu op) { menu = op; rec = new Rectangle(menu.game.gameWidth / 2, menu.game.gameHeight - 100, 100, 20); psuedotextBox = new FileNameEntry(mouse, menu,new Rectangle(menu.game.gameWidth/2, menu.game.gameHeight/2, 100,100), "EnterName"); }
public XMLRead(OptionsMenu op) { menu = op; }
/// <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(); }