(06-25-2023, 10:41 PM)bplus Wrote: When I said virtual screen, I meant a string array with all the lines to be projected onto the screen. Just run through the array index's one screen height at a time, starting at sequentially higher or lower index.
But you are doing great already!
Unless I'm missing something, I think I'm doing what you're saying. Pardon the javascript, what I'm doing for vertical scroll: (not pretty, but pretty is for later; all about wrapping my head around the mechanics of the wwwBASIC implementation)
Code: (Select All)
if (v < 0) {v=-v;
for (var i = (v*display.width - 1); i < (display.width * display.height - 1); i++) {
display_data[i-(v*display.width)] = display_data[i];
}
for (var i = ((display.width*display.height)-(v*display.width)); i < (display.width * display.height - 1); i++) {
display_data[i] = bg_color;
}
}
else if (v > 0) {
for ( var i = (display.width * display.height - 1);i >= v; i--) {
display_data[i] = display_data[i-(v*display.width)] || bg_color;
}
for (var i = 0; i < (v*display.width - 1); i++) {
display_data[i] = bg_color;
}
}