Page 1 of 1

InitKeyboard() Problem

Posted: Sat Sep 10, 2005 3:40 pm
by larry
I first posted this under Coding Questions but no one had an answer, this makes me believe it is a problem unique to Linux. I am running Fedora Core 4 and PureBasic 3.94 for Linux.

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

8)

Posted: Tue Mar 07, 2006 1:01 am
by MadMax
I have the same problem on Fedora 3.

Maybe no one uses PB to code games for Linux :cry:

:evil: I hate having to use Blitzmax :evil:

Posted: Tue Mar 07, 2006 1:15 am
by Fred
Could you try with debugger off to see if it works ?

Posted: Tue Mar 07, 2006 1:46 am
by MadMax
Kind of works, but #PB_Keyboard_Pushed works like #PB_Keyboard_Released.

#PB_Keyboard_Released works as expected

Ah no sorry!!! Works fine. I had InitKeyboard() before ExamineKeyboard(). I did this in desperation.

Thanks for your help Fred