@@ -19,7 +19,36 @@ public class TilingSprite {
1919 public int color = Color .WHITE .toRGB ();
2020 public float rotation = 0 ;
2121
22- public void render (float x , float y ) {
22+ public void thecorrectone (float x , float y ) {
23+ final float textureWidth = texture2D .getWidth (), textureHeight = texture2D .getHeight ();
24+
25+ int totalTimesX = MathUtils .ceilInt (width / textureWidth );
26+ int totalTimesY = MathUtils .ceilInt (height / textureHeight );
27+
28+ for (int i = 0 ; i < totalTimesX ; i ++) {
29+ for (int n = 0 ; n < totalTimesY ; n ++) {
30+ GLOBAL_RENDER_STACK .pushMatrix ();
31+ GLOBAL_RENDER_STACK .rotateZ (rotation );
32+ float tileX = x + i * textureWidth , tileY = y + n * textureHeight ;
33+ GLOBAL_RENDER_STACK .translate (tileX , tileY , 0 );
34+ GLOBAL_RENDER_STACK .scale (scale );
35+
36+ ThinGL .renderer2D ().coloredTextureWithRawTexCoord (GLOBAL_RENDER_STACK ,
37+ texture2D , 0 , 0 , textureWidth - tilePosition .x (), textureHeight ,
38+ tilePosition .x () / textureWidth , tilePosition .y () / textureHeight ,
39+ (textureWidth - tilePosition .x ()) / textureWidth , 1 , Color .fromRGB (color ));
40+
41+ ThinGL .renderer2D ().coloredTextureWithRawTexCoord (GLOBAL_RENDER_STACK ,
42+ texture2D , (textureWidth - tilePosition .x ()), 0 , tilePosition .x (), textureHeight ,
43+ 0 , tilePosition .y () / textureHeight ,
44+ tilePosition .x () / textureWidth , 1 , Color .fromRGB (color ));
45+
46+ GLOBAL_RENDER_STACK .popMatrix ();
47+ }
48+ }
49+ }
50+
51+ public void thisrendermethodsomehowworksandIdontknowwhy (float x , float y ) {
2352 final float textureWidth = texture2D .getWidth (), textureHeight = texture2D .getHeight ();
2453
2554 int totalTimesX = MathUtils .ceilInt (width / textureWidth );
@@ -58,7 +87,6 @@ public void setTilePosition(float x, float y) {
5887 while (newX > texture2D .getWidth ()) {
5988 newX -= texture2D .getWidth ();
6089 }
61- System .out .println (newX );
6290 x = newX * Math .signum (x );
6391 }
6492
0 commit comments