aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2016-01-10 21:03:33 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2016-01-10 21:03:33 -0500
commit75a5569ed0d44494da379822aa5de519e4a4025b (patch)
tree1100ae214ad3a9eceac969d4796ef1ae825e8fb7 /src/ui.cpp
parent5c7c99ac5fe1158adbdf0469fb36ddd153511f5d (diff)
parenta0597ff41fb4be979f9dfd70ace8be98a737affb (diff)
Work on player texture
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index f73f48a..ead9d8c 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -95,6 +95,8 @@ namespace ui {
bool dialogImportant = false;
unsigned char dialogOptChosen = 0;
+ unsigned int textWrapLimit = 110;
+
/*
* Current font size. Changing this WILL NOT change the font size, see setFontSize() for
* actual font size changing.
@@ -266,10 +268,17 @@ namespace ui {
*/
do{
- if(s[i]=='\n'){ // Handle newlines
+ if(i && ((i / 110.0) == (i / 110))){
yo-=fontSize*1.05;
xo=x;
- }else if(s[i]==' '){ // Handle spaces
+ if(s[i] == ' ')
+ i++;
+ }
+ if(s[i] == '\n' || s[i] == '\r' || s[i] == '\t'){
+ /*if(s[i] == '\n'){
+ yo-=fontSize*1.05;
+ xo=x;
+ */}else if(s[i]==' '){ // Handle spaces
xo+=fontSize/2;
}else if(s[i]=='\b'){ // Handle backspaces?
xo-=add.x;
@@ -308,12 +317,13 @@ namespace ui {
* Draw a string in a typewriter-esque fashion. Each letter is rendered as calls are made
* to this function. Passing a different string to the function will reset the counters.
*/
-
+
+ static char *ret = NULL;
char *typeOut(char *str){
static unsigned int sinc, // Acts as a delayer for the space between each character.
linc=0, // Contains the number of letters that should be drawn.
size=0; // Contains the full size of the current string.
- static char *ret = NULL;
+ //static char *ret = NULL;
/*
* Create a well-sized buffer if we haven't yet.
@@ -453,6 +463,8 @@ namespace ui {
dialogBoxExists = true;
dialogImportant = false;
+ if(ret)
+ ret[0] = '\0';
}
void waitForDialog(void){
do{
@@ -557,7 +569,7 @@ namespace ui {
hub.y-=fontSize*1.15;
glRectf(hub.x,
hub.y,
- hub.x+(player->health/player->maxHealth)*130,
+ hub.x+(player->health/player->maxHealth?player->maxHealth:1)*130,
hub.y+12);
}
@@ -667,7 +679,6 @@ DONE:
memcpy(&player->loc,&tmppos,sizeof(vec2));
currentWorld = tmp;
toggleBlackFast();
- dialogBoxExists = false;
}
}
break;
@@ -689,7 +700,6 @@ DONE:
memcpy(&player->loc,&tmppos,sizeof(vec2));
currentWorld = tmp;
toggleBlackFast();
- dialogBoxExists = false;
}
}
break;
@@ -805,6 +815,9 @@ DONE:
case SDLK_RIGHT:
player->inv->sel++;
break;
+ case SDLK_f:
+ player->light^=true;
+ break;
default:
break;
}