Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a little tutorial STEP by STEP on scrolling in 2D graphic mode
#17
Just as my example above for a graphic screen, I'd simply do this the exact same way for a SCREEN 0 screen, as illustrated below:

Code: (Select All)
Dim Shared As Long Display, Widescreen
Display = _NewImage(120, 30, 0)
Widescreen = _NewImage(360, 90, 0) '3 times the display size.
Screen Display
_Dest Widescreen

'Fill the widescreen with some text
For xframe = 0 To 2
For yframe = 0 To 2
c = c + 1
For y = 1 To 30
Color 15 - c, c
Locate yframe * 30 + y, xframe * 120 + 1
p$ = Str$(y) + ") LINE NUMBER #" + Str$(y) + Space$(120)
p$ = Left$(p$, 120)
Print p$;
Next
Next
Next

xstart = 1: ystart = 1
Do
While _MouseInput: Wend

If _MouseX <= 3 Then xstart = xstart - 1
If _MouseX >= 118 Then xstart = xstart + 1
If _MouseY <= 3 Then ystart = ystart - 1
If _MouseY >= 28 Then ystart = ystart + 1
If xstart < 1 Then xstart = 1
If ystart < 1 Then ystart = 1
If xstart > 241 Then xstart = 241
If ystart > 61 Then ystart = 61

PutZero xstart, ystart
_Limit 30
Loop Until _KeyHit


Sub PutZero (xstart, ystart)
Dim As _MEM m(1)
m(0) = _MemImage(Display)
m(1) = _MemImage(Widescreen)
Dim As _Integer64 yOffset, xOffset, y
yOffset = (ystart - 1) * 720
xOffset = (xstart - 1) * 2
Dim temp As String * 240
For y = 0 To 29
_MemGet m(1), m(1).OFFSET + yOffset + y * 720 + xOffset, temp
_MemPut m(0), m(0).OFFSET + y * 240, temp
Next
_MemFree m(0)
_MemFree m(1)
End Sub
Reply


Messages In This Thread
RE: a little tutorial STEP by STEP on scrolling in 2D graphic mode - by SMcNeill - 12-10-2024, 02:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  request for printing patterns with for loops tutorial fistfullofnails 24 4,299 08-19-2025, 08:09 PM
Last Post: bplus
  a little tutorial demo for Windows in SCREEN 0 TempodiBasic 0 588 12-10-2024, 01:00 AM
Last Post: TempodiBasic
  Portable Version of Terry Ritchie's Tutorial Updated mpgcan 6 5,829 09-22-2024, 09:13 PM
Last Post: TerryRitchie
  Steve's basic SIN/COS Tutorial SMcNeill 5 1,821 07-12-2024, 06:53 PM
Last Post: vince
  BIG QB64 Tutorial update TerryRitchie 4 1,528 05-22-2024, 06:20 PM
Last Post: TerryRitchie

Forum Jump:


Users browsing this thread: 1 Guest(s)