public void update(){
		for(Button b : buttons){
			b.update(mouse.getX(), mouse.getY(), mouse.getButton());
			if(b.pressed() && b.getId() == 0){
				String username = "";
				String password = "";
				boolean accepted = false;
				for(TextField tf : textFields){
					if(tf.getText().length() > 0){
						accepted = true;
						if(tf.getId() == 0) username = tf.getText();
						else if(tf.getId() == 1) password = tf.getText();
					}
				}
				
				if(accepted){
					if(!checkUser(username, password)) System.out.println("Couldn't find those users, carrying on anyway.");
					else System.out.println("Logged in with: " + username + " & " + password + ".");
					game.switchState(2);
				}
				else error = "Please enter username and password.";
			}
		}
		
		for(TextField tf : textFields){
			tf.update();
			if(mouse.getButton() == 1 && tf.collides(mouse.getX(), mouse.getY())) tf.setSelected(true);
			if(mouse.getButton() == 1 && !tf.collides(mouse.getX(), mouse.getY())) tf.setSelected(false);
			if(mouse.getButton() == 3 && tf.isSelected()) tf.setSelected(false);
		}
		
	}