QB64 Phoenix Edition
BAM: Thinking about adding a SCROLL statement - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: QBJS, BAM, and Other BASICs (https://staging.qb64phoenix.com/forumdisplay.php?fid=50)
+--- Thread: BAM: Thinking about adding a SCROLL statement (/showthread.php?tid=1783)

Pages: 1 2


RE: BAM: Thinking about adding a SCROLL statement - bplus - 06-25-2023

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!


RE: BAM: Thinking about adding a SCROLL statement - CharlieJV - 06-25-2023

(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;
        }
        }



RE: BAM: Thinking about adding a SCROLL statement - CharlieJV - 06-26-2023

Sanity testing programs:

Scrolling horizontally, -1 and +1:

Scrolling vertically, -1 and +1: