Shortern text width, so text doesn't overflow.

This commit is contained in:
Steve 2016-05-31 09:16:42 +01:00
parent c8b6ddd978
commit 2b7641b809
2 changed files with 4 additions and 2 deletions

View File

@ -93,7 +93,7 @@ void doMessageBox(void)
static void calculateMessageBoxHeight(MessageBox *msg) static void calculateMessageBoxHeight(MessageBox *msg)
{ {
limitTextWidth(575); limitTextWidth(MSG_BOX_TEXT_WIDTH);
msg->height = getWrappedTextHeight(msg->body, (msg->type == MB_PANDORAN) ? 0 : 18); msg->height = getWrappedTextHeight(msg->body, (msg->type == MB_PANDORAN) ? 0 : 18);
@ -140,7 +140,7 @@ void drawMessageBox(void)
drawText(r.x + 10, r.y + 5, 18, TA_LEFT, colors.cyan, msg->title); drawText(r.x + 10, r.y + 5, 18, TA_LEFT, colors.cyan, msg->title);
limitTextWidth(575); limitTextWidth(MSG_BOX_TEXT_WIDTH);
drawText(r.x + 10, r.y + 30, (msg->type == MB_PANDORAN) ? 0 : 18, TA_LEFT, (msg->type != MB_IMPORTANT) ? colors.white : colors.red, msg->body); drawText(r.x + 10, r.y + 30, (msg->type == MB_PANDORAN) ? 0 : 18, TA_LEFT, (msg->type != MB_IMPORTANT) ? colors.white : colors.red, msg->body);

View File

@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../common.h" #include "../common.h"
#define MSG_BOX_TEXT_WIDTH 565
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
extern int getWrappedTextHeight(char *text, int size); extern int getWrappedTextHeight(char *text, int size);
extern void limitTextWidth(int width); extern void limitTextWidth(int width);