mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-06-03 03:23:33 +02:00
4fa435f784
This is a lot of copy-pasted code, but a little bit of copy-pasting never hurt anyone... The keybind to interact with activity zones and teleporters is now separate from the keybind to open the map, or return to the editor from in-editor playtesting, or restart a time trial. The keybind is now E, and the default controller bind is X. No controller button prompts, but the game didn't have controller button prompts anyways, so whatever. Doing this now because if people's muscle memory are going to be broken by not being able to spam the map keybind anymore, at least we can help a bit by changing the keybind so they can keep spamming it - their muscle memory is going to be broken anyways. This option has to be enabled by going to the speedrunner menu options and selecting "interact button". It is disabled by default. All prompt text needs to be string-interpolated every time they are drawn, because it is possible for people to change which interact button they use in the middle of gameplay, via the in-game options. Closes #736.
84 lines
1.5 KiB
C++
84 lines
1.5 KiB
C++
#ifndef KEYPOLL_H
|
|
#define KEYPOLL_H
|
|
|
|
#include <map> // FIXME: I should feel very bad for using C++ -flibit
|
|
#include <SDL.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
enum Kybrd
|
|
{
|
|
KEYBOARD_UP = SDLK_UP,
|
|
KEYBOARD_DOWN = SDLK_DOWN,
|
|
KEYBOARD_LEFT = SDLK_LEFT,
|
|
KEYBOARD_RIGHT = SDLK_RIGHT,
|
|
KEYBOARD_ENTER = SDLK_RETURN,
|
|
KEYBOARD_SPACE = SDLK_SPACE,
|
|
|
|
KEYBOARD_w = SDLK_w,
|
|
KEYBOARD_s = SDLK_s,
|
|
KEYBOARD_a = SDLK_a,
|
|
KEYBOARD_d = SDLK_d,
|
|
KEYBOARD_e = SDLK_e,
|
|
KEYBOARD_m = SDLK_m,
|
|
KEYBOARD_n = SDLK_n,
|
|
|
|
KEYBOARD_v = SDLK_v,
|
|
KEYBOARD_z = SDLK_z,
|
|
|
|
KEYBOARD_BACKSPACE = SDLK_BACKSPACE
|
|
};
|
|
|
|
class KeyPoll
|
|
{
|
|
public:
|
|
std::map<SDL_Keycode, bool> keymap;
|
|
|
|
bool isActive;
|
|
|
|
bool resetWindow;
|
|
|
|
void toggleFullscreen(void);
|
|
|
|
int sensitivity;
|
|
|
|
int inline getThreshold(void);
|
|
|
|
KeyPoll(void);
|
|
|
|
void enabletextentry(void);
|
|
|
|
void disabletextentry(void);
|
|
|
|
void Poll(void);
|
|
|
|
bool isDown(SDL_Keycode key);
|
|
|
|
bool isDown(std::vector<SDL_GameControllerButton> buttons);
|
|
bool isDown(SDL_GameControllerButton button);
|
|
bool controllerButtonDown(void);
|
|
bool controllerWantsLeft(bool includeVert);
|
|
bool controllerWantsRight(bool includeVert);
|
|
|
|
int leftbutton, rightbutton, middlebutton;
|
|
int mx, my;
|
|
|
|
bool textentry(void);
|
|
bool pressedbackspace;
|
|
std::string keybuffer;
|
|
|
|
bool linealreadyemptykludge;
|
|
|
|
private:
|
|
std::map<SDL_JoystickID, SDL_GameController*> controllers;
|
|
std::map<SDL_GameControllerButton, bool> buttonmap;
|
|
int xVel, yVel;
|
|
Uint32 wasFullscreen;
|
|
};
|
|
|
|
#ifndef KEY_DEFINITION
|
|
extern KeyPoll key;
|
|
#endif
|
|
|
|
#endif /* KEYPOLL_H */
|