home *** CD-ROM | disk | FTP | other *** search
/ NEXT Generation 27 / NEXT27.iso / pc / demos / emperor / dx3.exe / SDK / SAMPLES / IKLOWNS / CGINPUT.H < prev    next >
C/C++ Source or Header  |  1996-08-28  |  3KB  |  75 lines

  1. /*===========================================================================*\
  2. |
  3. |  File:        cginput.h
  4. |
  5. |  Description: 
  6. |       
  7. |-----------------------------------------------------------------------------
  8. |
  9. |  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  10. |
  11. |  Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation
  12. |
  13. \*===========================================================================*/
  14.  
  15. /**************************************************************************
  16.  
  17.     (C) Copyright 1995-1996 Microsoft Corp.  All rights reserved.
  18.  
  19.     You have a royalty-free right to use, modify, reproduce and 
  20.     distribute the Sample Files (and/or any modified version) in 
  21.     any way you find useful, provided that you agree that 
  22.     Microsoft has no warranty obligations or liability for any 
  23.     Sample Application Files which are modified. 
  24.  
  25.     we do not recomend you base your game on IKlowns, start with one of
  26.     the other simpler sample apps in the GDK
  27.  
  28.  **************************************************************************/
  29.  
  30. /*
  31.     The CGameInput class serves as an abstraction layer on top of the
  32.     various input devices which may be attached to the machine.
  33. */
  34.  
  35. #define MOUSE_BUTTON_1  1
  36. #define MOUSE_BUTTON_2  2
  37.  
  38. class CGameInput {
  39. private:
  40.     int joyThere[16]; // 1  if joystick is plugged in, 0 otherwise
  41.     JOYCAPS caps [16];
  42.     JOYINFO cached_joyinfo[16];
  43.  
  44. public:
  45.     /*
  46.         Constructor/destructor.  Allocate any threads or other resources
  47.         required by the object:
  48.     */
  49.     CGameInput(void);
  50.     ~CGameInput(void);
  51.  
  52.     void Flush(void);   // remove input (clean up...)
  53.  
  54.     /*
  55.         HW Query functions: determine whether or not a device exists.
  56.         Return 0 if no such device, > 0 (depending on device) if it does.
  57.     */
  58.     int QKeyboard(void);    // 0= no keyboard, 1= exists
  59.     int QMouse(void);       // 0=no, otherwise num buttons on mouse
  60.     int QJoystick(void);    // 0=none, else number of joysticks
  61.  
  62.     /*
  63.         Input functions: anyone wishing for input needs to call these:
  64.     */
  65.     int GetKeyboard(int yourkey);   // ret: 0=no key available
  66.     //  pass number of keys to check, then array of VKEY codes for keys 
  67.     //  to check.  If any key is *not* depressed, returns 0; else 1
  68.     int QKeyDepressed(int numkeys, int *keyarray);
  69.     //  buttons is bitmap of MOUSE_... returns 0 if no mouse input avail
  70.     int GetMouse(int &xpos, int& ypos, int& buttons);
  71.     //  joystick needs number of joystick to query
  72.     int GetJoystick(int joynum, JOYINFO *joypos);
  73.     void UpdateJoystick(void);
  74. };
  75.