Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FreeGlut - What do you developers think?
#10
Code: (Select All)
' Declare the Windows API function
DECLARE LIBRARY
  FUNCTION GetAsyncKeyState% (BYVAL vKey AS INTEGER)
END DECLARE

' Windows Virtual-Key Constants
CONST VK_CONTROL = &H11
CONST VK_OEM_PLUS = &HBB ' The + / = key
CONST VK_OEM_MINUS = &HBD ' The - / _ key
CONST VK_ESCAPE = &H1B

DIM counter AS INTEGER: counter = 0
DIM plusPressed AS INTEGER: plusPressed = 0
DIM minusPressed AS INTEGER: minusPressed = 0

PRINT "Counter: 0"
PRINT "Use Ctrl + [+] to increase and Ctrl + [-] to decrease."

DO
  ' Check if Ctrl is held down
  IF GetAsyncKeyState%(VK_CONTROL) AND &H8000 THEN

    ' Handle Plus (+) Key with debouncing (only trigger once per press)
    IF GetAsyncKeyState%(VK_OEM_PLUS) AND &H8000 THEN
      IF plusPressed = 0 THEN
        counter = counter + 1
        GOSUB RefreshDisplay
        plusPressed = 1
      END IF
    ELSE
      plusPressed = 0
    END IF

    ' Handle Minus (-) Key with debouncing
    IF GetAsyncKeyState%(VK_OEM_MINUS) AND &H8000 THEN
      IF minusPressed = 0 THEN
        counter = counter - 1
        GOSUB RefreshDisplay
        minusPressed = 1
      END IF
    ELSE
      minusPressed = 0
    END IF

  END IF

  ' Exit if ESC is pressed
  IF GetAsyncKeyState%(VK_ESCAPE) AND &H8000 THEN EXIT DO

  _LIMIT 60
LOOP
END

RefreshDisplay:
CLS
PRINT "Current Counter:"; counter
PRINT "Use Ctrl + [+] to increase and Ctrl + [-] to decrease."
RETURN

Should work under wine on linux...hope it helps

Me
Reply


Messages In This Thread
RE: FreeGlut - What do you developers think? - by Unseen Machine - 02-02-2026, 01:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Don't look now developers, but you've got a pat on your back! Pete 7 1,286 12-15-2024, 09:59 AM
Last Post: TempodiBasic

Forum Jump:


Users browsing this thread: 1 Guest(s)