i have a csv file with 72 records in it. i want to display just 8 at a time, and when the arrow keys are pressed, RIGHT and LEFT, i want it to show the next 8. HOW do i do that? do i have to redraw? I don't want to redraw cos i have a video in my sketch.
Here's my code (numerous attempts have been either commented out or deleted)
import processing.video.*;
import ddf.minim.*;
import ddf.minim.effects.*;
Movie mymovie;
Table myresource;
String Message;
PFont myfont;
void setup() {
size(660, 600);
background(69);
myfont = loadFont("DejaVu.vlw");
myresource = loadTable("neilyoung.csv", "header");
println(myresource.getRowCount() + " total rows in table");
showRows();
loadMovie();
}
void draw() {
if (mymovie.available() == true) {
mymovie.read();
}
image(mymovie, 200, 20, width/3, height/4);
KeyPressed();
}
void KeyPressed(){
float current = mymovie.time();
float entire = mymovie.duration();
if (keyPressed) {
if (key == 'f' || key == 'F') {
mymovie.jump(current + 12);
}
else if (key == 'b' || key == 'B') {
mymovie.jump(current - 12);
}
else if (key == 'e' || key == 'E') {
mymovie.jump(entire);
}
}
}
void showRows(){
int numRows = myresource.getRowCount();
int count = numRows/8;
int lines = 0;
//String[] albums = loadStrings("neilyoung.csv");
textFont(myfont, 22);
text("Neil Young Albums", 30, 200);
// for (int i= 0; i < numRows; i++){
//do{
for (int j=0; j<numRows; j++){
TableRow row = myresource.getRow(j);
int a= row.getInt("year");
String b = row.getString("artist");
String c = row.getString("title");
textFont(myfont, 16);
Message = str(a) + " " + b + " " + c + " ";
text(Message, 30, 230+ j*27);
// if (j == count){
// lines=j+8;
// myresource.removeRow(0);
// break;
// }
//}///}while(lines< numRows);
//}
}
void loadMovie(){
// Load and play the video
mymovie = new Movie(this, "harvestmoon.mp4");
mymovie.play();
}
https://www.dropbox.com/s/7a7yj9b69hufzpx/neilyoung.csv?dl=0