61 lines
2.3 KiB
QBasic
61 lines
2.3 KiB
QBasic
' The MIT License (MIT)
|
|
'
|
|
' Copyright (C) 2026 Scott Duensing
|
|
'
|
|
' Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
' of this software and associated documentation files (the "Software"), to
|
|
' deal in the Software without restriction, including without limitation the
|
|
' rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
' sell copies of the Software, and to permit persons to whom the Software is
|
|
' furnished to do so, subject to the following conditions:
|
|
'
|
|
' The above copyright notice and this permission notice shall be included in
|
|
' all copies or substantial portions of the Software.
|
|
'
|
|
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
' FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
' IN THE SOFTWARE.
|
|
|
|
' game.bas -- Game Helpers Library for DVX BASIC
|
|
'
|
|
' Tells whether a key is being held down right now, for games that move
|
|
' something for as long as a key is held. Keys are named by their raw key
|
|
' code: one of the constants below, or for any other key its PC keyboard
|
|
' scan code (add &H80 for the grey keys between the typing keys and the
|
|
' number pad). Keys only read as held while one of your program's windows
|
|
' is active.
|
|
'
|
|
' Usage: Add this file to your project.
|
|
|
|
' Raw key codes
|
|
CONST GAMEKEY_ESC = &H01
|
|
CONST GAMEKEY_ENTER = &H1C
|
|
CONST GAMEKEY_SPACE = &H39
|
|
CONST GAMEKEY_TAB = &H0F
|
|
CONST GAMEKEY_LSHIFT = &H2A
|
|
CONST GAMEKEY_RSHIFT = &H36
|
|
CONST GAMEKEY_LCTRL = &H1D
|
|
CONST GAMEKEY_RCTRL = &H9D
|
|
CONST GAMEKEY_LALT = &H38
|
|
CONST GAMEKEY_RALT = &HB8
|
|
CONST GAMEKEY_UP = &HC8
|
|
CONST GAMEKEY_DOWN = &HD0
|
|
CONST GAMEKEY_LEFT = &HCB
|
|
CONST GAMEKEY_RIGHT = &HCD
|
|
CONST GAMEKEY_A = &H1E
|
|
CONST GAMEKEY_D = &H20
|
|
CONST GAMEKEY_S = &H1F
|
|
CONST GAMEKEY_W = &H11
|
|
CONST GAMEKEY_Z = &H2C
|
|
CONST GAMEKEY_X = &H2D
|
|
CONST GAMEKEY_F1 = &H3B
|
|
|
|
DECLARE LIBRARY "game"
|
|
' True while the key is held down and one of this program's windows
|
|
' is active, else False.
|
|
DECLARE FUNCTION GameKeyDown(BYVAL keyCode AS LONG) AS LONG
|
|
END DECLARE
|