Browse Source

fixed a bug that caused the program to crash when trying to render the last page of a notebook with an even amount of pages

master
Victor Giers 1 year ago
parent
commit
b8c9da13a6
4 changed files with 10 additions and 10 deletions
  1. 0
    1
      Notebook.pde
  2. 3
    5
      Slide.pde
  3. 1
    1
      data/save.sav
  4. 6
    3
      notizheftanzeiger.pde

+ 0
- 1
Notebook.pde View File

@@ -46,7 +46,6 @@ String getMonth(int id) {
}


ArrayList<Notebook> notebooks = new ArrayList<Notebook>();

void createNotebooks() {
File datafolder = new File(dataPath("") + "/Notizhefte");

+ 3
- 5
Slide.pde View File

@@ -9,12 +9,9 @@ PImage Slide(int notebookID, int pageNumber) {
result.image(leftPage, 0, 0, result.width/2, result.height);
result.image(rightPage, result.width/2, 0, result.width/2, result.height);
result.endDraw();
PImage res = createImage(width, height, ARGB);
res = result.get();
return res;
return result.get();
}

boolean transition;

void nextSlide() {
transition = true;
@@ -25,10 +22,11 @@ void nextSlide() {
if (currentSlideNo > notebooks.get(currentNotebookNo).imagepaths.length-1) {
currentSlideNo = 0;
currentNotebookNo++;
if(currentNotebookNo == notebooks.size()) currentNotebookNo = 0;
}
} else if (mode == RANDOM) {
currentNotebookNo = (int)random(notebooks.size());
currentSlideNo = (int)random(notebooks.get(currentNotebookNo).imagepaths.length);
currentSlideNo = (int)random(notebooks.get(currentNotebookNo).imagepaths.length-1);
if (currentSlideNo %2 != 0) {
currentSlideNo -= 1;
}

+ 1
- 1
data/save.sav View File

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

+ 6
- 3
notizheftanzeiger.pde View File

@@ -2,17 +2,20 @@ import java.util.*;

//////// Config

int mode = NORMAL; //NORMAL or RANDOM order
float timerTime = 5000; //in milliseconds how long slide is shown
float transitionTime = 3000; //how long it takes to fade the next slide in. must not be greater than "timerTime"
int mode = RANDOM; //NORMAL or RANDOM order
float timerTime = 250; //in milliseconds how long slide is shown
float transitionTime = 100; //how long it takes to fade the next slide in. must not be greater than "timerTime"
boolean displayText = true; //if the "date" should be written on screen
boolean displayTimeline = true; //if the timeline should be drawn on screen

//

Timer timer;
ArrayList<Notebook> notebooks = new ArrayList<Notebook>();
PImage currentSlide, nextSlide;
int currentNotebookNo, currentSlideNo;
int startTransitionTime;
boolean transition;
float transitionProgress;
final static int NORMAL = 0;
final static int RANDOM = 1;

Loading…
Cancel
Save