Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<Float> currVertices = new ArrayList<Float>(); // the vertices of the current province
- for (int y = 0; y < worldImage.getHeight(); y++) {
- for (int x = 0; x < worldImage.getWidth(); x++) {
- if (!currColors.contains(worldImage.getRGB(x, y))) {
- if (!currVertices.isEmpty()) provinceVertices.add(Utils.toFloatArray(currVertices)); // store the current province's vertices into the total database
- currVertices.clear();
- }
- if (x%4==0) currVertices.add((float)(x)/EngineManager.getWindowWidth());
- if(y%4==0) currVertices.add((float) (y)/EngineManager.getWindowHeight());
- }
- }
- public static float[] toFloatArray(List<Float> list) {
- float[] array = new float[list.size()];
- ListIterator<Float> iterator = list.listIterator();
- while (iterator.hasNext()) {
- array[iterator.nextIndex()] = list.get(iterator.nextIndex());
- }
- return array;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement