diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2015-12-03 07:46:23 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2015-12-03 07:46:23 -0500 |
commit | bf91141782766f3648b62c6d96528fddb9ae7447 (patch) | |
tree | c6c9322ec7c4f111f05c7f639ab1d33bed9de40f /src/ui.cpp | |
parent | dc24164926a7988e018d32fff1977d2b40c89057 (diff) | |
parent | 6b44ecd9da08087f4a44dd3daef211e763eb1c61 (diff) |
Added holding vs press key action
Diffstat (limited to 'src/ui.cpp')
-rw-r--r-- | src/ui.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -48,6 +48,7 @@ static char *dialogBoxText = NULL; static char *dialogOptText[4]; static float dialogOptLoc[4][3]; static unsigned char dialogOptCount = 0; +static bool typeOutDone = true; extern void mainLoop(void); @@ -318,18 +319,23 @@ namespace ui { size=strlen(str); // Set the new target string size linc=0; // Reset the incrementers sinc=1; + typeOutDone = false; } /* * Draw the next letter if necessary. */ - if(++sinc==2){ + if(typeOutDone) + return str; + else if(++sinc==2){ sinc=0; strncpy(ret+linc,str+linc,1); // Get next character - if(linc<size)linc++; + if(linc<size) + linc++; + else typeOutDone = true; } return ret; // The buffered string. @@ -534,6 +540,12 @@ namespace ui { break; case SDL_MOUSEBUTTONDOWN: if((e.button.button&SDL_BUTTON_RIGHT)&&dialogBoxExists){ + + if(!typeOutDone){ + typeOutDone = true; + break; + } + for(i=0;i<dialogOptCount;i++){ if(mouse.x > dialogOptLoc[i][0] && mouse.x < dialogOptLoc[i][2] && |