}
if (mainmenu == 10)
endgame = 2;
- if (mainmenu == 18 && Input::isKeyPressed(MOUSEBUTTON2) && selected == 1) {
+ if (mainmenu == 18 && Input::isKeyPressed(MOUSEBUTTON_RIGHT) && selected == 1) {
stereoseparation -= 0.001;
updateStereoConfigMenu();
}
string2 = "in the middle of the training area.";
break;
case 15:
- if (Game::attackkey == MOUSEBUTTON1) {
- string = "Click to attack when you are near an enemy.";
- } else {
- string = std::string("Press ") + Input::keyToChar(Game::attackkey) + " to attack when you are near an enemy.";
- }
+ string = std::string("Press ") + Input::keyToChar(Game::attackkey) + " to attack when you are near an enemy.";
string2 = "You can punch by standing still near an enemy and attacking.";
break;
case 16:
break;
case 20:
string = "Your most powerful individual attack is the rabbit kick.";
- if (Game::attackkey == MOUSEBUTTON1) {
- string2 = "Run at the enemy while holding the mouse button, and press";
- } else {
- string2 = std::string("Run at the enemy while holding ") + Input::keyToChar(Game::attackkey) + ", and press";
- }
+ string2 = std::string("Run at the enemy while holding ") + Input::keyToChar(Game::attackkey) + ", and press";
string3 = std::string("the jump key (") + Input::keyToChar(Game::jumpkey) + ") to attack.";
break;
case 21:
break;
case 24:
string = "You can tackle enemies by running at them animal-style";
- if (Game::attackkey == MOUSEBUTTON1) {
- string2 = std::string("and pressing jump (") + Input::keyToChar(Game::jumpkey) + ") or attack(mouse button).";
- } else {
- string2 = std::string("and pressing jump (") + Input::keyToChar(Game::jumpkey) + ") or attack(" + Input::keyToChar(Game::attackkey) + ").";
- }
+ string2 = std::string("and pressing jump (") + Input::keyToChar(Game::jumpkey) + ") or attack (" + Input::keyToChar(Game::attackkey) + ").";
string3 = "This is especially useful when they are running away.";
break;
case 25:
rightkey = SDL_SCANCODE_D;
drawkey = SDL_SCANCODE_E;
throwkey = SDL_SCANCODE_Q;
- attackkey = MOUSEBUTTON1;
+ attackkey = MOUSEBUTTON_LEFT;
consolekey = SDL_SCANCODE_GRAVE;
newdetail = detail;
bool Input::isKeyDown(int k)
{
- if (k >= SDL_NUM_SCANCODES + 6) // really useful? check that.
+ if (k >= SDL_NUM_SCANCODES + 6) {
return false;
+ }
return keyDown[k];
}
bool Input::isKeyPressed(int k)
{
- if (k >= SDL_NUM_SCANCODES + 6)
+ if (k >= SDL_NUM_SCANCODES + 6) {
return false;
+ }
return keyPressed[k];
}
const char* Input::keyToChar(unsigned short i)
{
- if (i < SDL_NUM_SCANCODES)
+ if (i < SDL_NUM_SCANCODES) {
return SDL_GetKeyName(SDL_GetKeyFromScancode(SDL_Scancode(i)));
- else if (i == MOUSEBUTTON1)
- return "mouse1";
- else if (i == MOUSEBUTTON2)
- return "mouse2";
- else if (i == MOUSEBUTTON3)
- return "mouse3";
- else
+ } else if (i == MOUSEBUTTON_LEFT) {
+ return "mouse left button";
+ } else if (i == MOUSEBUTTON_RIGHT) {
+ return "mouse right button";
+ } else if (i == MOUSEBUTTON_MIDDLE) {
+ return "mouse middle button";
+ } else if (i == MOUSEBUTTON_X1) {
+ return "mouse button 4";
+ } else if (i == MOUSEBUTTON_X2) {
+ return "mouse button 5";
+ } else {
return "unknown";
+ }
}
bool Input::MouseClicked()
{
- return isKeyPressed(SDL_NUM_SCANCODES + SDL_BUTTON_LEFT);
+ return isKeyPressed(MOUSEBUTTON_LEFT);
}
#include <SDL.h>
/**> CONSTANT DECLARATIONS <**/
-#define MOUSEBUTTON1 (SDL_NUM_SCANCODES + SDL_BUTTON_LEFT)
-#define MOUSEBUTTON2 (SDL_NUM_SCANCODES + SDL_BUTTON_RIGHT)
-#define MOUSEBUTTON3 (SDL_NUM_SCANCODES + SDL_BUTTON_MIDDLE)
+#define MOUSEBUTTON_LEFT (SDL_NUM_SCANCODES + SDL_BUTTON_LEFT)
+#define MOUSEBUTTON_RIGHT (SDL_NUM_SCANCODES + SDL_BUTTON_RIGHT)
+#define MOUSEBUTTON_MIDDLE (SDL_NUM_SCANCODES + SDL_BUTTON_MIDDLE)
+#define MOUSEBUTTON_X1 (SDL_NUM_SCANCODES + SDL_BUTTON_X1)
+#define MOUSEBUTTON_X2 (SDL_NUM_SCANCODES + SDL_BUTTON_X2)
/**> FUNCTION PROTOTYPES <**/
class Input