InitKeyboard() Problem

Linux specific forum
larry
New User
New User
Posts: 9
Joined: Fri Sep 02, 2005 7:31 pm

InitKeyboard() Problem

Post 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)
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post 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:
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Could you try with debugger off to see if it works ?
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post 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
Post Reply