comp.lang.ada
 help / color / mirror / Atom feed
* Joystick control
@ 1999-05-06  0:00 jboulais
  1999-05-06  0:00 ` Tom Moran
  0 siblings, 1 reply; 4+ messages in thread
From: jboulais @ 1999-05-06  0:00 UTC (permalink / raw)


I am trying to write an application that supports a joystick.  Does anyone
have suggestions of places I can go for info?  How do I monitor for joystick
messages if I'm using GLUT to control my windows?  Thanks...

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Joystick control
  1999-05-06  0:00 Joystick control jboulais
@ 1999-05-06  0:00 ` Tom Moran
  1999-05-06  0:00   ` jboulais
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Moran @ 1999-05-06  0:00 UTC (permalink / raw)


>I am trying to write an application that supports a joystick.
My ancient DOS code for joystick buttons is

  type joybuttons is record
    button_a:boolean;
    button_b:boolean;
    button_c:boolean;
    button_d:boolean;
  end record;
  for joybuttons use record
    button_a at 0 range 7 .. 7;
    button_b at 0 range 6 .. 6;
    button_c at 0 range 5 .. 5;
    button_d at 0 range 4 .. 4;
  end record;

  function joy return joybuttons is
    b:byte;
    function convert is new unchecked_conversion(byte, joybuttons);
  begin
    inport(16#200#, b);
    return convert(b);
  end joy;

Getting x,y positions at that level is less convenient because
basically
you have to send a byte, then see how long it takes for different bits
to become 1 - time is proportional to coordinate.  An easier way
is to do an interrupt 16#15# with AX = 16#84#.  If DX = 0 you'll
get "joybuttons" back in AL, if DX = 1 you'll get x,y of joystick one
back in AX,BX, and x,y of joystick two in CX,DX.  I don't include
that code here because calling an interrupt is even more compiler
library specific than "inport" IO.
  Of course if you are running under an OS that insulates you from the
joystick, you'll have to look in that OS's docs to see how to input
joystick info.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Joystick control
  1999-05-06  0:00 ` Tom Moran
@ 1999-05-06  0:00   ` jboulais
  1999-05-06  0:00     ` Robert Dewar
  0 siblings, 1 reply; 4+ messages in thread
From: jboulais @ 1999-05-06  0:00 UTC (permalink / raw)


Yes, perhaps I should have mentioned that I am developing under Windows NT,
using the Win32api and gnat311p.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Joystick control
  1999-05-06  0:00   ` jboulais
@ 1999-05-06  0:00     ` Robert Dewar
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1999-05-06  0:00 UTC (permalink / raw)


In article <7gso7v$csg$1@nnrp1.deja.com>,
  jboulais@my-dejanews.com wrote:
> Yes, perhaps I should have mentioned that I am developing under Windows NT,
> using the Win32api and gnat311p.

Then this is a win32 question and not a GNAT question. Just find out
how to do joystick control using win32 (there are a million books
out there documenting this interface, including some from MS itself).
Since you have the Microsoft SDK (because otherwise you can't use the
Win32 bindings), the documentation can for example be found in the SDK.
THen adapting this knowledge to GNAT should be trivial.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-05-06  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-06  0:00 Joystick control jboulais
1999-05-06  0:00 ` Tom Moran
1999-05-06  0:00   ` jboulais
1999-05-06  0:00     ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox