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

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

Pages: 1 2


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

   


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

That's an interesting idea. In the case of such a command with QB64, I would suggest two more parameters at the end: Source and target screen. This can be done very easily with _PutImage.

Something as this, maybe:

Code: (Select All)

image& = _NewImage(400, 400, 256)
_Dest image&
Cls , 140
_PrintString (200 - 64, 200 - 8), "12345678"
_Dest 0

Screen _NewImage(1024, 768, 32)
Do
    k& = _KeyHit
    Select Case k&
        Case 18432: Yp = Yp + 10
        Case 20480: Yp = Yp - 10
        Case 19200: Xp = Xp + 10
        Case 19712: Xp = Xp - 10
    End Select
    Line (311, 153)-(713, 555), _RGB32(255), BF
    SCROLL 312, 154, 712, 554, Xp, Yp, image&, _Dest
    _Display
    _KeyClear
    _Limit 20
Loop

Sub SCROLL (x1%, y1%, x2%, y2%, h%, v%, s&, d&)
    Wi% = _Width(s&)
    He% = _Height(s&)
    _PutImage (x1%, y1%)-(x2%, y2%), s&, d&, (h%, v%)
End Sub



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

Yeah Charlie does have interesting ideas!

I seem to recall some scrolling project from way back, maybe with Petr?

I think it could be done with a virtual screen array so _PutImage could be worked around easily.


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

Hi BPlus,

Hi BPlus, I really don't know. It's possible, I've done more. But working with _PutImage is, think, the most suitable for this, because an image is inserted (so it can also be the output screen of a subprogram) and thus it can be linked with input from the keyboard and mouse, it doesn't have to be limited only to display, but it can work together with the user.


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

Hey @Petr, remember this is for BAM and I don't think it has _PutImage capability?

If any _Keywords are used from QB64 era I think Charlie would have had to put them in himself.


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

You're right, BPlus. Unfortunately I don't know the list of valid BAM commands, although I found the BAM IDE online, it looks really nice.


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

(06-25-2023, 07:02 PM)Petr Wrote: You're right, BPlus. Unfortunately I don't know the list of valid BAM commands, although I found the BAM IDE online, it looks really nice.

You'll find links to keywords (and many things BAM, work in progress) here.

Thanks for the kind words !


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

@CharlieJV 

Thanks for the link. Since BAM supports GET and PUT for graphics, I assume that's the way to go for the SCROLL statement. So if it is about scrolling images. But if the text from the text field should be scrolled, then in that case I don't know how I would go about it. I'm looking at the help for BAM. Is Declare Sub mandatory? Is virtual screens supported?


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

(06-25-2023, 08:23 PM)Petr Wrote: @CharlieJV 

Thanks for the link. Since BAM supports GET and PUT for graphics, I assume that's the way to go for the SCROLL statement. So if it is about scrolling images. But if the text from the text field should be scrolled, then in that case I don't know how I would go about it. I'm looking at the help for BAM. Is Declare Sub mandatory? Is virtual screens supported?

Every pixel on the screen is, behind the scenes, stored in a javascript array.

Scroll just juggles the content of that array around.  (I think I'll be adding a "wrap%" argument to the statement.)

Yeah, BAM needs a subroutine/function defined before any reference to it;  so either the definition at the top or the declare sub/function statement at the top.

Currently no virtual screens (or pages) are supported.  Just the one screen (for the moment, as I let thoughts fester in the back of my sponge.)


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

The Three Little Pigs test for vertical scroll:

Up


Down