<commit_before>package engine.visuals;

import javafx.scene.Group;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundImage;
import javafx.scene.layout.Pane;
import model.exceptions.SaveLoadException;
import util.SaveLoadUtility;


/**
 * A scrollablebackground pane for the game
 * 
 * @author John
 *
 */
public class ScrollableBackground extends Pane
{
    private double myXScrollSpeed, myYScrollSpeed;
    private double myXBoundary, myYBoundary;

    // private double myWidth, myHeight;

    ScrollablePane myPane;

    /**
     * Create the scrollable background
     * 
     * @param screenWidth
     * @param screenHeight
     * @param xBoundary the maximum X value that can be scrolled to
     * @param yBoundary the maximum Y value that can be scrolled to
     */
    public ScrollableBackground (double xBoundary, double yBoundary, ScrollablePane pane, String backgroundURI)
    {
        this.prefWidthProperty().bind(pane.prefWidthProperty());
        this.prefHeightProperty().bind(pane.prefHeightProperty());
        myPane = pane;
        this.myXBoundary = xBoundary;
        this.myYBoundary = yBoundary;
        this.setMinSize(xBoundary, yBoundary);
        
        tileBackground(backgroundURI);

        setStyle("-fx-border-color: blue;"); // used for testing to see the edge of the map

    }

    public void tileBackground (String backgroundURI) {
        Image im = null;
        ImageView iv = null;
        try {
            im = SaveLoadUtility.loadImage(backgroundURI);
            iv = new ImageView(im);
            iv.setScaleX(3);
            iv.setScaleY(3);
            
        }
        catch (SaveLoadException e) {
        }
        if (im != null) {
            this.setBackground(new Background(new BackgroundImage(im, null, null, null, null)));
        }
    }

    /**<commit_msg>deleting test code<commit_after>package engine.visuals;

import javafx.scene.Group;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundImage;
import javafx.scene.layout.Pane;
import model.exceptions.SaveLoadException;
import util.SaveLoadUtility;


/**
 * A scrollablebackground pane for the game
 * 
 * @author John
 *
 */
public class ScrollableBackground extends Pane
{
    private double myXScrollSpeed, myYScrollSpeed;
    private double myXBoundary, myYBoundary;

    // private double myWidth, myHeight;

    ScrollablePane myPane;

    /**
     * Create the scrollable background
     * 
     * @param screenWidth
     * @param screenHeight
     * @param xBoundary the maximum X value that can be scrolled to
     * @param yBoundary the maximum Y value that can be scrolled to
     */
    public ScrollableBackground (double xBoundary, double yBoundary, ScrollablePane pane, String backgroundURI)
    {
        this.prefWidthProperty().bind(pane.prefWidthProperty());
        this.prefHeightProperty().bind(pane.prefHeightProperty());
        myPane = pane;
        this.myXBoundary = xBoundary;
        this.myYBoundary = yBoundary;
        this.setMinSize(xBoundary, yBoundary);
        
        tileBackground(backgroundURI);

        setStyle("-fx-border-color: blue;"); // used for testing to see the edge of the map

    }

    public void tileBackground (String backgroundURI) {
        Image im = null;
        try {
            im = SaveLoadUtility.loadImage(backgroundURI);
        }
        catch (SaveLoadException e) {
        }
        if (im != null) {
            this.setBackground(new Background(new BackgroundImage(im, null, null, null, null)));
        }
    }

    /**
{'fraction_non_alphanumeric': 0.09044414535666218, 'fraction_numerical': 0.0005383580080753701, 'mean_word_length': 2.7611336032388665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '815254', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1035, 'n_words': 274}