aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index 11bc195..f73f48a 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -300,7 +300,8 @@ namespace ui {
}
}while(s[++i]);
- return putString(x-width/2,y,s);
+ putString(x-width/2,y,s);
+ return width;
}
/*
@@ -464,6 +465,12 @@ namespace ui {
}while(fadeIntensity < 255);
fadeIntensity = 255;
}
+ void waitForNothing(unsigned int ms){
+ unsigned int target = millis() + ms;
+ do{
+ mainLoop();
+ }while(millis() < target);
+ }
void importantText(const char *text,...){
va_list textArgs;
@@ -481,7 +488,7 @@ namespace ui {
}
void draw(void){
unsigned char i;
- float x,y;
+ float x,y,tmp;
char *rtext;
if(dialogBoxExists){
@@ -506,7 +513,7 @@ namespace ui {
glVertex2f(x+1+SCREEN_WIDTH-HLINE*16,y+1);
glVertex2f(x+1+SCREEN_WIDTH-HLINE*16,y-1-SCREEN_HEIGHT/4);
glVertex2f(x-1 ,y-1-SCREEN_HEIGHT/4);
- glVertex2f(x-1 ,y+2);
+ glVertex2f(x ,y+1);
glEnd();
glColor3ub(0,0,0);
@@ -518,12 +525,12 @@ namespace ui {
for(i=0;i<dialogOptCount;i++){
setFontColor(255,255,255);
- dialogOptLoc[i][1]=y-SCREEN_HEIGHT/4+(fontSize+HLINE)*(i+1);
- dialogOptLoc[i][2]=
- putStringCentered(offset.x,dialogOptLoc[i][1],dialogOptText[i]);
- dialogOptLoc[i][0]=offset.x-dialogOptLoc[i][2]/2;
+ tmp = putStringCentered(offset.x,dialogOptLoc[i][1],dialogOptText[i]);
+ dialogOptLoc[i][2] = offset.x + tmp;
+ dialogOptLoc[i][0] = offset.x - tmp;
+ dialogOptLoc[i][1] = y - SCREEN_HEIGHT / 4 + (fontSize + HLINE) * (i + 1);
if(mouse.x > dialogOptLoc[i][0] &&
- mouse.x < dialogOptLoc[i][0] + dialogOptLoc[i][2] &&
+ mouse.x < dialogOptLoc[i][2] &&
mouse.y > dialogOptLoc[i][1] &&
mouse.y < dialogOptLoc[i][1] + 16 ){ // fontSize
setFontColor(255,255,0);