46 lines
1.5 KiB
Plaintext
46 lines
1.5 KiB
Plaintext
PImage Slide(int notebookID, int pageNumber) {
|
|
PImage leftPage, rightPage;
|
|
PGraphics result;
|
|
String path = notebooks.get(notebookID).notebookpath + "/";
|
|
leftPage = loadImage(path + notebooks.get(notebookID).imagepaths[pageNumber]);
|
|
rightPage = loadImage(path + notebooks.get(notebookID).imagepaths[pageNumber+1]);
|
|
result = createGraphics(width, height);
|
|
result.beginDraw();
|
|
result.image(leftPage, 0, 0, result.width/2, result.height);
|
|
result.image(rightPage, result.width/2, 0, result.width/2, result.height);
|
|
result.endDraw();
|
|
return result.get();
|
|
}
|
|
|
|
|
|
void nextSlide(int mode) {
|
|
transition = true;
|
|
startTransitionTime = millis();
|
|
|
|
if (mode == NORMAL) {
|
|
currentSlideNo+=2;
|
|
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-1);
|
|
if (currentSlideNo %2 != 0) {
|
|
currentSlideNo -= 1;
|
|
}
|
|
}
|
|
currentYear = notebooks.get(currentNotebookNo).year;
|
|
nextSlide = Slide(currentNotebookNo, currentSlideNo);
|
|
}
|
|
|
|
void nextSlide(int bookNo, int pageNo){
|
|
transition = true;
|
|
startTransitionTime = millis();
|
|
currentNotebookNo = bookNo;
|
|
currentSlideNo = pageNo;
|
|
currentYear = notebooks.get(bookNo).year;
|
|
nextSlide = Slide(bookNo, pageNo);
|
|
}
|