Advertisement
spacechase0

Width, Height, Location Indices

Oct 2nd, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. x = current_index % width;
  2. y = current_index / width; // Assuming integers
  3. width = total_indices / height;
  4. height = total_indices / width;
  5.  
  6. ------------------------------------
  7. x = current_index % width;
  8. 0 = (i=0) % (w=20)
  9. 1 = (i=1) % (w=20)
  10. 2 = (i=2) % (w=20)
  11. ....
  12. 19 = (i=19) % (w=20)
  13. 20 = (i=20) % (w=20)
  14. 21 = (i=21) % (w=20)
  15. ------------------------------------
  16. y = current_index / width; // Assuming integers
  17. 0 = (i=0) / (w=15)
  18. 0 = (i=1) / (w=15)
  19. 0 = (i=2) / (w=15)
  20. ....
  21. 0 = (i=14) / (w=15)
  22. 1 = (i=15) / (w=15)
  23. 1 = (i=16) / (w=15)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement