I was trying to test keyboard input in Linux PB 5.73 on OpenSuse 15.3 and the OpenScreen() function causes the program to stop working with an invalid memory access error. Can anyone advise me on the potential fix for this problem?
Define lnKey.i
If Not InitSprite()
ElseIf Not InitKeyboard()
ElseIf Not OpenScreen(100,100,16,"Keyboard")
Else
Repeat
ExamineKeyboard()
lnKey = KeyboardPushed(#PB_Key_All) ; press Esc to quit
If lnKey = #PB_Key_Escape
End
Else
Debug lnKey
EndIf
ForEver
EndIf
I think you must use a valid monitor resolution, so 100x100 must not work. For example, you can use 1024x768, 800x600... or use OpenWindowedScreen() instead for lower resolutions.
The only thing the code is suppose to do is to allow me to test the KeyboardPushed() function because the keyboard has a non-standard key called "Cancel" whose value I want to determine.
I was assuming the value returned from the KeyboadPushed() function would be the key value but it appears I was confusing PB with other software that I use that does return the key value pressed. So I will have to change my code to find the correct key value for the non-standard key.
However, I still need to solve the OpenScreen issue.
Simon
Last edited by swhite on Wed Dec 15, 2021 6:09 pm, edited 1 time in total.
The KeyBoardPushed() example does not work. I get am IMA on the very first line. Neither does the OpenWindowedScreen example in the doc work. It gets an IMA on the OpenWindowedScreen().
I don't get the warning by the way. Maybe some library versions on your system don't match? I don't know really. Maybe try the checkinstall script that comes with purebasic.