Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. int sizeX = 64;
  2. int sizeY = 64;
  3. Texture2D texture = new Texture2D(sizeX,sizeY);
  4. int cpt=0;
  5.  
  6.  
  7. for(int y=0;y<sizeY/8;y++)
  8. {
  9. for(int x=0;x<sizeX/8;x++)
  10. {
  11.  
  12. //ici on est dans le bloc 8x8 pixels de coordonnée x,y
  13.  
  14. //maintenant on va boucler sur tous ces 8x8 pixels
  15. for(int by=0;by<8;by++)
  16. {
  17. for(int bx=0;bx<8;bx++)
  18. {
  19. //ici on est sur le pixel de coordonnée bx,by pour le bloc actuel
  20.  
  21. float color = testSprite[cpt]/16.0f;
  22.  
  23. texture.SetPixel(x*8+bx,sizeY-(y*8+by),new Color(color,color,color,/*color==0?0:*/1));
  24. cpt++;
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement