mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-26 17:34:35 +02:00
Fix for OpenUI: Prevent comments from being drawn off the edge of the Window
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user