May 31, 2020, 04:40:25 PM

Author Topic: [bb] Max KeyCodes for B3D,B2D,B+ by Captain Wicker (crazy hillbilly) [ 1+ years ago ]  (Read 1085 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
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
  1. ; BLITZ 3D/MAX KEYCODE CONVERSION
  2. ; BlitzMax similar key codes for B3D,B2D,B+
  3.  
  4.  
  5.  
  6. ; LETTERS:
  7.  
  8.  Const KEY_ESCAPE = (1)
  9. Const KEY_RETURN = (28)
  10.  Const KEY_SPACE = (57)
  11.   Const KEY_ALT1 = (56)
  12.  Const KEY_ALT2 = (184)
  13.      Const KEY_Q = (16)
  14.      Const KEY_W = (17)
  15.      Const KEY_E = (18)
  16.      Const KEY_R = (19)
  17.      Const KEY_T = (20)
  18.      Const KEY_Y = (21)
  19.      Const KEY_U = (22)
  20.      Const KEY_I = (23)
  21.      Const KEY_O = (24)
  22.      Const KEY_P = (25)
  23.      Const KEY_A = (30)
  24.      Const KEY_S = (31)
  25.      Const KEY_D = (32)
  26.          Const KEY_F = (33)
  27.          Const KEY_G = (34)
  28.          Const KEY_H = (35)
  29.          Const KEY_J = (36)
  30.          Const KEY_K = (37)
  31.          Const KEY_L = (38)
  32.          Const KEY_Z = (44)
  33.          Const KEY_X = (45)
  34.          Const KEY_C = (46)
  35.          Const KEY_V = (47)
  36.          Const KEY_B = (48)
  37.          Const KEY_N = (49)
  38.          Const KEY_M = (50)
  39.  
  40.  
  41. ; NUMBERS:
  42.  
  43.         Const KEY_1 = (2)  
  44.         Const KEY_2 = (3)  
  45.         Const KEY_3 = (4)
  46.         Const KEY_4 = (5)
  47.         Const KEY_5 = (6)  
  48.         Const KEY_6 = (7)  
  49.         Const KEY_7 = (8)
  50.         Const KEY_8 = (9)  
  51.         Const KEY_9 = (10)
  52.         Const KEY_0 = (11)
  53.  
  54.  
  55. ;ASCII+:
  56.        
  57.         Const KEY_SUB = (12)
  58.         Const KEY_ADD = (78)
  59.         Const KEY_EQU = (13)
  60.        
  61.         Const KEY_COLON = (86)
  62.           Const KEY_TAB = (15)
  63.    Const KEY_LSHIFT = (42)
  64.    Const KEY_RSHIFT = (54)
  65.      Const KEY_HASH = (53)
  66.         Const KEY_MULTI = (55)
  67.         Const  KEY_NUMB = (41)
  68.         Const KEY_BACKS = (14)
  69.           Const KEY_DEL = (211)
  70.          Const KEY_HOME = (199)
  71.           Const KEY_END = (207)
  72.           Const KEY_PUP = (201)
  73.         Const KEY_PDOWN = (209)
  74.           Const KEY_DOT = (83)
  75.    Const KEY_LBRACK = (26)
  76.    Const KEY_RBRACK = (27)
  77.      Const KEY_SMIT = (40)
  78.      Const KEY_SEMI = (39)
  79.       Const KEY_COM = (51)
  80.    Const KEY_INSERT = (210)
  81.  
  82.  
  83.    Const KEY_LOCK = (69)
  84.  Const KEY_SCROLL = (70)
  85.     Const KEY_F1 = (59)
  86.     Const KEY_F2 = (60)
  87.         Const KEY_F3 = (61)
  88.         Const KEY_F4 = (62)
  89.         Const KEY_F5 = (63)
  90.         Const KEY_F6 = (64)
  91.         Const KEY_F7 = (65)
  92.         Const KEY_F8 = (66)
  93.         Const KEY_F9 = (67)
  94.    Const KEY_F10 = (68)
  95.    Const KEY_F11 = (69)
  96.    Const KEY_F12 = (70)
  97.        
  98.      Const KEY_UP = (200)
  99.    Const KEY_DOWN = (208)
  100.    Const KEY_LEFT = (203)
  101.   Const KEY_RIGHT = (205)


Comments :


Yasha(Posted 1+ years ago)

 This:
Code: [Select]
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]

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal