Tiny 2D-animation-sprite composer for placing animation loops and making them interactive
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

LoadAndSave.pde 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. void loadSaveFile() {
  2. File xiz10ciList = new File(dataPath("save.gse"));
  3. if (xiz10ciList.exists()) {
  4. String[] saveData = loadStrings("save.gse");
  5. int entries = int((saveData.length)/7);
  6. for (int i = 0; i < entries; i++) {
  7. int id = int(saveData[i*7]);
  8. String idlePath = saveData[i*7+1];
  9. String actionPath = saveData[i*7+2];
  10. int x_position = int(saveData[i*7+3]);
  11. int y_position = int(saveData[i*7+4]);
  12. float w = float(saveData[i*7+5]);
  13. float h = float(saveData[i*7+6]);
  14. marker[activeMarkers] = new Marker(id, idlePath, actionPath, x_position, y_position, w, h);
  15. activeMarkers++;
  16. }
  17. }
  18. }
  19. FileWriter output = null;
  20. void save_gse() {
  21. File saveFile = new File(saveFilePath);
  22. if (saveFile.exists()) {
  23. saveFile.delete();
  24. };
  25. try {
  26. output = new FileWriter(saveFilePath, true);
  27. for (int i = 0; i < activeMarkers; i++) {
  28. marker[i].saveToFile();
  29. if (!(i == activeMarkers - 1)) {
  30. }
  31. }
  32. }
  33. catch (IOException e) {
  34. println("It Broke");
  35. e.printStackTrace();
  36. }
  37. finally {
  38. if (output != null) {
  39. try {
  40. output.close();
  41. }
  42. catch (IOException e) {
  43. println("Error while closing the writer");
  44. }
  45. }
  46. }
  47. }