home *** CD-ROM | disk | FTP | other *** search
-
- // Copyright (C) 2002 by Luigi Pino. All Rights Reserved.
-
- /***************************************************************************/
-
- // Button Input
- #define Nothing_Pressed 0
- #define Button_1 1
- #define Button_2 2
- #define Button_3 4
- #define Button_4 8
- #define Button_5 16
- #define Button_6 32
- #define Button_7 64
- #define Button_8 128
- #define Button_9 256
-
- // Direction Input
- #define Up 0
- #define Down 1
- #define Left 2
- #define Right 3
-
- // Input Type
- #define Keyboard_1 0
- #define Keyboard_2 1
- #define Joystick_1 2
- #define Joystick_2 3
- #define Joystick_3 4
- #define Joystick_4 5
- #define Computer 6
- #define No_User 7
-
- // Joystick naming
- #define ERROR_NOTOEM -1
-
- /***************************************************************************/
-
- class Controller_Class {
- private:
- class Joystick_Class {
- public:
- Joystick_Class();
- ~Joystick_Class();
-
- int forth_axis; // Forth axis
- int fifth_axis; // Fifth axis
- int sixth_axis; // Sixth axis
- int point_of_view; // Point of view
- JOYINFOEX info; // Tag
- };
-
- class Keyboard_Class {
- public:
- Keyboard_Class();
- ~Keyboard_Class();
-
- void Set_Keys(int b0, int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8,
- int bup, int bdown, int bleft, int bright);
-
- int button_id[9]; // Button id
- int direction_id[4]; // Direction id
- };
-
- public:
- Controller_Class(); // Constructor
- ~Controller_Class(); // Deconstructor
-
- void Clear(); // Clears button and movement input
- void Get_Info(); // Joystick/keyboard button/movement information
-
- Joystick_Class joystick; // Joystick input
- Keyboard_Class keyboard; // Keyboard input
- float2 button[9]; // \. Amount pressed (x = current interval, y = total interval)
- float2 direction[4]; // /
- int user; // Keyboard, joystick, computer controlled or none
- };
-
- class Mouse_Class {
- public:
- Mouse_Class();
- ~Mouse_Class();
-
- void Clear(); // Clears button and movement input
- void Get_Info(bool out_of_bounds_reset); // Mouse button/movement information
-
- float2 button[3]; // 0 - left, 1 - right, 2 - middle
- float2 change; // Change in position
- POINT current; // New position
- POINT last; // Old position
- };
-
- /***************************************************************************/
-
- class Timing_Class {
- public:
- Timing_Class(); // Constructor
- ~Timing_Class(); // Deconstructor
-
- unsigned Get_CPU_Cycle();
- float Get_Frequency();
- float Get_Scale();
- void Update();
-
- private:
- void Calculate_Frequency();
-
- bool precision_testing; // Which timing function to use
- float frequency; // MHz of computer
- float scale; // Time interval between cycle calls
- unsigned cycle_end; // End of cycle call
- unsigned cycle_start; // Start of cycle call
- };
-
- /***************************************************************************/
-
- MMRESULT Get_Joystick_Name(UINT id, TCHAR * pszName);
-
- bool Interval(float2 *key, float interval);
-
- /***************************************************************************/