1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2025-01-31 05:02:45 +00:00

finish format text

This commit is contained in:
Fastium 2022-06-15 22:54:18 +02:00
parent 83fc312efb
commit 5d0d638275
2 changed files with 57 additions and 44 deletions

View File

@ -16,6 +16,7 @@ import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import Entity.Character.Direction;
import Entity.Player; import Entity.Player;
import ch.hevs.gdx2d.components.screen_management.RenderingScreen; import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
import ch.hevs.gdx2d.lib.GdxGraphics; 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.nextMap = mapProperties.get("nextMap").toString(); } catch (Exception e) { }
try { Door.nextX = Integer.parseInt(mapProperties.get("nextX").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.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) { }
} }
} }

View File

@ -14,62 +14,72 @@ import java.util.RandomAccess;
class testYann{ class testYann{
public static void main(String[] args) { 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 cutLine = "";
String newLine = ""; String newLine = "";
int cut = 12; int cut = 6;
int startC = 0; int startC = 0;
int stoppC = cut; int stoppC = cut;
if(cut>line.length()-1){ String[] s = text.split("\n");
newLine =line;
}
else{
char[] c = new char[line.length()]; for(String line : s){
System.out.println(line);
for(int i=0; i<c.length;i++){ if(cut>line.length()-1){
c[i] = line.charAt(i); newLine =line;
} }
else{
char[] c = new char[line.length()];
for(int i=0; i<c.length;i++){
c[i] = line.charAt(i);
}
while(true){ while(true){
for(int i =stoppC; i>=startC; i--){ for(int i =stoppC; i>=startC; i--){
if(c[i] == ' '){ if(c[i] == ' '){
stoppC = 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; break;
} }
else if(stoppC == c.length-1){ else if(c.length-1-stoppC <= cut){
break; stoppC = c.length-1;
}
else{
stoppC += cut;
} }
} }
//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 +88,9 @@ class testYann{
System.out.println(newLine);
System.out.println(newText);