Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I must be missing something obvious with this code
#1
I was adding a screen flipping effect to a program, and don't see why CLS is needed to remove the edge LINE before the last _PUTIMAGE is called.  I'm putimaging the whole screen at the end, shouldn't that remove the LINE?

- Dav

Code: (Select All)
'==============
'FLIPSCREENHZ.BAS
'==============

Screen _NewImage(1000, 700, 32)

'=== draw stuff
For t = 1 To 50
    Line (Rnd * _Width, Rnd * _Height)-Step(15 + (Rnd * 100), 15 + (Rnd * 100)), _RGB(Rnd * 255, Rnd * 255, Rnd * 255), BF
    Circle (Rnd * _Width, Rnd * _Height), 15 + (Rnd * 100), _RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next

Locate 12, 12: Print "PRESS ANY KEY TO FILP ME";
'kep pressing any key to flip screen
'ESC exits

Do
    a$ = Input$(1)
    If a$ = Chr$(27) Then End

    FlipScreen

Loop

Sub FlipScreen

    'Flips current screen horizontally

    displayStatus%% = _AutoDisplay 'get current display status

    _Display 'turn off auto screen updates

    scrn& = _CopyImage(_Display)

    x1 = 0: x2 = _Width
    y1 = 0: y2 = _Height

    Do
        'draw screen image
        Cls: _PutImage (x1, y1)-(x2, y2), scrn&

        'draw edge line around it for extra effect
        Line (x1, y1)-(x2, y2), _RGB(128, 128, 128), B

        x1 = x1 + 45: If x1 > _Width Then x1 = _Width
        x2 = x2 - 45: If x2 < 0 Then x2 = 0

        _Display
        _Limit 30
    Loop Until x1 = _Width And x2 = 0

    'Shouldn't _PUTIMAGE below fit the whole screen and remove the edge LINE without needing CLS?
    'CLS

    _PutImage (_Width, 0)-(0, _Height), scrn&
    _Display
    _FreeImage scrn&

    If displayStatus%% = -1 Then _AutoDisplay 'restore previous

End Sub

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
I must be missing something obvious with this code - by Dav - 09-15-2024, 12:57 PM



Users browsing this thread: 1 Guest(s)