- Main Page
- Classes
- Files

- File List
- File Members

# C:/Users/Public/AGS Final Folder/BFLETCHER D4010283/Source/Game/Source/InputHandler.h

Go to the documentation of this file.

    00001 #ifndef _INPUTHANDLER_H_
    00002 #define _INPUTHANDLER_H_
    00003
    00004 #include "TSingleton.h"
    00005 #include "SDL.h"
    00006
    00007 //#define _GP2X 1 Uncomment for quickly editing in VS.
    00008
    00009 enum eInputKey
    00010 {
    00011         eKeyUp = 0,
    00012         eKeyUpLeft,
    00013         eKeyUpRight,
    00014         eKeyDown,
    00015         eKeyDownLeft,
    00016         eKeyDownRight,
    00017         eKeyLeft,
    00018         eKeyRight,
    00019         eKeyButtonX,
    00020         eKeyButtonY,
    00021         eKeyButtonA,
    00022         eKeyButtonB,
    00023         eKeyButtonL,
    00024         eKeyButtonR,
    00025         eKeyButtonStart,
    00026         eKeyButtonSelect,
    00027         eKeyButtonVolumeUp,
    00028         eKeyButtonVolumeDown,
    00029         eKeyUndefined,
    00030         eNumInputKeys
    00031 };
    00032
    00033 class InputHandler : public TSingleton<InputHandler>
    00034 {
    00035         public:
    00036         InputHandler();
    00037         ~InputHandler();
    00038
    00039         void Update();
    00040
    00041         bool IsKeyDown(const eInputKey &key);
    00042
    00043         protected:
    00044         void RegisterKeyValue(const eInputKey &key, const bool &bIsDown);
    00045
    00046 #ifdef _GP2X
    00047         eInputKey ConvertGP2XToEnum(const Uint8 &button);
    00048         int ConvertEnumToGP2X(const eInputKey &keyType);
    00049
    00050         SDL_Joystick* m_pJoystick;
    00051 #endif
    00052
    00053         bool m_keyArray[eNumInputKeys];
    00054 };
    00055
    00056
    00057 #ifdef _GP2X
    00058
    00059 // #define GP2X_VK_UP              (1 <<  0)
    00060 // #define GP2X_VK_UP_LEFT         (1 <<  1)
    00061 // #define GP2X_VK_LEFT            (1 <<  2)
    00062 // #define GP2X_VK_DOWN_LEFT       (1 <<  3)
    00063 // #define GP2X_VK_DOWN            (1 <<  4)
    00064 // #define GP2X_VK_DOWN_RIGHT      (1 <<  5)
    00065 // #define GP2X_VK_RIGHT           (1 <<  6)
    00066 // #define GP2X_VK_UP_RIGHT        (1 <<  7)
    00067 // #define GP2X_VK_START           (1 <<  8)
    00068 // #define GP2X_VK_SELECT          (1 <<  9)
    00069 // #define GP2X_VK_FL              (1 << 10)
    00070 // #define GP2X_VK_FR              (1 << 11)
    00071 // #define GP2X_VK_FA              (1 << 12)
    00072 // #define GP2X_VK_FB              (1 << 13)
    00073 // #define GP2X_VK_FX              (1 << 14)
    00074 // #define GP2X_VK_FY              (1 << 15)
    00075 // #define GP2X_VK_VOL_UP          (1 << 16)
    00076 // #define GP2X_VK_VOL_DOWN        (1 << 17)
    00077 // #define GP2X_VK_TAT             (1 << 18)
    00078
    00079 #define GP2X_BUTTON_UP              (0)
    00080 #define GP2X_BUTTON_DOWN            (4)
    00081 #define GP2X_BUTTON_LEFT            (2)
    00082 #define GP2X_BUTTON_RIGHT           (6)
    00083 #define GP2X_BUTTON_UPLEFT          (1)
    00084 #define GP2X_BUTTON_UPRIGHT         (7)
    00085 #define GP2X_BUTTON_DOWNLEFT        (3)
    00086 #define GP2X_BUTTON_DOWNRIGHT       (5)
    00087 #define GP2X_BUTTON_CLICK           (18)
    00088 #define GP2X_BUTTON_A               (12)
    00089 #define GP2X_BUTTON_B               (13)
    00090 #define GP2X_BUTTON_Y               (14)
    00091 #define GP2X_BUTTON_X               (15)
    00092 #define GP2X_BUTTON_L               (10)
    00093 #define GP2X_BUTTON_R               (11)
    00094 #define GP2X_BUTTON_START           (8)
    00095 #define GP2X_BUTTON_SELECT          (9)
    00096 #define GP2X_BUTTON_VOLUP           (16)
    00097 #define GP2X_BUTTON_VOLDOWN         (17)
    00098
    00099 #endif
    00100
    00101 #endif