Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. List<Float> currVertices = new ArrayList<Float>(); // the vertices of the current province
  2. for (int y = 0; y < worldImage.getHeight(); y++) {
  3. for (int x = 0; x < worldImage.getWidth(); x++) {
  4. if (!currColors.contains(worldImage.getRGB(x, y))) {
  5. if (!currVertices.isEmpty()) provinceVertices.add(Utils.toFloatArray(currVertices)); // store the current province's vertices into the total database
  6. currVertices.clear();
  7. }
  8. if (x%4==0) currVertices.add((float)(x)/EngineManager.getWindowWidth());
  9. if(y%4==0) currVertices.add((float) (y)/EngineManager.getWindowHeight());
  10. }
  11. }
  12.  
  13. public static float[] toFloatArray(List<Float> list) {
  14. float[] array = new float[list.size()];
  15. ListIterator<Float> iterator = list.listIterator();
  16. while (iterator.hasNext()) {
  17. array[iterator.nextIndex()] = list.get(iterator.nextIndex());
  18. }
  19. return array;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement