screen 0 drawing
#8
Quote:Programming for proper mouse input could be PITA. Once I tried to fix B+ "lights on" program I think it was, changed it so it accepted mouse input but it was a real battle. The great problem is when there is an area of the program window that must accept the input, and the user holds one of the mouse buttons while dragging the cursor to outside that area. Kept fixing it and encountered another problem of retriggering left button which is very annoying in a game.


Code: (Select All)
_Title "Screen 0 Mouse Demo 2: Its a Drag"
Do
    Cls
    Print "Go ahead and drag your mouse!"
    While _MouseInput: Wend ' poll mouse
    If _MouseButton(1) Then
        mdx = _MouseX: mdy = _MouseY
        While _MouseButton(1)
            While _MouseInput: Wend ' poll mouse
            mx = _MouseX: my = _MouseY
            Cls
            Print "Go ahead and drag your mouse!"
            If mdx < mx Then
                startX = mdx: endX = mx
            Else
                startX = mx: endX = mdx
            End If
            If mdy < my Then
                starty = mdy: endy = my
            Else
                starty = my: endy = mdy
            End If
            For x = startX To endX
                For y = starty To endy
                    Locate y, x: Print "X";
                Next
            Next
            _Display
            _Limit 600
        Wend
        For x = startX To endX
            For y = starty To endy
                Locate y, x: Print "X";
            Next
        Next
        _Display
        _Limit 600
    End If
Loop Until Len(InKey$)

Where is says:
    Cl
Code: (Select All)
    Cls
    Print "Go ahead and drag your mouse!"

That's were you'd redraw the screen image if you are painting X's over an area.
b = b + ...
Reply


Messages In This Thread
screen 0 drawing - by James D Jarvis - 07-09-2022, 09:12 PM
RE: screen 0 drawing - by mnrvovrfc - 08-01-2022, 08:25 AM
RE: screen 0 drawing - by bplus - 08-01-2022, 03:06 PM
RE: screen 0 drawing - by James D Jarvis - 08-02-2022, 09:52 PM
RE: screen 0 drawing - by James D Jarvis - 08-02-2022, 09:58 PM
RE: screen 0 drawing - by mnrvovrfc - 08-03-2022, 05:09 AM
RE: screen 0 drawing - by James D Jarvis - 08-03-2022, 12:13 PM
RE: screen 0 drawing - by bplus - 08-03-2022, 07:51 PM



Users browsing this thread: 2 Guest(s)