summary refs log tree commit diff stats
path: root/src/sign.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sign.cpp')
-rw-r--r--src/sign.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sign.cpp b/src/sign.cpp index e488108..46a1d6e 100644 --- a/src/sign.cpp +++ b/src/sign.cpp
@@ -52,10 +52,13 @@ void Sign::displayMessage(std::string text) {
52 52
53void Sign::update(size_t dt, Game& game) { 53void Sign::update(size_t dt, Game& game) {
54 SDL_Event e; 54 SDL_Event e;
55 bool pressedSpace = false;
55 56
56 while (SDL_PollEvent(&e)) { 57 while (SDL_PollEvent(&e)) {
57 if (e.type == SDL_QUIT) { 58 if (e.type == SDL_QUIT) {
58 game.quit = true; 59 game.quit = true;
60 } else if (e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_SPACE && e.key.repeat == 0) {
61 pressedSpace = true;
59 } 62 }
60 } 63 }
61 64
@@ -81,8 +84,7 @@ void Sign::update(size_t dt, Game& game) {
81 break; 84 break;
82 } 85 }
83 case SignInstructionState::Visible: { 86 case SignInstructionState::Visible: {
84 const Uint8* state = SDL_GetKeyboardState(NULL); 87 if (pressedSpace) {
85 if (state[SDL_SCANCODE_SPACE]) {
86 bool fullyRevealed = true; 88 bool fullyRevealed = true;
87 for (const SignLine& line : linesToShow) { 89 for (const SignLine& line : linesToShow) {
88 if (line.charsRevealed != line.text.size()) { 90 if (line.charsRevealed != line.text.size()) {