Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ScrollLeft function scrolling more than 1 pixels left
#1
Hello,

I'm trying to use the ScrollLeft function to create a scrolling chart and the ScrollLeft function seems to be scrolling more than 1 pixel left. 
The screening area on the left also seems to be not to be pixel acurate. 

Sample program:

Code:
#include <scroll.bas>

INK 7
PAPER 0
CLS
sub square(x1 as UBYTE, y1 as UBYTE, x2 as UBYTE, y2 as UBYTE, color as UBYTE)
    DIM x AS UBYTE = 0
    DIM y AS UBYTE = 0
    FOR x = 0 TO x2 - x1
        PLOT INK color; x1 + x, y1
        PLOT INK color; x1 + x, y2
    NEXT x
    FOR y = 0 TO y2 - y1
        PLOT ink color; x1, y1 + y
        PLOT ink color; x2, y1 + y
    NEXT y
END SUB
SUB plott(x as FLOAT, y as FLOAT, sx as FLOAT, sy as FLOAT, x1 as UBYTE, y1 as UBYTE, x2 as UBYTE, y2 as UBYTE, color as UBYTE)
    DIM alfa AS UINTEGER
    DIM beta AS UINTEGER
    DIM mx AS UINTEGER
    alfa = ((x/sx) * (x2 - x1)) + x1
    beta = ((y/sy) * (y2 - y1)) + y1 + ((y2-y1)/2)
    ' Limites da tela
    IF alfa >= x2 - 1 then alfa = x2 - 1
    IF beta <= y1 + 1 then beta = y1 + 1
    mx = alfa mod x2
    IF alfa >= (x2-1) then
        ScrollLeft(x1 + 1, y1 + 1, x2 - 1, y2 - 1)
        alfa = x2-1
    END IF
    PRINT at 10,10; "alfa: "; alfa
    PRINT at 11,10; "beta: "; beta
    PLOT ink color; alfa, beta
END SUB
square(10, 15, 80, 60, 6)
DIM dia AS INTEGER
DIM valor AS float = 0
DIM incremento AS FLOAT = 1
' Create a sample scrolling chart
FOR dia = 1 TO 5000
    plott(dia, valor, 360, 100000, 10, 15, 80, 60, 6)
    valor = valor + 1000 * incremento
    IF valor > 49000 then incremento = -1
    IF valor < -49000 then incremento = 1
NEXT dia


Thank you very much!
Reply


Messages In This Thread
ScrollLeft function scrolling more than 1 pixels left - by rbiondi - 03-01-2024, 10:42 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)