//this is an example input class //it has functions for each input callback //it's specific to the world it works with, #includes it, and has friend access #ifndef __INPUT_H__ #define __INPUT_H__ #include "world.h" #include "playerlocation.h" #define RESET 106 //the key to move players back to the start, add this to the original keydown and who check #define PRINTSTATE 107 class Input { public: Input(); virtual ~Input(); World *s_pWorld; void Init(char* inputFile); //player functions void GoForward(int id); void GoBackward(int id); void GoLeft(int id); void GoRight(int id); void TurnLeft(int id, float angle); void TurnRight(int id, float angle); void LookUp(int id); void LookDown(int id); void GoUp(int id); void GoDown(int id); //camera functions void TranslateX(int id, int sign); void TranslateY(int id, int sign); void TranslateZ(int id, int sign); void RotateX(int id, int sign); void RotateY(int id, int sign); void RotateZ(int id, int sign); void KeyDown(unsigned char key, int x, int y); void KeyDown2(unsigned char key, int x, int y); void KeyUp(unsigned char key, int x, int y); void SKeyDown(int key, int x, int y); void SKeyUp(int key, int x, int y); void MouseMotion(int x, int y); void PassiveMouseMotion(int x, int y); void MouseButton(int button, int state, int x, int y); void Repeats();//repeats actions for anything held down private: int MousePosition[2]; enum MouseButtons { LEFT_BUTTON=0, MIDDLE_BUTTON, RIGHT_BUTTON, NUM_BUTTONS }; bool MouseButtonPressed[NUM_BUTTONS]; static const int MAX_KEYS = 256; bool KeyPressed[MAX_KEYS]; enum {KEY_UP=0, KEY_DOWN, KEY_LEFT, KEY_RIGHT, NUM_SPEC_KEYS}; bool SpecialKeyPressed[NUM_SPEC_KEYS]; enum {GO_FORWARD=0, GO_BACKWARD, GO_LEFT, GO_RIGHT, GO_UP, GO_DOWN, TURN_LEFT, TURN_RIGHT, LOOK_UP, LOOK_DOWN, TOGGLE, ACTION, GLOW, MODE, T_POS_X, T_NEG_X, T_POS_Y, T_NEG_Y, T_POS_Z, T_NEG_Z, R_POS_X, R_NEG_X, R_POS_Y, R_NEG_Y, R_POS_Z, R_NEG_Z, //player 2 controls GO_FORWARD2, GO_BACKWARD2, GO_LEFT2, GO_RIGHT2, GO_UP2, GO_DOWN2, TURN_LEFT2, TURN_RIGHT2, LOOK_UP2, LOOK_DOWN2, TOGGLE2, ACTION2, GLOW2, MODE2, T_POS_X2, T_NEG_X2, T_POS_Y2, T_NEG_Y2, T_POS_Z2, T_NEG_Z2, R_POS_X2, R_NEG_X2, R_POS_Y2, R_NEG_Y2, R_POS_Z2, R_NEG_Z2, NUM_MAPPED_KEYS}; int ActionList[NUM_MAPPED_KEYS]; //change this to array of array for 2 players bool UseToggle; //if ON, allow player/camera control keys to be shared bool InPlayerMode[2]; }; #endif