/****************************************************************************** Mouse.h : Definition of structures and Macros for mouse Author : JENTEY F. Last update : 09/08/97 ******************************************************************************/ #ifndef _INO_MOUSE_H #define _INO_MOUSE_H #include "cpa_std.h" #include "GLD.h" #include "dinput.h" #ifndef u_short #define u_short unsigned short #endif #ifndef u_long #define u_long unsigned long #endif /**************************************/ #ifndef CPA_EXPORT #if defined(CPA_WANTS_IMPORT) #define CPA_EXPORT __declspec(dllimport) #elif defined(CPA_WANTS_EXPORT) #define CPA_EXPORT __declspec(dllexport) #else #define CPA_EXPORT #endif #endif /**************************************/ /* All functions return a short value that should be compared with this constant */ #define C_wMouseError 32767 #define C_wMouseTrue 32766 #define C_wMouseFalse 32765 /* Mouse error code */ #define C_FirstErrorMouse 0x3000 #define C_ErrMouseInvalidGLDDeviceHandle ( C_FirstErrorMouse + 0 ) #define C_ErrMouseNotInitialized ( C_FirstErrorMouse + 1 ) #define C_ErrMouseFailedGettingDeviceAttributes ( C_FirstErrorMouse + 2 ) #define C_ErrNoGLDDeviceLinkedWithMouse ( C_FirstErrorMouse + 3 ) #define C_ErrMouseFocusLost ( C_FirstErrorMouse + 4 ) #define C_ErrMouseDirectInputError ( C_FirstErrorMouse + 5 ) #if defined(__cplusplus) extern "C" { /**************************************************************/ /* Init mouse with the given GLD Device */ CPA_EXPORT short INO_fn_wInitMouseWithGLD(HINSTANCE hInstance, GLD_tdhDevice tdGLDDeviceHandle); /**************************************************************/ /* Init mouse with the given window */ /* INO_fn_wGetMousePositionInGldDevice isn't available */ CPA_EXPORT short INO_fn_wInitMouse(HINSTANCE hInstance, HWND hWindow); /**************************************************************/ /* Release mouse ressource */ CPA_EXPORT short INO_fn_wFreeMouse(void); /**************************************************************/ /* Get mouse capabilities */ CPA_EXPORT short INO_fn_wGetMouseNumberOfButtons(void); CPA_EXPORT short INO_fn_wGetMouseNumberOfAxes(void); /**************************************************************/ /* The polling function to call each engine loop */ CPA_EXPORT short INO_fn_wReadMouse(void); /**************************************************************/ /* Give the current mouse position in the attached GLD Device */ /* For a 640, 480 device: */ /* (0.0 , 0.0) means (0 , 0) in pixel coordinate */ /* (1.0 , 1.0) means (639 , 439) in pixel coordinate */ CPA_EXPORT short INO_fn_wGetMousePositionInGldDevice(float *p_fX, float *p_fY); /**************************************************************/ CPA_EXPORT short INO_fn_wGetMousePosition(int *p_iX, int *p_iY); /* Mouse Button state */ CPA_EXPORT short INO_fn_wLeftMouseButtonDown(void); CPA_EXPORT short INO_fn_wRightMouseButtonDown(void); CPA_EXPORT short INO_fn_wLeftMouseButtonJustDown(void); CPA_EXPORT short INO_fn_wRightMouseButtonJustDown(void); CPA_EXPORT short INO_fn_wLeftMouseButtonJustUp(void); CPA_EXPORT short INO_fn_wRightMouseButtonJustUp(void); /**************************************************************/ /* Get mouse last error code */ CPA_EXPORT u_long INO_fn_ulGetMouseErrorCode(void); } #else /* C prototype */ extern CPA_EXPORT short INO_fn_wInitMouseWithGLD(HINSTANCE hInstance, GLD_tdhDevice tdGLDDeviceHandle); extern CPA_EXPORT short INO_fn_wInitMouse(HINSTANCE hInstance, HWND hWindow); extern CPA_EXPORT short INO_fn_wFreeMouse(void); extern CPA_EXPORT short INO_fn_wGetMouseNumberOfButtons(void); extern CPA_EXPORT short INO_fn_wGetMouseNumberOfAxes(void); extern CPA_EXPORT short INO_fn_wReadMouse(void); extern CPA_EXPORT short INO_fn_wGetMousePositionInGldDevice(float *p_fX, float *p_fY); extern CPA_EXPORT short INO_fn_wGetMousePosition(int *p_iX, int *p_iY); extern CPA_EXPORT short INO_fn_wLeftMouseButtonDown(void); extern CPA_EXPORT short INO_fn_wRightMouseButtonDown(void); extern CPA_EXPORT short INO_fn_wLeftMouseButtonJustDown(void); extern CPA_EXPORT short INO_fn_wRightMouseButtonJustDown(void); extern CPA_EXPORT short INO_fn_wLeftMouseButtonJustUp(void); extern CPA_EXPORT short INO_fn_wRightMouseButtonJustUp(void); extern CPA_EXPORT u_long INO_fn_ulGetMouseErrorCode(void); #endif #endif /* _INO_MOUSE_H */