[bb] Simple KeyCode library by Jim Teeuwen [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:43

Previous topic - Next topic

BlitzBot

Title : Simple KeyCode library
Author : Jim Teeuwen
Posted : 1+ years ago

Description : This is a vital asset to any blitzcoder, yet I dont see it here in the archive.. Most ppl will allready have it, but the new ones to blitz might find it usefull, and it'll spare you a lot of time typing it urself. These are Constants containing the scancode values of all keys listed in Blitz3D-scancode register.
So instead of using : if keyHit(1) then..
you can now use: If keyhit(K_ESCAPE) Then...

Makes the code a lil more readable..

Just put it in a seperate bb file(e.g.: keys.bb) and use: Include "keys.bb"
to use it in any project.

as you can see, all names are fairly straighforward and easy to comprehend.
have fun with it..


Code :
Code (blitzbasic) Select
[code]
Const K_ESCAPE=1
Const K_1=2
Const K_2=3
Const K_3=4
Const K_4=5
Const K_5=6
Const K_6=7
Const K_7=8
Const K_8=9
Const K_9=10
Const K_0=11
Const K_MINUS=12
Const K_EQUALS=13
Const K_BACKSPACE=14
Const K_TAB=15
Const K_Q=16
Const K_W=17
Const K_E=18
Const K_R=19
Const K_T=20
Const K_Y=21
Const K_U=22
Const K_I=23
Const K_O=24
Const K_P=25
Const K_LEFTBRACKET=26
Const K_RIGHTBRACKET=27
Const K_ENTER=28
Const K_LEFTCONTROL=29
Const K_A=30
Const K_S=31
Const K_D=32
Const K_F=33
Const K_G=34
Const K_H=35
Const K_J=36
Const K_K=37
Const K_L=38
Const K_SEMICOLON=39
Const K_APOSTROPHE=40
Const K_GRAVE=41
Const K_LEFTSHIFT=42
Const K_BACKSLASH=43
Const K_Z=44
Const K_X=45
Const K_C=46
Const K_V=47
Const K_B=48
Const K_N=49
Const K_M=50
Const K_COMMA=51
Const K_PERIOD=52
Const K_SLASH=53
Const K_RIGHTSHIFT=54
Const K_MULTIPLE=55
Const K_LEFTALT=56
Const K_SPACE=57
Const K_CAPITAL=58
Const K_F1=59
Const K_F2=60
Const K_F3=61
Const K_F4=62
Const K_F5=63
Const K_F6=64
Const K_F7=65
Const K_F8=66
Const K_F9=67
Const K_F10=68
Const K_NUMPAD=69
Const K_SCROLLLOCK=70
Const K_NUM7=71
Const K_NUM8=72
Const K_NUM9=73
Const K_NUMSUBTRACT=74
Const K_NUM4=75
Const K_NUM5=76
Const K_NUM6=77
Const K_NUMADD=78
Const K_NUM1=79
Const K_NUM2=80
Const K_NUM3=81
Const K_NUM0=82
Const K_NUMDECIMAL=83
Const K_OEM102=86
Const K_F11=87
Const K_F12=88
Const K_F13=100
Const K_F14=101
Const K_F15=102
Const K_KANA=112
Const K_ABNT_C1=115
Const K_CONVERT=121
Const K_NOCONVERT=123
Const K_YEN=125
Const K_ABTN_C2=126
Const K_NUMEQUALS=141
Const K_NUMPREVTRACK=144
Const K_AT=145
Const K_COLON=146
Const K_UNDERLINE=147
Const K_KANJI=148
Const K_STOP=149
Const K_AX=150
Const K_UNLABELED=151
Const K_NEXTTRACK=153
Const K_NUMENTER=156
Const K_RIGHTCONTROL=157
Const K_MUTE=160
Const K_CALCULATOR=161
Const K_PLAYPAUSE=161
Const K_MEDIASTOP=164
Const K_VOLUMEDOWN=174
Const K_VOLUMEUP=176
Const K_WEBHOME=178
Const K_NUMCOMMA=179
Const K_NUMDIVIDE=181
Const K_SYSREQ=183
Const K_RIGHTALT=184
Const K_PAUSE=197
Const K_HOME=199
Const K_UP=200
Const K_PAGEUP=201
Const K_LEFT=203
Const K_RIGHT=205
Const K_END=207
Const K_DOWN=208
Const K_NEXT=209
Const K_INSERT=210
Const K_DELETE=211
Const K_LEFTWINDOWS=219
Const K_RIGHTWINDOWS=220
Const K_APPS=221
Const K_POWER=222
Const K_SLEEP=223
Const K_WAKE=227
Const K_WEBSEARCH=229
Const K_WEBFAVORITES=230
Const K_WEBREFRESH=231
Const K_WEBSTOP=232
Const K_WEBFORWARD=233
Const K_WEBBACK=234
Const K_MYCOMPUTER=235
Const K_MAIL=236
Const K_MEDIASELECT=237
[/code]

Comments :


norton(Posted 1+ years ago)

 Thank you. Now I don't have to do it.norton


Perturbatio(Posted 1+ years ago)

 *cough* ahem...<a href="codearcsd50a.html?code=1174" target="_blank">http://www.blitzbasic.com/codearcs/codearcs.php?code=1174</a>