initial commit
This commit is contained in:
48
LoadAndSave.pde
Normal file
48
LoadAndSave.pde
Normal file
@@ -0,0 +1,48 @@
|
||||
void loadSaveFile() {
|
||||
File xiz10ciList = new File(dataPath("save.gse"));
|
||||
if (xiz10ciList.exists()) {
|
||||
String[] saveData = loadStrings("save.gse");
|
||||
int entries = int((saveData.length)/7);
|
||||
for (int i = 0; i < entries; i++) {
|
||||
int id = int(saveData[i*7]);
|
||||
String idlePath = saveData[i*7+1];
|
||||
String actionPath = saveData[i*7+2];
|
||||
int x_position = int(saveData[i*7+3]);
|
||||
int y_position = int(saveData[i*7+4]);
|
||||
float w = float(saveData[i*7+5]);
|
||||
float h = float(saveData[i*7+6]);
|
||||
marker[activeMarkers] = new Marker(id, idlePath, actionPath, x_position, y_position, w, h);
|
||||
activeMarkers++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileWriter output = null;
|
||||
void save_gse() {
|
||||
File saveFile = new File(saveFilePath);
|
||||
if (saveFile.exists()) {
|
||||
saveFile.delete();
|
||||
};
|
||||
try {
|
||||
output = new FileWriter(saveFilePath, true);
|
||||
for (int i = 0; i < activeMarkers; i++) {
|
||||
marker[i].saveToFile();
|
||||
if (!(i == activeMarkers - 1)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
println("It Broke");
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if (output != null) {
|
||||
try {
|
||||
output.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
println("Error while closing the writer");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user