Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 016: _MOUSEINPUT
#25
So.... I read through this and I want to check my conceptual understanding here.

Best to setup a mouse reading sub to poll the current state of the mouse. A basic sub should collect our x,y position (assuming that is in pixels in our program when it is active?), and the state of the left button (assuming the right button is as simple?). I get a little fuzzy on checking the prior state of the button to the current state... Is this to check if the button is still being held down and we don't execute as a general rule in such a state? Or did I miss something? Assuming I don't highlight items, I don't need to worry about holding and dragging?

In addition, I assume if I want mouse-reading ability, I would need to place a sub call in each of the do/loops I have in my program where I want to use said mouse? And similiar to keyboard input, I would use a select case and check if at this x and y (do I need to track the start x,y and release x,y to ensure I am still in a defined box click area?) with this mouse click and release flag then do this code. Am I getting the logic right or am missing something here.


So conceptual it would look like this, if I am understanding the logic right:

Code: (Select All)
    DO
        LIMIT LIMITRATE

        'INSERT MOUSE READING SUB HERE       

        CLS
        PUTIMAGE (0, 0), Intro
        SELECT CASE Pointer 'Used for keyboard selection
            CASE 0: PUTIMAGE (375, 221), CheckSelect
            CASE 1: PUTIMAGE (375, 292), CheckSelect
            CASE 2: PUTIMAGE (375, 365), CheckSelect
            CASE 3: PUTIMAGE (375, 437), CheckSelect
            CASE 4: PUTIMAGE (375, 510), CheckSelect
        END SELECT
        DISPLAY
        IF SelectFlag THEN PAUSE (TIME) 'Avoid double press delay
        SelectFlag = FALSE
        'Checking for key press (keyboard)
        IF KEYDOWN(CVI(CHR$(0) + "H")) THEN ' up case
            IF Pointer = 0 THEN Pointer = 4 ELSE Pointer = Pointer - 1
            SelectFlag = TRUE
        END IF
        IF KEYDOWN(CVI(CHR$(0) + "P")) THEN 'down case
            IF Pointer = 4 THEN Pointer = 0 ELSE Pointer = Pointer + 1
            SelectFlag = TRUE
        END IF
       
        'Some kind of if/then or select case to check for mouse actions?

    LOOP UNTIL KEYDOWN(13) OR KEYDOWN(32) 'Return/Spacebar to select - include a mouse flag that a choice was made???

Thank you Steve and Pete. I did start in the wiki but this was much more informative. Heart
Reply


Messages In This Thread
DAY 016: _MOUSEINPUT - by SMcNeill - 11-21-2022, 11:27 PM
RE: DAY 016: _MOUSEINPUT - by bplus - 11-21-2022, 11:41 PM
RE: DAY 016: _MOUSEINPUT - by SMcNeill - 11-22-2022, 12:09 AM
RE: DAY 016: _MOUSEINPUT - by PhilOfPerth - 11-22-2022, 12:16 AM
RE: DAY 016: _MOUSEINPUT - by james2464 - 11-22-2022, 12:20 AM
RE: DAY 016: _MOUSEINPUT - by SMcNeill - 11-22-2022, 12:32 AM
RE: DAY 016: _MOUSEINPUT - by mnrvovrfc - 11-21-2022, 11:54 PM
RE: DAY 016: _MOUSEINPUT - by PhilOfPerth - 11-22-2022, 12:08 AM
RE: DAY 016: _MOUSEINPUT - by james2464 - 11-22-2022, 12:38 AM
RE: DAY 016: _MOUSEINPUT - by SMcNeill - 11-22-2022, 12:49 AM
RE: DAY 016: _MOUSEINPUT - by mnrvovrfc - 11-22-2022, 12:46 AM
RE: DAY 016: _MOUSEINPUT - by Pete - 11-22-2022, 01:32 AM
RE: DAY 016: _MOUSEINPUT - by SMcNeill - 11-22-2022, 02:00 AM
RE: DAY 016: _MOUSEINPUT - by OldMoses - 12-06-2022, 01:39 AM
RE: DAY 016: _MOUSEINPUT - by Pete - 12-06-2022, 02:28 AM
RE: DAY 016: _MOUSEINPUT - by Pete - 11-22-2022, 02:59 AM
RE: DAY 016: _MOUSEINPUT - by SMcNeill - 11-22-2022, 03:47 AM
RE: DAY 016: _MOUSEINPUT - by Pete - 11-22-2022, 07:54 AM
RE: DAY 016: _MOUSEINPUT - by mnrvovrfc - 12-05-2022, 02:03 PM
RE: DAY 016: _MOUSEINPUT - by Pete - 12-05-2022, 04:02 PM
RE: DAY 016: _MOUSEINPUT - by SMcNeill - 12-05-2022, 04:55 PM
RE: DAY 016: _MOUSEINPUT - by Pete - 12-05-2022, 07:45 PM
RE: DAY 016: _MOUSEINPUT - by OldMoses - 12-06-2022, 02:26 PM
RE: DAY 016: _MOUSEINPUT - by Pete - 12-06-2022, 03:23 PM
RE: DAY 016: _MOUSEINPUT - by NasaCow - 12-10-2022, 12:28 PM
RE: DAY 016: _MOUSEINPUT - by Pete - 12-10-2022, 05:08 PM



Users browsing this thread: 3 Guest(s)