AdaPower Logged in as Guest
Ada Tools and Resources

Ada 95 Reference Manual
Ada Source Code Treasury
Bindings and Packages
Ada FAQ


Join >
Articles >
Ada FAQ >
Getting Started >
Home >
Books & Tutorials >
Source Treasury >
Packages for Reuse >
Latest Additions >
Ada Projects >
Press Releases >
Ada Audio / Video >
Home Pages >
Links >
Contact >
About >
Login >
Back
Ada Bindings - JoyStickWin32
Ada Bindings to APIs (Non-GUI Related)

   with Win32          ;
   with Win32.mmsystem ;

---------------------------------------------------------
-- ADA Name                    : Win32.Joystick
--
-- Compilation Name            : Win32.Joystick.ads
--
-- CSC Description             : See below
--
-- Machine Dependencies        : Desgined for a PC running Windows 95/NT
--
-- Compiler Dependencies       : Ada 95, GNAT Ada 3.11p
--                                 Any windows functions must have the
--                                 specification declared with a
--                                 pragma (Stdcall , <Name_Of_Function>
--                                 This is ensure the correct number of
--                                 parameters are popped from the stack by
--                                 windows
--
-- Document References         : None
--
-- Miscellaneous Notes         : The package provides level 4 bindings for
--                               joystick support.
--
--
-- Revision History            :
--
--    Author           Date       PCR#     PCR/Reason
--    ------           ----       ----     ----------
--    J. Boulais      07/01/1999              Created.
--
-----------------------------------------------------------

           
   package Win32.Joystick is
           
   
   --JmB--   JOY_POVCENTERED : constant := ( WORD ) - 1 ;     -- mmsystem.h:2049
      JOY_POVFORWARD     : constant := 0     ;                -- mmsystem.h:2050
      JOY_POVRIGHT       : constant := 9000  ;                -- mmsystem.h:2051
      JOY_POVBACKWARD    : constant := 18000 ;                -- mmsystem.h:2051
      JOY_POVLEFT        : constant := 27000 ;                -- mmsystem.h:2053
   
      JOY_RETURNX        : constant := 16#00000001# ;         -- mmsystem.h:2055
      JOY_RETURNY        : constant := 16#00000002# ;         -- mmsystem.h:2056
      JOY_RETURNZ        : constant := 16#00000004# ;         -- mmsystem.h:2057
      JOY_RETURNR        : constant := 16#00000008# ;         -- mmsystem.h:2058
      JOY_RETURNU        : constant := 16#00000010# ;         -- mmsystem.h:2059
      JOY_RETURNV        : constant := 16#00000020# ;         -- mmsystem.h:2060
      JOY_RETURNPOV      : constant := 16#00000040# ;         -- mmsystem.h:2061
      JOY_RETURNBUTTONS  : constant := 16#00000080# ;         -- mmsystem.h:2062
      JOY_RETURNRAWDATA  : constant := 16#00000100# ;         -- mmsystem.h:2063
      JOY_RETURNPOVCTS   : constant := 16#00000200# ;         -- mmsystem.h:2064
      JOY_RETURNCENTERED : constant := 16#00000400# ;         -- mmsystem.h:2065
      JOY_USEDEADZONE    : constant := 16#00000800# ;         -- mmsystem.h:2066
      JOY_RETURNALL      : constant Win32.DWORD               -- mmsystem.h:2067
      := ( JOY_RETURNX or JOY_RETURNY or JOY_RETURNZ   or JOY_RETURNR
            or JOY_RETURNU or JOY_RETURNV or JOY_RETURNPOV or JOY_RETURNBUTTONS ) ;
      JOY_CAL_READALWAYS : constant := 16#00010000# ;         -- mmsystem.h:2070
      JOY_CAL_READXYONLY : constant := 16#00020000# ;         -- mmsystem.h:2071
      JOY_CAL_READ3      : constant := 16#00040000# ;         -- mmsystem.h:2072
      JOY_CAL_READ4      : constant := 16#00080000# ;         -- mmsystem.h:2073
      JOY_CAL_READXONLY  : constant := 16#00100000# ;         -- mmsystem.h:2074
      JOY_CAL_READYONLY  : constant := 16#00200000# ;         -- mmsystem.h:2075
      JOY_CAL_READ5      : constant := 16#00400000# ;         -- mmsystem.h:2076
      JOY_CAL_READ6      : constant := 16#00800000# ;         -- mmsystem.h:2077
      JOY_CAL_READZONLY  : constant := 16#01000000# ;         -- mmsystem.h:2078
      JOY_CAL_READRONLY  : constant := 16#02000000# ;         -- mmsystem.h:2079
      JOY_CAL_READUONLY  : constant := 16#04000000# ;         -- mmsystem.h:2080
      JOY_CAL_READVONLY  : constant := 16#08000000# ;         -- mmsystem.h:2081
   
      type JOYINFOEX
      is record
            dwSize         : Win32.DWORD ;
            dwFlags        : Win32.DWORD ;
            dwXpos         : Win32.DWORD ;
            dwYpos         : Win32.DWORD ;
            dwZpos         : Win32.DWORD ;
            dwRpos         : Win32.DWORD ;
            dwUpos         : Win32.DWORD ;
            dwVpos         : Win32.DWORD ;
            dwButtons      : Win32.DWORD ;
            dwButtonNumber : Win32.DWORD ;
            dwPOV          : Win32.DWORD ;
            dwReserved1    : Win32.DWORD ;
            dwReserved2    : Win32.DWORD ;
         end record ;                                         -- mmsystem.h:2221
   
      type LPJOYINFOEX is access all JOYINFOEX ;              -- mmsystem.h:2221
   
              
      function joyGetPosEx (                                  -- mmsystem.h:2244
                        uJoyId : Win32.UINT  ;
                        pji    : LPJOYINFOEX )
      return Win32.mmSystem.MMRESULT ;
              
   
   pragma Import ( Stdcall, joyGetPosEx, "joyGetPosEx" ) ;
   
   
      MAX_JOYSTICKOEMVXDNAME : constant := 260 ;              -- mmsystem.h:84
   
      type JOYCAPSA
      is record
            wMid        : Win32.WORD ;
            wPid        : Win32.WORD ;
            szPname     : Win32.CHAR_Array ( 0 .. 31 ) ;
            wXmin       : Win32.UINT ;
            wXmax       : Win32.UINT ;
            wYmin       : Win32.UINT ;
            wYmax       : Win32.UINT ;
            wZmin       : Win32.UINT ;
            wZmax       : Win32.UINT ;
            wNumButtons : Win32.UINT ;
            wPeriodMin  : Win32.UINT ;
            wPeriodMax  : Win32.UINT ;
            wRmin       : Win32.UINT ;
            wRmax       : Win32.UINT ;
            wUmin       : Win32.UINT ;
            wUmax       : Win32.UINT ;
            wVmin       : Win32.UINT ;
            wVmax       : Win32.UINT ;
            wCaps       : Win32.UINT ;
            wMaxAxes    : Win32.UINT ;
            wNumAxes    : Win32.UINT ;
            wMaxButtons : Win32.UINT ;
            szRegKey    : Win32.CHAR_Array ( 0 .. 31 ) ;
            szOEMVxD    : Win32.CHAR_Array ( 0 .. MAX_JOYSTICKOEMVXDNAME-1 ) ;
         end record ;                                         -- mmsystem.h:2126
   
      subtype JOYCAPS is JOYCAPSA;                            -- mmsystem.h:2161
   
      type PJOYCAPSA is access all JOYCAPSA;                  -- mmsystem.h:2126
      subtype LPJOYCAPS is PJOYCAPSA;                         -- mmsystem.h:2126
      subtype LPJOYCAPSA is PJOYCAPSA;                        -- mmsystem.h:2126
   
              
      function joyGetDevCapsA(
                        uJoyId: Win32.UINT;
                        lpjc  : LPJOYCAPSA;
                        cbjc  : Win32.UINT)
      return Win32.mmSystem.MMRESULT;              -- mmsystem.h:2230
              
   
              
      function joyGetDevCaps(
                        uJoyId: Win32.UINT;
                        lpjc  : LPJOYCAPSA;
                        cbjc  : Win32.UINT)
      return Win32.mmSystem.MMRESULT
      renames joyGetDevCapsA;                      -- mmsystem.h:2235
              
   
   pragma Import ( Stdcall, joyGetDevCapsA, "joyGetDevCapsA" ) ;
   
   end Win32.Joystick ;


(c) 1998-2004 All Rights Reserved David Botton