This program is in the examples provided by PB. I did not change it in any way. The beginning of the program is shown below. Result of InitKeyboard() is 1 (good), ExamineKeyboard() (or any other keyboard command) produces: "[ERROR] InitKeyboard() must be called before use the keyboard commands." Other programs without keyboard commands compile and run fine. Any ideas? Is this a bug?
Code: Select all
If InitKeyboard() = 0
MessageRequester("Error", "Can't open DirectX 7", 0)
End
EndIf
If InitSprite() = 0
MessageRequester("Error", "Can't open DirectX 7", 0)
End
EndIf
MessageRequester("Information", "This will test the fast keyboard access..."+Chr(10)+"Press 'ESC' to quit!", 0)
If OpenScreen(640, 480, 16, "Sprite")
x = 100
y = 100
If LoadSprite(0, "data/Player_1.bmp", 0) = 0
CloseScreen()
MessageRequester("PureBasic", "Can't load the sprite file (data/Player_1.bmp)", 0)
End
EndIf
Repeat
FlipBuffers()
ClearScreen(0,0,0)
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
x-1
EndIf
If KeyboardPushed(#PB_Key_Right)
x+1
EndIf
If KeyboardPushed(#PB_Key_Up)
y-1
EndIf

