diff options
| author | Simon <simon@hardwired.org.uk> | 2010-12-04 19:28:26 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2010-12-04 19:28:26 (GMT) |
| commit | 5d843e398cb28251d19f4240a0d9dbb7129c326f (patch) | |
| tree | b34117b3ba9f83b05d7fbfc8e247496af00985a9 /src/interface.c | |
| parent | bd08a3b607b2007c0328ef539c66808e73d851ed (diff) | |
| download | powder-5d843e398cb28251d19f4240a0d9dbb7129c326f.zip powder-5d843e398cb28251d19f4240a0d9dbb7129c326f.tar.gz | |
Fix for OpenUI: Prevent comments from being drawn off the edge of the Window
Diffstat (limited to 'src/interface.c')
| -rw-r--r-- | src/interface.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/interface.c b/src/interface.c index 06af843..00aa020 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2693,12 +2693,14 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) ccy = 0; for(cc=0; cc<info->comment_count; cc++) { - drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255); - ccy += 12; - ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185); - ccy += 10; - if(ccy+52<YRES+MENUSIZE){ //Try not to draw off the screen. - draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE); + if((ccy + 72 + ((textwidth(info->comments[cc])/(XRES+BARSIZE-100-((XRES/2)+1)-20)))*12)<(YRES+MENUSIZE-50)){ + drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255); + ccy += 12; + ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185); + ccy += 10; + if(ccy+52<YRES+MENUSIZE-50){ //Try not to draw off the screen. + draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE); + } } } hasdrawninfo = 1; |
