mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-11-04 13:19:17 +00:00 
			
		
		
		
	finish format text
This commit is contained in:
		@@ -16,6 +16,7 @@ import com.badlogic.gdx.maps.tiled.TmxMapLoader;
 | 
			
		||||
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
 | 
			
		||||
import com.badlogic.gdx.math.Vector2;
 | 
			
		||||
 | 
			
		||||
import Entity.Character.Direction;
 | 
			
		||||
import Entity.Player;
 | 
			
		||||
import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
 | 
			
		||||
import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
			
		||||
@@ -160,7 +161,7 @@ public class ScreenMap extends RenderingScreen{
 | 
			
		||||
				try { Door.nextMap = mapProperties.get("nextMap").toString(); } catch (Exception e) { }
 | 
			
		||||
				try { Door.nextX = Integer.parseInt(mapProperties.get("nextX").toString()); } catch (Exception e) { }
 | 
			
		||||
				try { Door.nextY = Integer.parseInt(mapProperties.get("nextY").toString()); } catch (Exception e) { }
 | 
			
		||||
				try { Door.nextDirection = Door.nextDirection.valueOf(mapProperties.get("nextDirection").toString()); } catch (Exception e) { }
 | 
			
		||||
				try { Door.nextDirection = Direction.valueOf(mapProperties.get("nextDirection").toString()); } catch (Exception e) { }
 | 
			
		||||
			}
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -14,63 +14,75 @@ import java.util.RandomAccess;
 | 
			
		||||
class testYann{
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
 | 
			
		||||
        System.out.println(111);
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        String line = "   Je vais te manger tout cru asdnkajsdh asl      ";
 | 
			
		||||
        String text = "aaaaaa aaaaaa\naaaaaa aaaaaa";
 | 
			
		||||
        String newText ="";
 | 
			
		||||
        String cutLine = "";
 | 
			
		||||
        String newLine = "";
 | 
			
		||||
 | 
			
		||||
        int cut = 12;
 | 
			
		||||
        int cut = 6;
 | 
			
		||||
 | 
			
		||||
        int startC = 0;
 | 
			
		||||
        int stoppC = cut;
 | 
			
		||||
 | 
			
		||||
        if(cut>line.length()-1){
 | 
			
		||||
            newLine  =line;
 | 
			
		||||
        }
 | 
			
		||||
        else{
 | 
			
		||||
            
 | 
			
		||||
            char[] c = new char[line.length()];
 | 
			
		||||
        String[] s = text.split("\n");
 | 
			
		||||
 | 
			
		||||
            for(int i=0; i<c.length;i++){
 | 
			
		||||
                c[i] = line.charAt(i);
 | 
			
		||||
        for(String line : s){
 | 
			
		||||
            System.out.println(line);
 | 
			
		||||
 | 
			
		||||
            if(cut>line.length()-1){
 | 
			
		||||
                newLine  =line;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            while(true){
 | 
			
		||||
                for(int i =stoppC; i>=startC; i--){
 | 
			
		||||
                    if(c[i] == ' '){
 | 
			
		||||
                        stoppC = i;
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                    else if(stoppC == c.length-1){
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                //découper le mot 
 | 
			
		||||
                for(int i=startC;i<=stoppC;i++){
 | 
			
		||||
                    cutLine += c[i];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                newLine +=  cutLine+"\n";
 | 
			
		||||
                cutLine = "";
 | 
			
		||||
 | 
			
		||||
                startC = stoppC + 1;
 | 
			
		||||
 | 
			
		||||
            else{
 | 
			
		||||
                
 | 
			
		||||
                if(c.length-1-stoppC <=0){
 | 
			
		||||
                    break;
 | 
			
		||||
                char[] c = new char[line.length()];
 | 
			
		||||
    
 | 
			
		||||
                for(int i=0; i<c.length;i++){
 | 
			
		||||
                    c[i] = line.charAt(i);
 | 
			
		||||
                }
 | 
			
		||||
                else if(c.length-1-stoppC <= cut){
 | 
			
		||||
                    stoppC = c.length-1;
 | 
			
		||||
                }
 | 
			
		||||
                else{
 | 
			
		||||
                    stoppC += cut;
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
                while(true){
 | 
			
		||||
                    for(int i =stoppC; i>=startC; i--){
 | 
			
		||||
                        if(c[i] == ' '){
 | 
			
		||||
                            stoppC = i;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        else if(stoppC == c.length-1){
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
    
 | 
			
		||||
                    //découper le mot 
 | 
			
		||||
                    for(int i=startC;i<=stoppC;i++){
 | 
			
		||||
                        cutLine += c[i];
 | 
			
		||||
                    }
 | 
			
		||||
    
 | 
			
		||||
                    newLine +=  cutLine+"\n";
 | 
			
		||||
                    cutLine = "";
 | 
			
		||||
    
 | 
			
		||||
                    startC = stoppC + 1;
 | 
			
		||||
    
 | 
			
		||||
                    
 | 
			
		||||
                    if(c.length-1-stoppC <=0){
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                    else if(c.length-1-stoppC <= cut){
 | 
			
		||||
                        stoppC = c.length-1;
 | 
			
		||||
                    }
 | 
			
		||||
                    else{
 | 
			
		||||
                        stoppC += cut;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            newText += newLine + "\n";
 | 
			
		||||
        
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -78,7 +90,7 @@ class testYann{
 | 
			
		||||
       
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        System.out.println(newLine);
 | 
			
		||||
        System.out.println(newText);
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user