added save-function, rearranged data folder, updated README

This commit is contained in:
2022-10-11 06:35:37 +02:00
parent 5e5a8c6a1f
commit de4b89525c
4 changed files with 16 additions and 5 deletions

View File

@@ -6,7 +6,7 @@ class Notebook {
int id;
Notebook(int id_, String notebookpath_, String[] imagepaths_) {
id = id_;
notebookpath = dataPath("") + "/" + notebookpath_;
notebookpath = dataPath("") + "/Notizhefte/" + notebookpath_;
imagepaths = Arrays.copyOfRange(imagepaths_, 1, imagepaths_.length-1);
String[] separated = notebookpath_.split("-");
dateText = (getMonth(int(separated[1])) + " " + separated[0]);
@@ -49,12 +49,12 @@ String getMonth(int id) {
ArrayList<Notebook> notebooks = new ArrayList<Notebook>();
void createNotebooks() {
File datafolder = new File(dataPath(""));
File datafolder = new File(dataPath("") + "/Notizhefte");
String[] notebooknames = datafolder.list();
notebooknames = sort(notebooknames);
int notebookID = 0;
for (int i = 0; i < notebooknames.length; i++) {
File notebookfolder = new File(dataPath("") + "/" + notebooknames[i]);
File notebookfolder = new File(dataPath("") + "/Notizhefte/" + notebooknames[i]);
if (notebookfolder.list() != null) {
String[] imagenames = notebookfolder.list();
List<String> strings = Arrays.asList(imagenames);

View File

@@ -1,3 +1,3 @@
## Notizheftanzeiger
Mit Processing 3 oder 4 zu öffnen und auszuführen
Benötigt ordner "data" mit Notizheftdaten
Benötigt ordner "Notizhefte" im Ordner "data"

2
data/save.sav Normal file
View File

@@ -0,0 +1,2 @@
0
8

View File

@@ -16,12 +16,16 @@ int startTransitionTime;
float transitionProgress;
final static int NORMAL = 0;
final static int RANDOM = 1;
String[] save;
void setup() {
//fullScreen(); //if using fullScreen, comment the next line
size(960, 540);
fill(255);
save = loadStrings(dataPath("") + "/save.sav");
currentNotebookNo = int(save[0]);
currentSlideNo = int(save[1]);
if (displayTimeline) {
textSize(20);
textAlign(CENTER);
@@ -44,6 +48,11 @@ void draw() {
tint(255, transitionProgress);
image(nextSlide, 0, 0, width, height);
if (millis() - startTransitionTime > transitionTime) {
save[0] = str(currentNotebookNo);
save[1] = str(currentSlideNo);
saveStrings(dataPath("") + "/save.sav", save);
currentSlide = nextSlide;
transitionProgress = 0;
transition = false;