[bb] Max KeyCodes for B3D,B2D,B+ by Captain Wicker (crazy hillbilly) [ 1+ years ago ]

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

Previous topic - Next topic

BlitzBot

Title : Max KeyCodes for B3D,B2D,B+
Author : Captain Wicker (crazy hillbilly)
Posted : 1+ years ago

Description : To save time looking up each and every scancode, I have put this up!

Code :
Code (blitzbasic) Select
; BLITZ 3D/MAX KEYCODE CONVERSION
; BlitzMax similar key codes for B3D,B2D,B+



; LETTERS:
 
 Const KEY_ESCAPE = (1)
Const KEY_RETURN = (28)
 Const KEY_SPACE = (57)
  Const KEY_ALT1 = (56)
 Const KEY_ALT2 = (184)
     Const KEY_Q = (16)
     Const KEY_W = (17)
     Const KEY_E = (18)
     Const KEY_R = (19)
     Const KEY_T = (20)
     Const KEY_Y = (21)
     Const KEY_U = (22)
     Const KEY_I = (23)
     Const KEY_O = (24)
     Const KEY_P = (25)
     Const KEY_A = (30)
     Const KEY_S = (31)
     Const KEY_D = (32)
Const KEY_F = (33)
Const KEY_G = (34)
Const KEY_H = (35)
Const KEY_J = (36)
Const KEY_K = (37)
Const KEY_L = (38)
Const KEY_Z = (44)
Const KEY_X = (45)
Const KEY_C = (46)
Const KEY_V = (47)
Const KEY_B = (48)
Const KEY_N = (49)
Const KEY_M = (50)


; NUMBERS:

Const KEY_1 = (2)  
Const KEY_2 = (3)  
Const KEY_3 = (4)
Const KEY_4 = (5)
Const KEY_5 = (6)  
Const KEY_6 = (7)  
Const KEY_7 = (8)
Const KEY_8 = (9)  
Const KEY_9 = (10)
Const KEY_0 = (11)


;ASCII+:

Const KEY_SUB = (12)
Const KEY_ADD = (78)
Const KEY_EQU = (13)

Const KEY_COLON = (86)
 Const KEY_TAB = (15)
   Const KEY_LSHIFT = (42)
   Const KEY_RSHIFT = (54)
     Const KEY_HASH = (53)
Const KEY_MULTI = (55)
Const  KEY_NUMB = (41)
Const KEY_BACKS = (14)
 Const KEY_DEL = (211)
Const KEY_HOME = (199)
 Const KEY_END = (207)
 Const KEY_PUP = (201)
Const KEY_PDOWN = (209)
 Const KEY_DOT = (83)
   Const KEY_LBRACK = (26)
   Const KEY_RBRACK = (27)
     Const KEY_SMIT = (40)
     Const KEY_SEMI = (39)
      Const KEY_COM = (51)
   Const KEY_INSERT = (210)


   Const KEY_LOCK = (69)
 Const KEY_SCROLL = (70)
    Const KEY_F1 = (59)
    Const KEY_F2 = (60)
Const KEY_F3 = (61)
Const KEY_F4 = (62)
Const KEY_F5 = (63)
Const KEY_F6 = (64)
Const KEY_F7 = (65)
Const KEY_F8 = (66)
Const KEY_F9 = (67)
   Const KEY_F10 = (68)
   Const KEY_F11 = (69)
   Const KEY_F12 = (70)

     Const KEY_UP = (200)
   Const KEY_DOWN = (208)
   Const KEY_LEFT = (203)
  Const KEY_RIGHT = (205)


Comments :


Yasha(Posted 1+ years ago)

 This:
Const KEY_RETURN = (28) And(156)...will produce a constant that doesn't match either keycode.I'm not sure what exactly you were trying to achieve with these "and" lines, but they definitely won't work in an "If KeyDown(KEY_RETURN)".Two keys that happen to have the same glyph painted on the plastic are still completely different keys. You can't check for both with a single code.


Captain Wicker (crazy hillbilly)(Posted 1+ years ago)

 Okay, i fixed! Funny though, I include the file in my bb3d program and replace scan codes with KEY_Whatever and It worked just fine for me.


Yasha(Posted 1+ years ago)

 I actually picked a really bad example, since by chance it happens that (28 And 156) = 28, so that one would have worked for the large return key (but not for the intended reasons)."And" is a bit-mask operation, to put it simply. It takes two integers and produces another integer, which is why you can store the result in an integer constant (and the biggest reason why you can't use it to check for two different keys). The result will only have 1 bits where both of the inputs had 1 bits (it checks that input x "and" input y have a 1 bit in place). To combine 1 bits from two integers you would use Or ...but in both cases you'd get a number that wouldn't match both tests with =, which requires an exact fit. [/i]