Page 1 of 2

QL & PC Joysticks

Posted: Fri Aug 17, 2018 6:03 am
by stevepoole
Hi,
I have a working QL Joystick, with a 9 pin D socket, and 6 pin adapter.
It translates 4 arrow keys, with fire and base buttons.

I have written a shootem up game in full 3D perspective animation on QPC2.
Is there any way to adapt the joystick for a laptop?
i.e: it would need an adapter for USB no doubt, if such a thing exists.

Commercial PC 'Joysticks' do not seem to be compatible with QPC2...
Regards,
Steve Poole.

Re: QL & PC Joysticks

Posted: Fri Aug 17, 2018 9:14 am
by vanpeebles
I reckon there must be a way of mapping the PC joystick to the keys on the game?

Re: QL & PC Joysticks

Posted: Fri Aug 17, 2018 9:50 am
by tofro
vanpeebles wrote:I reckon there must be a way of mapping the PC joystick to the keys on the game?
There is -this one is just an example of many possibilities that might be worth trying.

Re: QL & PC Joysticks

Posted: Fri Aug 17, 2018 1:04 pm
by vanpeebles
Any screenshots of the game? Sounds interesting! :ugeek:

Re: QL & PC Joysticks

Posted: Fri Aug 17, 2018 1:13 pm
by Peter
Sounds cool, any chance it will run on native hardware?

Re: QL & PC Joysticks

Posted: Fri Aug 17, 2018 9:20 pm
by stevepoole
Thanks for the replies,

I was hoping not to buy a PC joystick, as I have been quoted some pretty onerous prices for them.
Tofro's mapping method may be an option though, if I have no choice with my QL joystick.

I take it a screen-shot would be loaded onto the Forum via the 'Img' button above. I have not used this feature before.

As for native hardware, the program is fast enough on QPC2, but too slow on my SGC QL...

BTW, I can find no way to clear out the keyboard Queue completely. No doubt this is done to avoid people writing keyloggers?

Regards,
Steve Poole.

Re: QL & PC Joysticks

Posted: Fri Aug 17, 2018 9:41 pm
by stevepoole
Capture d’écran (59).png
Hi,
This is my first attempt to load a screenshot...

The program draws a 'hilly' draughtsboard. You fly around the scenery shooting at the draughts, against the clock.

(Just a rapid programming exercise, to test some general subroutine updates).

Two players can even play a game of draughts on it, but not against the QL.

Regards,
Steve Poole.

Re: QL & PC Joysticks

Posted: Fri Aug 17, 2018 10:13 pm
by RWAP
Looks intriguing :)

Re: QL & PC Joysticks

Posted: Sat Aug 25, 2018 8:28 pm
by stevepoole
Hi,
The game could be accelerated considerably, if the keyboard queue could be cleared at will.
Unfortunately, both inkey$ and Keyrow constructs do not clear it, even though documentation states the opposite for the latter.
This means you have to 'peck' rapidly at keys, rather than, say, pressing an arrowkey continuously.
Machine code games seem to avoid this problem, but this game is written in SBasic... Perhaps m/c Pokes some obscure address to clear it out ?
Any suggestions ?
Steve Poole.

Re: QL & PC Joysticks

Posted: Sat Aug 25, 2018 10:38 pm
by pjw
stevepoole wrote:Hi,
The game could be accelerated considerably, if the keyboard queue could be cleared at will.
Unfortunately, both inkey$ and Keyrow constructs do not clear it, even though documentation states the opposite for the latter.
This means you have to 'peck' rapidly at keys, rather than, say, pressing an arrowkey continuously.
Machine code games seem to avoid this problem, but this game is written in SBasic... Perhaps m/c Pokes some obscure address to clear it out ?
Any suggestions ?
Steve Poole.
I had this problem years ago and wrote a small toolkit to solve it. Then I discovered that a dummy keyrow call before the inkey$ does the same. Are you saying this doesnt work for you?

Code: Select all

k = KEYROW(0)
k$ = INKEY$(#ch; timeout)
Another thing you might try is

Code: Select all

rep lp: if inkey$(#ch; 0) = "": exit lp:endif:endrep lp
If thats no good, I could send you my ClearQ toolkit to try.