October 28, 2020, 06:41:37 AM

Author Topic: [bb] Simple KeyCode library by Jim Teeuwen [ 1+ years ago ]  (Read 1351 times)

Offline BlitzBot

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


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal