[Libgdx] Tiles loaded from text file upside down

Hi, I’m trying to load a tilemap I made from a text file. It gets loaded correctly, but It renders the map upside down. I tried to switch up names in order to get everything to flip, but that didn’t work out well. I also attempted to set my OrthoGraphic camera to ortho and have it flipped, but when I render fonts, their not able to be flipped like textures. I’m hoping for help on fixing this so I don’t have to resort to have hardcoded arrays replace map files. Here’s some code I use to create the map:

private void loadMap(String s) {
        try {
            FileHandle file = Gdx.files.internal(s);
            BufferedReader br = new BufferedReader(file.reader());
             
            int mapWidth = Integer.parseInt(br.readLine());
            int mapHeight = Integer.parseInt(br.readLine());
            
            tiles = new Tile[mapHeight][mapWidth];
            
            String del = "\\s+";
             
            for(int row = 0; row < mapHeight; row++) {
                String line = br.readLine();
                String[] tokens = line.split(del);
                
                for(int col = 0;col < mapWidth; col++) {
                    tiles[row][col] = new Tile(col * size, row * size, size, Integer.parseInt(tokens[col]));
                }
            }                 
            br.close();        
        } catch(Exception e) {e.printStackTrace();}
         
    }

And then it is render as so…

public void render(ShapeRenderer sr, SpriteBatch g) {
    	
    	for(int i = 0; i < tiles.length; i++) {
    		for(int j = 0; j <tiles[i].length; j++) {
    			Tile t = tiles[i][j];
    			t.render(sr, g);
    		}
    	}
    	
    }

Here’s an example of what a basic map file looks like as well

21
5
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Hope you can help :smiley: