pimoroni / picovision

MIT License
46 stars 15 forks source link

Floppy Birb: More parallax, use wrapped scrolling. #51

Closed Gadgetoid closed 1 year ago

Gadgetoid commented 1 year ago

Needed to drop the frame_width down to just the display width or wrapped scrolling would break quite spectacularly. Is that intentional @MichaelBell?

Gadgetoid commented 1 year ago

Okay I was clearly doing something wrong with scrolling because the following minimal repro does exactly what I would expect:

import time
from picovision import PicoVision, PEN_RGB555

display = PicoVision(PEN_RGB555, 320, 240, frame_width=640, frame_height=240)

for _ in range(2):
    display.set_scroll_group_for_lines(1, 0, 320)
    display.set_scroll_group_offset(1, 0, 0, wrap_x=320)

    display.set_pen(display.create_pen(0, 0, 0))
    display.clear()
    display.set_pen(display.create_pen(255, 255, 255))
    display.set_font("bitmap8")
    display.text("Hello World, what's up, how are you today?", 0, 110)
    display.update()

while True:
    x = int(time.ticks_ms() / 10.0) % 640
    display.set_scroll_group_offset(1, x, 0, wrap_x=640)