Page 1 sur 1
[OK] Oublie de conversion AZERTY/QWERTY via KeyboardPush ?
Publié : sam. 21/mai/2016 12:28
par Ar-S
Salut,
En bidouillant sur un petit jeu 2D utilisant le clavier, je viens de m'apercevoir d'un petit truc troublant concernant KeyboardPushed
Si on ordonne aux touches Q et D de gérer la gauche et la droite, on s'aperçoit que le Q ne fonctionne pas.
En effet, If KeyboardPushed(#PB_Key_Q) gère la touche A, comme si le clavier était en QWERTY. Du coup j'ai testé Z pour confirmer et effectivement c'est la touche W sur nos claviers FR qui répond.
Est-ce un oublie qui sera corrigé ou faut il s'adapter ?
Pensez vous que je le signale en bug au fofo US ? (Fred si tu me lis).
Re: Bug ou Oublie de conversion AZERTY/QWERTY via KeyboardPu
Publié : sam. 21/mai/2016 12:47
par falsam
KeyboardMode(#PB_Keyboard_International) juste aprés l'ouverture du screen 2D
Code : Tout sélectionner
If Not (InitSprite() And InitKeyboard())
End
EndIf
OpenWindow(0, 0, 0, 800, 600, "Keyboard International", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)
KeyboardMode(#PB_Keyboard_International)
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
Until Event=0
ClearScreen(RGB(135, 206, 235))
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Q)
Debug "Q"
EndIf
If KeyboardPushed(#PB_Key_D)
Debug "D"
EndIf
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
Re: [OK] Oublie de conversion AZERTY/QWERTY via KeyboardPush
Publié : sam. 21/mai/2016 12:56
par Ar-S
Nikel merci, je suis passé à coté.
cette commande serait celle par défaut (plutôt que qwerty) que tout le monde serait content non ?
Re: [OK] Oublie de conversion AZERTY/QWERTY via KeyboardPush
Publié : sam. 21/mai/2016 13:01
par falsam
Il y a bien plus de clavier Qwerty dans le monde que de clavier Azerty.
Re: [OK] Oublie de conversion AZERTY/QWERTY via KeyboardPush
Publié : sam. 21/mai/2016 15:59
par Ar-S
Oui mais KeyboardMode(#PB_Keyboard_International) est justement censé s'adapter non ?
Re: [OK] Oublie de conversion AZERTY/QWERTY via KeyboardPush
Publié : sam. 21/mai/2016 17:14
par case
sinon pour info il y a TOUJOURS un bug avec le clavier fr
http://www.purebasic.fr/english/viewtop ... =4&t=45836
posté en 2011 ^^ et toujours d'actualité
Code : Tout sélectionner
InitKeyboard()
main=OpenWindow(#PB_Any,0,0,640,200,"test",#PB_Window_ScreenCentered)
InitSprite()
OpenWindowedScreen(WindowID(main),0,0,640,200,0,0,0)
KeyboardMode(#PB_Keyboard_Qwerty)
Repeat
ExamineKeyboard()
ClearScreen(0)
For a=1 To 256
If KeyboardPushed(a)
ClearScreen($0000ff)
EndIf
Next
StartDrawing(ScreenOutput())
DrawText(0,0,"qwerty keyboard")
DrawText(0,16,"press the key next to N")
DrawText(0,32,"press escape to change keyboard mode")
StopDrawing()
FlipBuffers()
WaitWindowEvent(0)
Until KeyboardPushed(#PB_Key_Escape)
Repeat
ExamineKeyboard()
Until KeyboardReleased(#PB_Key_Escape)
KeyboardMode(#PB_Keyboard_International)
Repeat
ExamineKeyboard()
ClearScreen(0)
For a=1 To 256
If KeyboardPushed(a)
ClearScreen($ff0000)
EndIf
Next
StartDrawing(ScreenOutput())
DrawText(0,0,"international keyboard")
DrawText(0,16,"press the key next to N")
DrawText(0,32,"the key is not tested this is not a special key in my country layout (FR)")
DrawText(0,48,"press escape to change keyboard mode")
StopDrawing()
FlipBuffers()
WaitWindowEvent(0)
Until KeyboardPushed(#PB_Key_Escape)
Repeat
ExamineKeyboard()
Until KeyboardReleased(#PB_Key_Escape)
Repeat
ExamineKeyboard()
ClearScreen(0)
;For a=1 To 256
If KeyboardPushed(#PB_Key_All)
ClearScreen($ff00ff)
EndIf
;Next
StartDrawing(ScreenOutput())
DrawText(0,0,"international keyboard")
DrawText(0,16,"press the key next to N")
DrawText(0,32,"the key works when using #pb_all to chek the keydown")
DrawText(0,48,"press escape to change keyboard mode")
StopDrawing()
FlipBuffers()
WaitWindowEvent(0)
Until KeyboardPushed(#PB_Key_Escape)
KeyboardMode(#PB_Keyboard_International|#PB_Keyboard_AllowSystemKeys)
Repeat
ExamineKeyboard()
ClearScreen(0)
For a=1 To 256
If KeyboardPushed(a)
ClearScreen($00ff00)
EndIf
Next
StartDrawing(ScreenOutput())
DrawText(0,0,"#PB_Keyboard_International|#PB_Keyboard_AllowSystemKeys")
DrawText(0,16,"press the key next to N")
DrawText(0,32,"the key is tested but special keys are activated so may cause bugs")
DrawText(0,48,"press escape to change keyboard mode")
StopDrawing()
FlipBuffers()
WaitWindowEvent(0)
Until KeyboardPushed(#PB_Key_Escape)