sgdk
joy.h
Go to the documentation of this file.
00001 
00033 #ifndef _JOY_H_
00034 #define _JOY_H_
00035 
00036 
00037 #define PORT_1          0x0000
00038 #define PORT_2          0x0001
00039 
00040 
00041 #define JOY_1           0x0000
00042 #define JOY_2           0x0001
00043 #define JOY_3           0x0002
00044 #define JOY_4           0x0003
00045 #define JOY_5           0x0004
00046 #define JOY_6           0x0005
00047 #define JOY_7           0x0006
00048 #define JOY_8           0x0007
00049 #define JOY_NUM         0x0008
00050 #define JOY_ALL         0xFFFF
00051 
00052 
00053 #define BUTTON_UP       0x0001
00054 #define BUTTON_DOWN     0x0002
00055 #define BUTTON_LEFT     0x0004
00056 #define BUTTON_RIGHT    0x0008
00057 #define BUTTON_A        0x0040
00058 #define BUTTON_B        0x0010
00059 #define BUTTON_C        0x0020
00060 #define BUTTON_START    0x0080
00061 #define BUTTON_X        0x0400
00062 #define BUTTON_Y        0x0200
00063 #define BUTTON_Z        0x0100
00064 #define BUTTON_MODE     0x0800
00065 
00066 #define BUTTON_LMB      0x0040
00067 #define BUTTON_MMB      0x0010
00068 #define BUTTON_RMB      0x0020
00069 
00070 #define BUTTON_DIR      0x000F
00071 #define BUTTON_BTN      0x0FF0
00072 #define BUTTON_ALL      0x0FFF
00073 
00074 #define JOY_TYPE_PAD3           0x00
00075 #define JOY_TYPE_PAD6           0x01
00076 #define JOY_TYPE_MOUSE          0x02
00077 #define JOY_TYPE_TRACKBALL      0x03
00078 #define JOY_TYPE_MENACER        0x04
00079 #define JOY_TYPE_JUSTIFIER      0x05
00080 #define JOY_TYPE_PHASER         0x06
00081 #define JOY_TYPE_UNKNOWN        0x0F
00082 
00083 #define PORT_TYPE_MENACER       0x00
00084 #define PORT_TYPE_JUSTIFIER     0x01
00085 #define PORT_TYPE_MOUSE         0x03
00086 #define PORT_TYPE_TEAMPLAYER    0x07
00087 #define PORT_TYPE_PAD           0x0D
00088 #define PORT_TYPE_UNKNOWN       0x0F
00089 #define PORT_TYPE_EA4WAYPLAY    0x10
00090 
00093 #define PORT_TYPE_UKNOWN        PORT_TYPE_UNKNOWN
00094 
00095 #define JOY_SUPPORT_OFF             0x00
00096 #define JOY_SUPPORT_3BTN            0x01
00097 #define JOY_SUPPORT_6BTN            0x02
00098 #define JOY_SUPPORT_MOUSE           0x03
00099 #define JOY_SUPPORT_TRACKBALL       0x04
00100 #define JOY_SUPPORT_TEAMPLAYER      0x05
00101 #define JOY_SUPPORT_EA4WAYPLAY      0x06
00102 #define JOY_SUPPORT_MENACER         0x07
00103 #define JOY_SUPPORT_JUSTIFIER_BLUE  0x08
00104 #define JOY_SUPPORT_JUSTIFIER_BOTH  0x09
00105 #define JOY_SUPPORT_PHASER          0x0A
00106 #define JOY_SUPPORT_ANALOGJOY       0x0B
00107 #define JOY_SUPPORT_KEYBOARD        0x0C
00108 
00109 
00144 typedef void JoyEventCallback(u16 joy, u16 changed, u16 state);
00145 
00146 
00154 void JOY_init();
00155 
00163 void JOY_reset();
00164 
00182 void JOY_setEventHandler(JoyEventCallback *CB);
00214 void JOY_setSupport(u16 port, u16 support);
00215 
00242 u8 JOY_getPortType(u16 port);
00243 
00266 u8 JOY_getJoypadType(u16 joy);
00267 
00301 u16  JOY_readJoypad(u16 joy);
00302 
00325 s16  JOY_readJoypadX(u16 joy);
00326 
00340 s16  JOY_writeJoypadX(u16 joy, u16 pos);
00341 
00364 s16  JOY_readJoypadY(u16 joy);
00365 
00379 s16  JOY_writeJoypadY(u16 joy, u16 pos);
00380 
00385 void JOY_waitPressBtn();
00390 u16 JOY_waitPressBtnTime(u16 ms);
00425 u16 JOY_waitPress(u16 joy, u16 btn);
00463 u16 JOY_waitPressTime(u16 joy, u16 btn, u16 ms);
00464 
00472 void JOY_update();
00473 
00474 
00475 #endif // _JOY_H_
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines