Changeset 668
- Timestamp:
- May 16, 2011, 2:37:19 AM (11 years ago)
- Location:
- abuse/trunk
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/TODO
r666 r668 65 65 Jwindow::_x1 _x2 66 66 67 JCFont::tl,th -> m_size68 67 sprite::x,y -> m_pos 69 68 console::draw_char : vec2i … … 75 74 xstart() / xend() etc. 76 75 jwindow::area 76 button::area 77 77 78 78 refactor image::Line to merge loops -
abuse/trunk/src/ant.cpp
r656 r668 473 473 } else sprintf(msg,"%s : %s",symbol_str("lev_complete"),current_level->original_name()); 474 474 475 int w=wm->font()->width()*strlen(msg),h=wm->font()->height(); 475 int w = wm->font()->Size().x * strlen(msg), 476 h = wm->font()->Size().y; 476 477 int x=(x1+x2)/2-w/2,y=(y1+y2)/2-h/2; 477 478 main_screen->Bar(vec2i(x - 10, y - 10), vec2i(x + w + 10, y + h + 10), … … 480 481 wm->medium_color()); 481 482 482 wm->font()-> put_string(main_screen,x+1,y+1,msg,wm->dark_color());483 wm->font()-> put_string(main_screen,x,y,msg,wm->bright_color());483 wm->font()->PutString(main_screen, vec2i(x + 1, y + 1), msg, wm->dark_color()); 484 wm->font()->PutString(main_screen, vec2i(x, y), msg, wm->bright_color()); 484 485 wm->flush_screen(); 485 486 Timer now; now.WaitMs(500); -
abuse/trunk/src/automap.cpp
r665 r668 174 174 automap_window->m_surf->Bar(vec2i(17, 1), vec2i(17 + 8 * 6 + 3, 6), 175 175 wm->medium_color()); 176 wm->font()-> put_string(automap_window->m_surf, 20, 2, "Automap",177 176 wm->font()->PutString(automap_window->m_surf, vec2i(20, 2), "Automap", 177 wm->dark_color()); 178 178 draw(); 179 179 } -
abuse/trunk/src/clisp.cpp
r666 r668 2198 2198 if (args) 2199 2199 color=lnumber_value(CAR(args)); 2200 fnt-> put_string(main_screen,x,y,st,color);2201 } break; 2202 case 278 : return ((JCFont *)lpointer_value(CAR(args)))-> width(); break;2203 case 279 : return ((JCFont *)lpointer_value(CAR(args)))-> height(); break;2200 fnt->PutString(main_screen, vec2i(x, y), st, color); 2201 } break; 2202 case 278 : return ((JCFont *)lpointer_value(CAR(args)))->Size().x; break; 2203 case 279 : return ((JCFont *)lpointer_value(CAR(args)))->Size().y; break; 2204 2204 case 280 : if (chat) chat->put_all(lstring_value(CAR(args))); break; 2205 2205 case 281 : -
abuse/trunk/src/console.cpp
r665 r668 35 35 void console::redraw() 36 36 { 37 if (con_win) 38 { 37 if (!con_win) 38 return; 39 39 40 con_win->clear(); 40 char *s=screen; 41 int dx,dy,xa=fnt->width(),ya=fnt->height(),i,j; 42 for (j=0,dy=wy(); j<h; j++,dy+=ya) 43 { 44 for (i=0,dx=wx(); i<w; i++,s++,dx+=xa) 45 { 46 if (*s) 47 fnt->put_char(con_win->m_surf,dx,dy,*s); 48 } 49 } 50 fnt->put_char(con_win->m_surf,wx()+cx*xa,wy()+cy*ya,'_'); 51 } 41 char *s = screen; 42 int xa = fnt->Size().x, ya = fnt->Size().y; 43 for (int j = 0, dy = wy(); j < h; j++, dy += ya) 44 for (int i = 0, dx = wx(); i < w; i++, s++, dx += xa) 45 if (*s) 46 fnt->PutChar(con_win->m_surf, vec2i(dx, dy), *s); 47 fnt->PutChar(con_win->m_surf, vec2i(wx() + cx * xa, wy() + cy * ya), '_'); 52 48 } 53 49 … … 98 94 void console::draw_cursor() 99 95 { 100 if (con_win) 101 fnt->put_char(con_win->m_surf,cx*fnt->width()+wx(),cy*fnt->height()+wy(),'_'); 96 if (!con_win) 97 return; 98 99 fnt->PutChar(con_win->m_surf, 100 vec2i(cx, cy) * fnt->Size() + vec2i(wx(), wy()), '_'); 102 101 } 103 102 … … 105 104 void console::draw_char(int x, int y, char ch) 106 105 { 107 if (con_win) 108 { 109 int fw=fnt->width(),fh=fnt->height(); 110 int dx=wx()+x*fw,dy=wy()+y*fh; 111 con_win->m_surf->Bar(vec2i(dx, dy), vec2i(dx + fw - 1, dy + fh - 1), 112 wm->black()); 113 fnt->put_char(con_win->m_surf,dx,dy,ch); 114 } 106 if (!con_win) 107 return; 108 109 vec2i fs = fnt->Size(); 110 vec2i pos = vec2i(wx(), wy()) + vec2i(x, y) * fs; 111 con_win->m_surf->Bar(pos, pos + fs - vec2i(1), wm->black()); 112 fnt->PutChar(con_win->m_surf, pos, ch); 115 113 } 116 114 -
abuse/trunk/src/console.h
r643 r668 30 30 void put_char(char ch); 31 31 void do_cr(); 32 int screen_w() { return w *fnt->width(); }33 int screen_h() { return h *fnt->height(); }32 int screen_w() { return w * fnt->Size().x; } 33 int screen_h() { return h * fnt->Size().y; } 34 34 int wx() { return con_win->x1(); } 35 35 int wy() { return con_win->y1(); } -
abuse/trunk/src/cop.cpp
r656 r668 1035 1035 strcat(msg," <<"); 1036 1036 1037 fnt-> put_string(main_screen,x,y,msg,color);1038 y +=fnt->height();1037 fnt->PutString(main_screen, vec2i(x, y), msg, color); 1038 y += fnt->Size().y; 1039 1039 } 1040 1040 } … … 1059 1059 for (v=player_list; v; v=v->next) tp++; 1060 1060 1061 int y=(y1+y2)/2-(tp+2)*fnt-> height()/2,x=x1+10;1061 int y=(y1+y2)/2-(tp+2)*fnt->Size().y/2,x=x1+10; 1062 1062 char const *header_str = symbol_str("score_header"); 1063 fnt-> put_string(main_screen,x,y,header_str,wm->bright_color());1064 y +=fnt->height();1063 fnt->PutString(main_screen, vec2i(x, y), header_str, wm->bright_color()); 1064 y += fnt->Size().y; 1065 1065 1066 1066 main_screen->WidgetBar(vec2i(x, y + 2), 1067 vec2i(x + strlen(header_str) * fnt-> width(),1068 y + fnt-> height()- 3),1067 vec2i(x + strlen(header_str) * fnt->Size().x, 1068 y + fnt->Size().y - 3), 1069 1069 wm->bright_color(), wm->medium_color(), 1070 1070 wm->dark_color()); 1071 y +=fnt->height();1072 v =player_list;1071 y += fnt->Size().y; 1072 v = player_list; 1073 1073 for (i=0; i<tp; i++) 1074 1074 { … … 1082 1082 1083 1083 sprintf(msg,"%-17s %3ld %3ld",max_name,(long)v->kills,(long)(v->tkills+v->kills)); 1084 fnt-> put_string(main_screen,x,y,msg,color);1085 1086 y +=fnt->height();1087 v =v->next;1084 fnt->PutString(main_screen, vec2i(x, y), msg, color); 1085 1086 y += fnt->Size().y; 1087 v = v->next; 1088 1088 } 1089 1089 -
abuse/trunk/src/dev.cpp
r666 r668 144 144 { 145 145 public : 146 amb_cont(int X, int Y, ifield *Next) : scroller(X,Y,ID_NULL,100,wm->font()-> height()+2,0,64,Next)146 amb_cont(int X, int Y, ifield *Next) : scroller(X,Y,ID_NULL,100,wm->font()->Size().y+2,0,64,Next) 147 147 { if (player_list) sx=player_list->ambient; } 148 148 virtual void scroll_event(int newx, image *screen) … … 151 151 char st[100]; 152 152 sprintf(st,"%d",newx); 153 wm->font()-> put_string(screen,m_pos.x+30,m_pos.y+1,st,wm->bright_color());153 wm->font()->PutString(screen, m_pos + vec2i(30, 1), st, wm->bright_color()); 154 154 if (player_list) 155 155 player_list->ambient=newx; … … 170 170 171 171 quitw = wm->new_window(xres / 2 + 40, yres / 2, 80, -1, 172 new button(10, wm->font()-> height()+ 4, ID_QUIT_OK, ok_image,173 new button(38, wm->font()-> height()+ 4, ID_CANCEL, cancel_image,172 new button(10, wm->font()->Size().y + 4, ID_QUIT_OK, ok_image, 173 new button(38, wm->font()->Size().y + 4, ID_CANCEL, cancel_image, 174 174 new info_field(2, 2, ID_NULL, symbol_str("sure?"), NULL))), 175 175 symbol_str("quit_title")); … … 510 510 vec2i pos = the_game->GameToMouse(vec2i(o->x, o->y), current_view); 511 511 char *nm=object_names[o->otype]; 512 console_font-> put_string(main_screen, pos.x - strlen(nm) * console_font->width() / 2, pos.y + 2, nm);512 console_font->PutString(main_screen, pos + vec2i(- strlen(nm) * console_font->Size().x / 2, 2), nm); 513 513 } 514 514 … … 676 676 prop->getd("objects y", 0), -1, -1, 677 677 new pick_list(0, 0, DEV_CREATE, 678 yres / wm->font()-> height()/ 2,678 yres / wm->font()->Size().y / 2, 679 679 listable_objs, total_listable, 0, 680 680 NULL, cache.img(window_texture))); … … 717 717 prop->getd("pal y",-1), -1,-1, 718 718 new pick_list(0, 0, DEV_PALETTE, 719 yres / wm->font()-> height()/ 2,719 yres / wm->font()->Size().y / 2, 720 720 pwin_list, total_pals, 0, NULL, 721 721 cache.img(window_texture))); … … 806 806 "***************************", 807 807 prop->get("search name", ""), 808 new button(bw, wm->font()-> height()+ 5, ID_SEARCH_BACKWARD,808 new button(bw, wm->font()->Size().y + 5, ID_SEARCH_BACKWARD, 809 809 cache.img(dev_backward), 810 new button(bw * 3, wm->font()-> height()+ 5, ID_SEARCH_FOREWARD,810 new button(bw * 3, wm->font()->Size().y + 5, ID_SEARCH_FOREWARD, 811 811 cache.img(dev_forward), NULL))), "SEARCH"); 812 812 … … 941 941 dev_console=new dev_term(50,18,this); 942 942 if (start_edit) 943 dev_menu=make_menu(0,yres-wm->font()-> height()-5);943 dev_menu=make_menu(0,yres-wm->font()->Size().y-5); 944 944 945 945 if (get_option("-nolight")) … … 1331 1331 } 1332 1332 1333 int bh = 16 + 6, bw = 20 + 6, th = wm->font()-> height()+ 4;1333 int bh = 16 + 6, bw = 20 + 6, th = wm->font()->Size().y + 4; 1334 1334 1335 1335 lightw = wm->new_window(prop->getd("light create x", 0), … … 1362 1362 { 1363 1363 ai_object=o; 1364 int th=wm->font()-> height()+4,wl = 0, wh = 20;1364 int th=wm->font()->Size().y+4,wl = 0, wh = 20; 1365 1365 if (figures[o->otype]->total_fields) 1366 1366 { … … 1572 1572 { 1573 1573 if (area_win) close_area_win(0); 1574 int wl=0,wh=0,th=wm->font()-> height()+12,bw=cache.img(dev_ok)->Size().x+10;1574 int wl=0,wh=0,th=wm->font()->Size().y+12,bw=cache.img(dev_ok)->Size().x+10; 1575 1575 area_win=wm->new_window(prop->getd("area_box x",0), 1576 1576 prop->getd("area_box y",0), … … 1924 1924 wm->close_window(ledit); 1925 1925 } 1926 int bw=20+6,bh=16+6,th=wm->font()-> height()+4;1926 int bw=20+6,bh=16+6,th=wm->font()->Size().y+4; 1927 1927 edit_light=selected_light; 1928 1928 if (edit_object) … … 2118 2118 if (!mess_win) 2119 2119 { 2120 int h=wm->font()-> height()+8;2120 int h=wm->font()->Size().y+8; 2121 2121 mess_win=wm->new_window(xres/2,yres/2,-1,-1, 2122 2122 new text_field(0,h*0,ID_MESS_STR1,symbol_str("width_"),"****", … … 2170 2170 if (!mess_win) 2171 2171 { 2172 int h=wm->font()-> height()+8;2172 int h=wm->font()->Size().y+8; 2173 2173 mess_win=wm->new_window(xres/2,yres/2,-1,-1, 2174 2174 new text_field(0,h*0,ID_RECORD_DEMO_FILENAME, … … 2190 2190 if (!mess_win) 2191 2191 { 2192 int h=wm->font()-> height()+8;2192 int h=wm->font()->Size().y+8; 2193 2193 mess_win=wm->new_window(xres/2,yres/2,-1,-1, 2194 2194 new text_field(0,h*0,ID_PLAY_DEMO_FILENAME, … … 2211 2211 if (!mess_win) 2212 2212 { 2213 int h=wm->font()-> height()+8;2213 int h=wm->font()->Size().y+8; 2214 2214 mess_win=wm->new_window(xres/2,yres/2,-1,-1, 2215 2215 new text_field(0,h*0,ID_MESS_STR1,symbol_str("x_mul"),"****",bg_xmul, … … 2231 2231 (((float)tbg_ymul/(float)tbg_ydiv) < ((float)bg_ymul/(float)bg_ydiv))) 2232 2232 { 2233 int h=wm->font()-> height()+8;2233 int h=wm->font()->Size().y+8; 2234 2234 2235 2235 warn_win=wm->new_window(xres/2-40,yres/2-40,-1,-1, … … 2276 2276 if (!mess_win) 2277 2277 { 2278 int h=wm->font()-> height()+8;2278 int h=wm->font()->Size().y+8; 2279 2279 mess_win=wm->new_window(xres/2,yres/2,-1,-1, 2280 2280 new text_field(0,h*0,ID_MESS_STR1,symbol_str("ap_width"),"****",2, … … 3570 3570 if ((dev&EDIT_MODE) && !dev_menu) 3571 3571 { 3572 dev_menu=make_menu(0,yres-wm->font()-> height()-5);3572 dev_menu=make_menu(0,yres-wm->font()->Size().y-5); 3573 3573 } 3574 3574 else if (!(dev&EDIT_MODE) && dev_menu) -
abuse/trunk/src/director.cpp
r665 r668 47 47 main_screen->InClip(vec2i(x1, y1), vec2i(x2 + 1, y2 + 1)); 48 48 49 int h=font-> height()+2,w=font->width(),x=x1,dist;49 int h=font->Size().y+2,w=font->Size().x,x=x1,dist; 50 50 y+=y1; 51 51 char const *word_start; … … 109 109 while (word_len--) 110 110 { 111 font-> put_char(main_screen,x+1,y+1,*word_start,0);112 font-> put_char(main_screen,x,y,*word_start,c);111 font->PutChar(main_screen, vec2i(x + 1, y + 1), *word_start, 0); 112 font->PutChar(main_screen, vec2i(x, y), *word_start, c); 113 113 word_start++; 114 114 x+=w; -
abuse/trunk/src/endgame.cpp
r656 r668 437 437 int dx=(xres+1)/2-im->Size().x/2,dy=(yres+1)/2-im->Size().y/2; 438 438 main_screen->PutImage(im, vec2i(dx, dy)); 439 console_font-> put_string(main_screen,xres/2+35,yres/2+100-console_font->height()-2,439 console_font->PutString(main_screen, vec2i(xres / 2 + 35, yres / 2 + 100 - console_font->Size().y - 2), 440 440 lstring_value(to_be)); 441 441 fade_in(NULL,32); … … 451 451 { 452 452 main_screen->PutImage(im, vec2i(dx, dy)); 453 console_font-> put_string(main_screen,xres/2+35,yres/2+100-console_font->height()-2,453 console_font->PutString(main_screen, vec2i(xres / 2 + 35, yres / 2 + 100 - console_font->Size().y - 2), 454 454 lstring_value(to_be)); 455 455 -
abuse/trunk/src/game.cpp
r666 r668 115 115 } 116 116 117 info_field *inf = new info_field(0, wm->font()-> height()* 2, ID_NULL,117 info_field *inf = new info_field(0, wm->font()->Size().y * 2, ID_NULL, 118 118 no_space_msg, NULL); 119 119 button *b = new button(0, 0, ID_QUIT_OK, "Quit", inf); … … 994 994 color = 2+(help_text_frames - 10); 995 995 996 int x1 = v->cx1, y1 = v->cy1, x2 = v->cx2, y2 = v->cy1 + wm->font()-> height()+10;996 int x1 = v->cx1, y1 = v->cy1, x2 = v->cx2, y2 = v->cy1 + wm->font()->Size().y+10; 997 997 998 998 remap_area(main_screen, x1, y1, x2, y2, white_light + 40 * 256); … … 1000 1000 main_screen->Bar(vec2i(x1, y2), vec2i(x2, y2), color); 1001 1001 1002 wm->font()-> put_string(main_screen, x1 + 5, y1 + 5,1003 help_text, color);1002 wm->font()->PutString(main_screen, vec2i(x1 + 5, y1 + 5), 1003 help_text, color); 1004 1004 if(color > 30) 1005 1005 help_text_frames = -1; … … 1447 1447 char str[16]; 1448 1448 sprintf(str, "%ld", (long)(10000.0f / avg_ms)); 1449 console_font-> put_string(main_screen, first_view->cx1, first_view->cy1, str);1449 console_font->PutString(main_screen, vec2i(first_view->cx1, first_view->cy1), str); 1450 1450 1451 1451 sprintf(str, "%d", total_active); 1452 console_font-> put_string(main_screen, first_view->cx1, first_view->cy1 + 10, str);1452 console_font->PutString(main_screen, vec2i(first_view->cx1, first_view->cy1 + 10), str); 1453 1453 } 1454 1454 … … 2052 2052 { 2053 2053 char const *helpstr = "ARROW KEYS CHANGE TEXT SPEED"; 2054 wm->font()->put_string(main_screen, main_screen->Size().x/2-(wm->font()->width()*strlen(helpstr))/2 + 1, 2055 main_screen->Size().y-wm->font()->height()-5 + 1, helpstr, wm->dark_color()); 2056 wm->font()->put_string(main_screen, main_screen->Size().x/2-(wm->font()->width()*strlen(helpstr))/2, 2057 main_screen->Size().y-wm->font()->height()-5, helpstr, wm->bright_color()); 2054 vec2i span = wm->font()->Size() * vec2i(strlen(helpstr), 1); 2055 vec2i pos = (main_screen->Size() - span) / vec2i(2, 1); 2056 wm->font()->PutString(main_screen, pos + vec2i(1), 2057 helpstr, wm->dark_color()); 2058 wm->font()->PutString(main_screen, pos, helpstr, wm->bright_color()); 2058 2059 } 2059 2060 /* else … … 2061 2062 char *helpstr="PRESS h FOR HELP"; 2062 2063 wm->font()->put_string(main_screen, main_screen->Size().x-wm->font()->width()*strlen(helpstr)-5, 2063 main_screen->Size().y-wm->font()-> height()-5, helpstr);2064 main_screen->Size().y-wm->font()->Size().y-5, helpstr); 2064 2065 }*/ 2065 2066 /* int dc = cache.img(window_colors)->pixel(0, 2); -
abuse/trunk/src/gamma.cpp
r655 r668 141 141 gray_pal->find_closest(dr_r, dr_g, dr_b)); 142 142 143 int sh = wm->font()-> height()+ 35;143 int sh = wm->font()->Size().y + 35; 144 144 button *but = new button(5, 5 + sh * 3, ID_GAMMA_OK, cache.img(ok_button), 145 145 new info_field(35, 10 + sh * 3, ID_NULL, lang_string("gamma_msg"), 0)); -
abuse/trunk/src/gui.cpp
r659 r668 107 107 int g=80; 108 108 screen->Bar(vec2i(0, 0), vec2i(144, 20), 0); 109 wm->font()-> put_string(screen, 0, 0, symbol_str(key),110 109 wm->font()->PutString(screen, vec2i(0), symbol_str(key), 110 color_table->Lookup(g>>3, g>>3, g>>3)); 111 111 } 112 112 else if (!active && key[0]) -
abuse/trunk/src/imlib/filesel.cpp
r655 r668 30 30 file_picker(int X, int Y, int ID, int Rows, ifield *Next); 31 31 virtual int total() { return tf+td; } 32 virtual int item_width() { return wm->font()-> width()*wid; }33 virtual int item_height() { return wm->font()-> height()+1; }32 virtual int item_width() { return wm->font()->Size().x * wid; } 33 virtual int item_height() { return wm->font()->Size().y + 1; } 34 34 virtual void draw_item(image *screen, int x, int y, int num, int active); 35 35 virtual void note_selection(image *screen, InputManager *inm, int x); … … 95 95 void file_picker::draw_item(image *screen, int x, int y, int num, int active) 96 96 { 97 if (active)98 screen->Bar(vec2i(x, y),99 vec2i(x + item_width() - 1, y + item_height() - 1),100 wm->black());97 if (active) 98 screen->Bar(vec2i(x, y), 99 vec2i(x + item_width() - 1, y + item_height() - 1), 100 wm->black()); 101 101 102 if (num<td)103 {104 char st[100];105 sprintf(st,"<%s>",d[num]);106 wm->font()->put_string(screen,x,y,st,wm->bright_color());107 } else 108 wm->font()-> put_string(screen,x,y,f[num-td],wm->bright_color());102 char st[100], *dest; 103 if (num >= td) 104 dest = f[num - td]; 105 else 106 sprintf(dest = st, "<%s>", d[num]); 107 108 wm->font()->PutString(screen, vec2i(x, y), dest, wm->bright_color()); 109 109 } 110 110 … … 132 132 int filename_id) 133 133 { 134 int wh2 = 5 + wm->font()-> height()+ 5;135 int wh3 = wh2 + wm->font()-> height()+ 12;134 int wh2 = 5 + wm->font()->Size().y + 5; 135 int wh3 = wh2 + wm->font()->Size().y + 12; 136 136 Jwindow *j=wm->new_window(0,0,-1,-1, 137 137 new info_field(5, 5, 0, prompt, … … 140 140 new button(50, wh3, ok_id, ok_name, 141 141 new button(100, wh3, cancel_id, cancel_name, 142 new file_picker(15, wh3 + wm->font()-> height()+ 10, filename_id, 8,142 new file_picker(15, wh3 + wm->font()->Size().y + 10, filename_id, 8, 143 143 NULL))))), 144 144 -
abuse/trunk/src/imlib/fonts.cpp
r667 r668 19 19 #include "fonts.h" 20 20 21 void JCFont::put_string(image *screen, int x, int y, char const *st, int color) 22 { while (*st) 23 { put_char(screen,x,y,*st,color); 24 st++; 25 x+=tl; 26 } 21 void JCFont::PutString(image *screen, vec2i pos, char const *st, int color) 22 { 23 for ( ; *st; st++, pos.x += m_size.x) 24 PutChar(screen, pos, *st, color); 27 25 } 28 26 29 void JCFont:: put_char(image *screen, int x, int y, char ch, int color)27 void JCFont::PutChar(image *screen, vec2i pos, char ch, int color) 30 28 { 31 if (let[(int)ch]) 32 { 33 if (color>=0) 34 let[(int)ch]->PutColor(screen,vec2i(x,y),color); 35 else let[(int)ch]->PutImage(screen,vec2i(x,y)); 36 } 29 if (!m_data[(int)ch]) 30 return; 31 32 if (color >= 0) 33 m_data[(int)ch]->PutColor(screen, pos, color); 34 else 35 m_data[(int)ch]->PutImage(screen, pos); 37 36 } 38 37 39 38 JCFont::JCFont(image *letters) 40 39 { 41 tl=(letters->Size().x+1)/32; 42 th=(letters->Size().y+1)/8; 40 m_size = (letters->Size() + vec2i(1)) / vec2i(32, 8); 43 41 44 image tmp(vec2i(tl,th));42 image tmp(m_size); 45 43 46 int ch; 47 48 for (ch=0; ch<256; ch++) 49 { 50 tmp.clear(); 51 tmp.PutPart(letters, vec2i(0, 0), vec2i(((int)ch%32)*tl, ((int)ch/32)*th), 52 vec2i(((int)ch%32)*tl+tl, ((int)ch/32)*th+th), 1); 53 let[ch] = new TransImage(&tmp, "JCfont"); 54 } 44 for (int ch = 0; ch < 256; ch++) 45 { 46 tmp.clear(); 47 tmp.PutPart(letters, vec2i(0), 48 vec2i(ch % 32, ch / 32) * m_size, 49 vec2i(ch % 32 + 1, ch / 32 + 1) * m_size, 1); 50 m_data[ch] = new TransImage(&tmp, "JCfont"); 51 } 55 52 } 56 53 57 54 JCFont::~JCFont() 58 55 { 59 int ch; 60 for (ch=0; ch<256; ch++) 61 delete let[ch]; 56 for (int ch = 0; ch < 256; ch++) 57 delete m_data[ch]; 62 58 } 63 59 -
abuse/trunk/src/imlib/fonts.h
r667 r668 17 17 class JCFont 18 18 { 19 int tl,th;20 TransImage *let[256];21 19 public: 22 JCFont(image *letters); 23 void put_char(image *screen, int x, int y, char ch, int color=-1); 24 void put_string(image *screen, int x, int y, char const *st, int color=-1); 25 int height() { return th; } 26 int length() { return tl; } 27 int width() { return tl; } 28 ~JCFont(); 29 } ; 20 JCFont(image *letters); 21 ~JCFont(); 22 23 void PutChar(image *screen, vec2i pos, char ch, int color = -1); 24 void PutString(image *screen, vec2i pos, char const *st, int color = -1); 25 vec2i Size() const { return m_size; } 26 27 private: 28 vec2i m_size; 29 TransImage *m_data[256]; 30 }; 30 31 31 32 #endif 32 33 33 -
abuse/trunk/src/imlib/guistat.cpp
r659 r668 57 57 { 58 58 long l = whom->stat_win->x2() - whom->stat_win->x1() - 6; 59 long h = wm->font()-> height();59 long h = wm->font()->Size().y; 60 60 61 61 whom->stat_win->m_surf->Bar(vec2i(whom->stat_win->x1() + 1, … … 99 99 if (now.diff_time(&first->last_time)>1) 100 100 { 101 long wx=xres/2,wy=10,len1=strlen(first->name)*wm->font()-> width()+10,len2=0,len3,102 h1=wm->font()-> height()+5,h2=first->show ? first->show->height() : 0;101 long wx=xres/2,wy=10,len1=strlen(first->name)*wm->font()->Size().x+10,len2=0,len3, 102 h1=wm->font()->Size().y+5,h2=first->show ? first->show->height() : 0; 103 103 104 104 if (first->show) len2=first->show->width()/2; … … 112 112 113 113 int mx = first->stat_win->x1() + 1; 114 int my = first->stat_win->y1() + wm->font()-> height()/ 2;114 int my = first->stat_win->y1() + wm->font()->Size().y / 2; 115 115 first->stat_win=wm->new_window(wx, wy, len3, h1*2+h2, NULL, "status"); 116 wm->font()-> put_string(first->stat_win->m_surf, mx, my, first->name, wm->black());117 wm->font()-> put_string(first->stat_win->m_surf, mx, my, first->name, wm->bright_color());116 wm->font()->PutString(first->stat_win->m_surf, vec2i(mx, my), first->name, wm->black()); 117 wm->font()->PutString(first->stat_win->m_surf, vec2i(mx, my), first->name, wm->bright_color()); 118 118 if (first->show) 119 119 first->show->draw(first->stat_win->m_surf, (first->stat_win->x2()-first->stat_win->x1())/2- -
abuse/trunk/src/imlib/input.cpp
r659 r668 202 202 203 203 if (pressed) 204 pos2 += pressed->Size() - vec2i(1 , 1);204 pos2 += pressed->Size() - vec2i(1); 205 205 else if (text) 206 pos2 += vec2i(wm->font()->width() * strlen(text) + 6, 207 wm->font()->height() + 6); 206 pos2 += wm->font()->Size() * vec2i(strlen(text), 1) + vec2i(6); 208 207 else 209 pos2 += visual->Size() + vec2i(6 , 6);208 pos2 += visual->Size() + vec2i(6); 210 209 211 210 x1 = pos1.x; y1 = pos1.y; … … 405 404 void button::draw_first(image *screen) 406 405 { 407 if (pressed) 408 draw(0,screen); 409 else 410 { 406 if (pressed) 407 { 408 draw(0, screen); 409 return; 410 } 411 411 412 412 int x1,y1,x2,y2; 413 413 area(x1,y1,x2,y2); 414 415 414 416 415 if (up) … … 420 419 screen->WidgetBar(vec2i(x1 + 1, y1 + 1), vec2i(x2 - 1, y2 - 1), 421 420 wm->bright_color(),wm->medium_color(),wm->dark_color()); 422 if (text) 423 { 424 wm->font()->put_string(screen,m_pos.x+4,m_pos.y+5,text,wm->black()); 425 wm->font()->put_string(screen,m_pos.x+3,m_pos.y+4,text); 426 } 427 else screen->PutImage(visual, m_pos + vec2i(3, 3), 1); 428 } else 421 } 422 else 429 423 { 430 424 screen->Line(vec2i(x1, y1), vec2i(x2, y1), wm->dark_color()); … … 434 428 screen->Bar(vec2i(x1 + 1, y1 + 1), vec2i(x2 - 1, y2 - 1), 435 429 wm->medium_color()); 436 if (visual) 430 } 431 432 if ((up && text) || (!up && !visual)) 433 { 434 wm->font()->PutString(screen, m_pos + vec2i(4, 5), text, wm->black()); 435 wm->font()->PutString(screen, m_pos + vec2i(3, 4), text); 436 } 437 else if (up) 438 screen->PutImage(visual, m_pos + vec2i(3, 3), 1); 439 else 437 440 screen->PutImage(visual, vec2i(x1 + 3, y1 + 3), 1); 438 else439 {440 wm->font()->put_string(screen,m_pos.x+4,m_pos.y+5,text,wm->black());441 wm->font()->put_string(screen,m_pos.x+3,m_pos.y+4,text);442 }443 }444 }445 441 } 446 442 447 443 void text_field::draw_first(image *screen) 448 444 { 449 wm->font()-> put_string(screen,m_pos.x,m_pos.y+3,prompt);445 wm->font()->PutString(screen, m_pos + vec2i(0, 3), prompt); 450 446 screen->Bar(vec2i(xstart(), m_pos.y), vec2i(xend(), yend()), wm->dark_color()); 451 wm->font()-> put_string(screen,xstart()+1,m_pos.y+3,data);447 wm->font()->PutString(screen, vec2i(xstart() + 1, m_pos.y + 3), data); 452 448 } 453 449 … … 455 451 void text_field::draw_cur(int color, image *screen) 456 452 { 457 screen->Bar(vec2i(xstart() + cur * wm->font()-> width()+ 1, yend() - 2),458 vec2i(xstart() + (cur + 1) * wm->font()-> width(), yend() - 1),453 screen->Bar(vec2i(xstart() + cur * wm->font()->Size().x + 1, yend() - 2), 454 vec2i(xstart() + (cur + 1) * wm->font()->Size().x, yend() - 1), 459 455 color); 460 456 } … … 474 470 if (w==-1) // if we haven't calculated this yet 475 471 { 476 int fw =wm->font()->width(),fh=wm->font()->height(),maxw=0;472 int fw = wm->font()->Size().x, fh = wm->font()->Size().y, maxw = 0; 477 473 char *info=text; 478 474 for (w=fw,h=fh+1; *info; info++) … … 507 503 else 508 504 { 509 font-> put_char(screen,dx,dy,*st,color);505 font->PutChar(screen, vec2i(dx, dy), *st, color); 510 506 dx+=xspace; 511 507 } … … 516 512 void info_field::draw_first(image *screen) 517 513 { 518 put_para(screen,text,m_pos.x+1,m_pos.y+1,wm->font()->width(),wm->font()->height(),wm->font(),wm->black()); 519 put_para(screen,text,m_pos.x,m_pos.y,wm->font()->width(),wm->font()->height(),wm->font(),wm->bright_color()); 520 } 521 522 523 524 514 put_para(screen, text, m_pos.x+1, m_pos.y+1, wm->font()->Size().x, 515 wm->font()->Size().y, wm->font(), wm->black()); 516 put_para(screen, text, m_pos.x, m_pos.y, wm->font()->Size().x, 517 wm->font()->Size().y, wm->font(), wm->bright_color()); 518 } 519 -
abuse/trunk/src/imlib/input.h
r659 r668 65 65 int cur; 66 66 char *prompt,*data,*format; 67 int xstart() { return m_pos.x +wm->font()->width()*(strlen(prompt)+1)+3; }68 int xend() { return m_pos.x +wm->font()->width()*(strlen(prompt)+1+strlen(format))+7; }69 int yend() { return m_pos.y +wm->font()->height()+5; }67 int xstart() { return m_pos.x + wm->font()->Size().x * (strlen(prompt)+1) + 3; } 68 int xend() { return m_pos.x + wm->font()->Size().x * (strlen(prompt) + 1 + strlen(format)) + 7; } 69 int yend() { return m_pos.y + wm->font()->Size().y + 5; } 70 70 void draw_cur(int color, image *screen); 71 71 int last_spot() { int x=strlen(data); while (x && data[x-1]==' ') x--; return x; } … … 74 74 screen->Bar(vec2i(xstart() + 1, m_pos.y + 1), vec2i(xend() - 1, yend() - 1), 75 75 wm->dark_color()); 76 wm->font()-> put_string(screen,xstart()+1,m_pos.y+3,data);76 wm->font()->PutString(screen, vec2i(xstart() + 1, m_pos.y + 3), data); 77 77 } 78 78 public : -
abuse/trunk/src/imlib/jwindow.cpp
r662 r668 522 522 { 523 523 m_surf->Bar(vec2i(top_border(), 1), 524 vec2i(top_border() + fnt-> width()* strlen (_name) + 1,524 vec2i(top_border() + fnt->Size().x * strlen (_name) + 1, 525 525 top_border() - 2), 526 526 med); 527 fnt-> put_string(m_surf, top_border() + 1, 1, _name, low);527 fnt->PutString(m_surf, vec2i(top_border() + 1, 1), _name, low); 528 528 } 529 529 // clear 'client' region … … 544 544 int Jwindow::top_border() 545 545 { 546 return wm->font()-> height()+ frame_top();546 return wm->font()->Size().y + frame_top(); 547 547 } 548 548 -
abuse/trunk/src/imlib/pmenu.cpp
r665 r668 159 159 int w,h; 160 160 calc_size(w,h); 161 item_num(active)->draw(win,x+3,y+3+active*(wm->font()-> height()+1),w-6,0,0);161 item_num(active)->draw(win,x+3,y+3+active*(wm->font()->Size().y+1),w-6,0,0); 162 162 } 163 163 wm->close_window(win); … … 168 168 void psub_menu::calc_size(int &w, int &h) 169 169 { 170 int tw=wm->font()->width(),th=wm->font()->height();170 vec2i ts = wm->font()->Size(); 171 171 w=h=0; 172 172 for (pmenu_item *p=first; p; p=p->next) … … 174 174 if (p->name()) 175 175 { 176 int l=strlen(p->name())*t w+8;177 if (p->on_off) l+=t w*4;176 int l=strlen(p->name())*ts.x+8; 177 if (p->on_off) l+=ts.x*4; 178 178 if (l>w) w=l; 179 179 } 180 180 h++; 181 181 } 182 h=h*(t h+1)+8;182 h=h*(ts.y+1)+8; 183 183 } 184 184 … … 195 195 if (h+y+parent->m_pos.y>=cbb.y) 196 196 { 197 if (parent->m_pos.y+parent->h+wm->font()-> height()>=cbb.y)197 if (parent->m_pos.y+parent->h+wm->font()->Size().y>=cbb.y) 198 198 y=-h; 199 else y=y-h+wm->font()-> height()+5;199 else y=y-h+wm->font()->Size().y+5; 200 200 } 201 201 … … 213 213 pmenu_item *p=first; 214 214 for (; p; p=p->next) if (p->on_off) has_flags=1; 215 x =has_flags ? 3+wm->font()->width(): 3;216 y =3;217 218 for (p=first; p; p=p->next,i++,y+=wm->font()-> height()+1)215 x = has_flags ? 3 + wm->font()->Size().x : 3; 216 y = 3; 217 218 for (p=first; p; p=p->next,i++,y+=wm->font()->Size().y+1) 219 219 p->draw(win,x,y,w-6,0,i==active); 220 220 … … 224 224 { 225 225 int bx=x; 226 if (on_off) bx=x-wm->font()-> width();226 if (on_off) bx=x-wm->font()->Size().x; 227 227 228 228 if (!n) 229 229 { 230 int h=wm->font()-> height();230 int h=wm->font()->Size().y; 231 231 parent->m_surf->WidgetBar(vec2i(x, y + h / 2 - 1), 232 232 vec2i(x + w - 1, y + h / 2), wm->dark_color(), … … 237 237 { 238 238 if (xp!=-1) 239 parent->m_surf->xor_bar(bx,y,x+w-1,y+wm->font()-> height()+1,wm->dark_color());239 parent->m_surf->xor_bar(bx,y,x+w-1,y+wm->font()->Size().y+1,wm->dark_color()); 240 240 else 241 241 { 242 242 parent->m_surf->Bar(vec2i(bx, y), 243 vec2i(x + w - 1, y + wm->font()-> height()+ 1),243 vec2i(x + w - 1, y + wm->font()->Size().y + 1), 244 244 wm->dark_color()); 245 wm->font()-> put_string(parent->m_surf,x+1,y+1,n,wm->medium_color());246 if (on_off && *on_off) wm->font()-> put_string(parent->m_surf,bx+1,y+1,"*",wm->medium_color());245 wm->font()->PutString(parent->m_surf, vec2i(x+1, y+1), n, wm->medium_color()); 246 if (on_off && *on_off) wm->font()->PutString(parent->m_surf, vec2i(bx+1, y+1), "*", wm->medium_color()); 247 247 } 248 248 } else 249 249 { 250 250 if (xp!=-1) 251 parent->m_surf->xor_bar(bx,y,x+w-1,y+wm->font()-> height()+1,wm->dark_color());251 parent->m_surf->xor_bar(bx,y,x+w-1,y+wm->font()->Size().y+1,wm->dark_color()); 252 252 else 253 253 { 254 254 parent->m_surf->Bar(vec2i(bx, y), 255 vec2i(x + w - 1, y + wm->font()-> height()+ 1),255 vec2i(x + w - 1, y + wm->font()->Size().y + 1), 256 256 wm->medium_color()); 257 wm->font()-> put_string(parent->m_surf,x+1,y+1,n,wm->bright_color());258 if (on_off && *on_off) wm->font()-> put_string(parent->m_surf,bx+1,y+1,"*",wm->bright_color());257 wm->font()->PutString(parent->m_surf, vec2i(x + 1, y + 1), n, wm->bright_color()); 258 if (on_off && *on_off) wm->font()->PutString(parent->m_surf, vec2i(bx + 1, y + 1), "*", wm->bright_color()); 259 259 } 260 260 } … … 273 273 { 274 274 if (top) 275 sub->draw(parent,x,y+wm->font()-> height()+2);275 sub->draw(parent,x,y+wm->font()->Size().y+2); 276 276 else 277 277 sub->draw(parent,x+w,y); … … 283 283 { 284 284 if (top) 285 sub->hide(parent,x,y+wm->font()-> height()+2);285 sub->hide(parent,x,y+wm->font()->Size().y+2); 286 286 else 287 287 sub->hide(parent,x+w,y); … … 328 328 int has_flags=0,dx=3; 329 329 for (pmenu_item *p=first; p; p=p->next) if (p->on_off) has_flags=1; 330 if (has_flags) dx+=wm->font()-> width();331 332 int th=wm->font()-> height();330 if (has_flags) dx+=wm->font()->Size().x; 331 332 int th=wm->font()->Size().y; 333 333 if (ev.mouse_move.x>=x && ev.mouse_move.y>=y && ev.mouse_move.x<x+w && ev.mouse_move.y<y+h) 334 334 { … … 363 363 y+=parent->m_pos.y; 364 364 if (ev.mouse_move.x>=x && ev.mouse_move.y>=y && ev.mouse_move.x<x+w && 365 ev.mouse_move.y<y+wm->font()-> height()+2)365 ev.mouse_move.y<y+wm->font()->Size().y+2) 366 366 { 367 367 if (sub) return 1; … … 375 375 { 376 376 if (top) 377 return sub->handle_event(parent,x,y+wm->font()-> height()+2,ev);377 return sub->handle_event(parent,x,y+wm->font()->Size().y+2,ev); 378 378 else return sub->handle_event(parent,x+w,y,ev); 379 379 } else return 0; -
abuse/trunk/src/imlib/pmenu.h
r643 r668 64 64 pmenu_item *top,*active; 65 65 int itemw(pmenu_item *p) 66 { return strlen(p->name())*wm->font()-> width()+2; }66 { return strlen(p->name())*wm->font()->Size().x+2; } 67 67 int itemx(pmenu_item *p); 68 68 pmenu_item *inarea(int mx, int my, image *screen); -
abuse/trunk/src/imlib/scroller.cpp
r665 r668 374 374 char st[10]; 375 375 sprintf(st,"%d",i); 376 wm->font()-> put_string(screen,xo,yo,st,wm->bright_color());376 wm->font()->PutString(screen, vec2i(xo, yo), st, wm->bright_color()); 377 377 xo+=xa; yo+=ya; 378 378 } … … 381 381 void pick_list::area_config() 382 382 { 383 l=wid*wm->font()->width();384 h=th*(wm->font()->height()+1);383 l = wid * wm->font()->Size().x; 384 h = th * (wm->font()->Size().y + 1); 385 385 } 386 386 … … 420 420 if (ev.type==EV_MOUSE_MOVE && activate_on_mouse_move()) 421 421 { 422 int sel=last_sel+(ev.mouse_move.y-m_pos.y)/(wm->font()-> height()+1);422 int sel=last_sel+(ev.mouse_move.y-m_pos.y)/(wm->font()->Size().y+1); 423 423 if (sel!=cur_sel && sel<t && sel>=0) 424 424 { … … 429 429 else if (ev.type==EV_MOUSE_BUTTON) 430 430 { 431 int sel=last_sel+(ev.mouse_move.y-m_pos.y)/(wm->font()-> height()+1);431 int sel=last_sel+(ev.mouse_move.y-m_pos.y)/(wm->font()->Size().y+1); 432 432 if (sel<t && sel>=0) 433 433 { … … 509 509 510 510 int dy=m_pos.y; 511 for (int i=0; i<th; i++,dy+=wm->font()-> height()+1)511 for (int i=0; i<th; i++,dy+=wm->font()->Size().y+1) 512 512 { 513 513 if (i+newx==cur_sel) 514 screen->Bar(vec2i(m_pos.x, dy), vec2i(m_pos.x + wid * wm->font()-> width()- 1,515 dy + wm->font()-> height()),514 screen->Bar(vec2i(m_pos.x, dy), vec2i(m_pos.x + wid * wm->font()->Size().x - 1, 515 dy + wm->font()->Size().y), 516 516 wm->dark_color()); 517 517 if (i+newx<t) 518 wm->font()->put_string(screen,m_pos.x,dy,lis[i+newx].name,wm->bright_color()); 518 wm->font()->PutString(screen, vec2i(m_pos.x, dy), lis[i+newx].name, 519 wm->bright_color()); 519 520 } 520 521 } … … 588 589 void spicker::area_config() 589 590 { 590 if (vert) 591 l=item_width()+4; 592 else 593 l=item_width()*c+4; 594 595 if (vert) 596 h=item_height()*r+4; 597 else 598 h=item_height()+4; 599 591 l = item_width() * (vert ? 1 : c) + 4; 592 h = item_height() * (vert ? r : 1) + 4; 600 593 } 601 594 -
abuse/trunk/src/innet.cpp
r651 r668 563 563 564 564 Jwindow *j=wm->new_window(0,yres/2,-1,-1,new info_field(0, 0, 0, symbol_str("resync"), 565 new button(0, wm->font()-> height()+ 5, ID_NET_DISCONNECT,565 new button(0, wm->font()->Size().y + 5, ID_NET_DISCONNECT, 566 566 symbol_str("slack"),NULL)),symbol_str("hold!")) 567 567 ; … … 667 667 if (total_retry==12000) // 2 minutes and nothing 668 668 { 669 abort=wm->new_window(0,yres/2,-1,wm->font()-> height()*4,669 abort=wm->new_window(0,yres/2,-1,wm->font()->Size().y*4, 670 670 new info_field(0, 0, 0, symbol_str("waiting"), 671 new button(0, wm->font()-> height()+ 5, ID_NET_DISCONNECT,671 new button(0, wm->font()->Size().y + 5, ID_NET_DISCONNECT, 672 672 symbol_str("slack"),NULL)),symbol_str("Error")); 673 673 wm->flush_screen(); -
abuse/trunk/src/level.cpp
r666 r668 1623 1623 sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"player_names",NULL,name_len,0)); 1624 1624 1625 sd.add_by_hand(new spec_entry(SPEC_IMAGE,"thumb nail",NULL,4+160*(100+wm->font()-> height()*2),0));1625 sd.add_by_hand(new spec_entry(SPEC_IMAGE,"thumb nail",NULL,4+160*(100+wm->font()->Size().y*2),0)); 1626 1626 } 1627 1627 … … 1635 1635 void level::write_thumb_nail(bFILE *fp, image *im) 1636 1636 { 1637 image *i = new image(vec2i(160, 100 + wm->font()-> height()* 2));1637 image *i = new image(vec2i(160, 100 + wm->font()->Size().y * 2)); 1638 1638 i->clear(); 1639 1639 scale_put(im,i,0,0,160,100); 1640 1640 if (first_name) 1641 wm->font()-> put_string(i,80-strlen(first_name)*wm->font()->width()/2,100,first_name);1641 wm->font()->PutString(i, vec2i(80 - strlen(first_name) * wm->font()->Size().x / 2, 100), first_name); 1642 1642 1643 1643 time_t t; … … 1646 1646 1647 1647 strftime(buf,80,"%T %A %B %d",localtime(&t)); 1648 wm->font()-> put_string(i,80-strlen(buf)*wm->font()->width()/2,100+wm->font()->height(),buf);1648 wm->font()->PutString(i, vec2i(80, 100) + vec2i(-strlen(buf), 2) * wm->font()->Size() / vec2i(2),buf); 1649 1649 1650 1650 fp->write_uint16(i->Size().x); -
abuse/trunk/src/loadgame.cpp
r659 r668 204 204 thumbnails[start_num] = new image(vec2i(160, 100)); 205 205 thumbnails[start_num]->clear(); 206 console_font-> put_string(thumbnails[start_num],0,0,symbol_str("no_saved"));206 console_font->PutString(thumbnails[start_num], vec2i(0), symbol_str("no_saved")); 207 207 total_saved++; 208 208 if (!first) first=thumbnails[start_num]; -
abuse/trunk/src/menu.cpp
r665 r668 139 139 140 140 int options = ((LList *)args)->GetLength(); 141 int mh=(font-> height()+1)*options+10,maxw=0;141 int mh=(font->Size().y+1)*options+10,maxw=0; 142 142 143 143 Cell *c=(Cell *)args; … … 148 148 } 149 149 150 int mw=(font-> width())*maxw+20;150 int mw=(font->Size().x)*maxw+20; 151 151 int mx=main_screen->Size().x/2-mw/2, 152 152 my=main_screen->Size().y/2-mh/2; … … 157 157 if (title) 158 158 { 159 int tl=strlen(title)*font-> width();159 int tl=strlen(title)*font->Size().x; 160 160 int tx=main_screen->Size().x/2-tl/2; 161 dark_widget(tx-2,my-font-> height()-4,tx+tl+2,my-2,wm->medium_color(),wm->dark_color(),180);162 font-> put_string(main_screen,tx+1,my-font->height()-2,title,wm->bright_color());161 dark_widget(tx-2,my-font->Size().y-4,tx+tl+2,my-2,wm->medium_color(),wm->dark_color(),180); 162 font->PutString(main_screen, vec2i(tx + 1, my-font->Size().y - 2), title,wm->bright_color()); 163 163 } 164 164 … … 170 170 { 171 171 char *ms=men_str(CAR(c)); 172 font-> put_string(main_screen,mx+10+1,y+1,ms,wm->black());173 font-> put_string(main_screen,mx+10,y,ms,wm->bright_color());174 y+=font-> height()+1;172 font->PutString(main_screen, vec2i(mx + 10 + 1, y + 1), ms, wm->black()); 173 font->PutString(main_screen, vec2i(mx + 10, y), ms, wm->bright_color()); 174 y+=font->Size().y+1; 175 175 } 176 176 … … 178 178 Event ev; 179 179 int choice=0,done=0; 180 int bh=font-> height()+3;180 int bh=font->Size().y+3; 181 181 image *save = new image(vec2i(mw - 2,bh)); 182 182 int color=128,cdir=50; … … 216 216 ev.mouse_move.y<my+mh) 217 217 { 218 int msel=(ev.mouse_move.y-my)/(font-> height()+1);218 int msel=(ev.mouse_move.y-my)/(font->Size().y+1); 219 219 if (msel>=options) msel=options-1; 220 220 if (msel==choice) // clicked on already selected item, return it … … 232 232 last_color_time=new time_marker; 233 233 234 int by1=(font-> height()+1)*choice+my+5-2;234 int by1=(font->Size().y+1)*choice+my+5-2; 235 235 int by2=by1+bh-1; 236 236 … … 239 239 240 240 char *cur=men_str(nth(choice,args)); 241 font-> put_string(main_screen,mx+10+1,by1+3,cur,wm->black());242 font-> put_string(main_screen,mx+10,by1+2,cur,wm->bright_color());241 font->PutString(main_screen, vec2i(mx + 10 + 1, by1 + 3), cur, wm->black()); 242 font->PutString(main_screen, vec2i(mx + 10, by1 + 2), cur, wm->bright_color()); 243 243 main_screen->Rectangle(vec2i(mx + 1, by1), vec2i(mx + mw - 2, by2), 244 244 wm->bright_color()); -
abuse/trunk/src/net/gserver.cpp
r651 r668 72 72 sprintf(msg,symbol_str("min_wait"),main_net_cfg->min_players-total_players()); 73 73 stat=wm->new_window(100,50,-1,-1,new info_field(0, 0, ID_NULL,msg, 74 new button(0, wm->font()-> height()*2, ID_CANCEL,symbol_str("cancel_button"),NULL) ));74 new button(0, wm->font()->Size().y * 2, ID_CANCEL,symbol_str("cancel_button"),NULL) )); 75 75 wm->flush_screen(); 76 76 last_count=total_players(); -
abuse/trunk/src/netcfg.cpp
r659 r668 277 277 for (; xx; xx--,sl++) *sl=remap[*sl]; 278 278 279 int fx=x+ns_w/2-strlen(message)*fnt-> width()/2,280 fy=y+ns_h/2-fnt->height();281 282 fnt-> put_string(main_screen,fx+1,fy+1,message,wm->black());283 fnt-> put_string(main_screen,fx,fy,message,wm->bright_color());279 int fx=x+ns_w/2-strlen(message)*fnt->Size().x/2, 280 fy=y+ns_h/2-fnt->Size().y; 281 282 fnt->PutString(main_screen, vec2i(fx + 1, fy + 1), message, wm->black()); 283 fnt->PutString(main_screen, vec2i(fx, fy), message, wm->bright_color()); 284 284 285 285 … … 287 287 char const *ok = symbol_str("ok_button"); 288 288 289 int bx=x+ns_w/2-strlen(ok)*fnt-> width()/2-3,290 by=y+ns_h/2+fnt->height()*3;289 int bx=x+ns_w/2-strlen(ok)*fnt->Size().x/2-3, 290 by=y+ns_h/2+fnt->Size().y*3; 291 291 292 292 button *sb=new button(bx,by,NET_SERVER,ok,NULL); … … 406 406 407 407 408 list=new button(x+80-17,y+ns_h-20-fnt-> height(),NET_OK,ok_image,list);409 list=new button(x+80+17,y+ns_h-20-fnt-> height(),NET_CANCEL,cancel_image,list);408 list=new button(x+80-17,y+ns_h-20-fnt->Size().y,NET_OK,ok_image,list); 409 list=new button(x+80+17,y+ns_h-20-fnt->Size().y,NET_CANCEL,cancel_image,list); 410 410 411 411 int ret=0; … … 457 457 458 458 459 wm->font()-> put_string(main_screen,x+ns_w/2-strlen(nw_s)*fnt->width()/2,y+21/2-fnt->height()/2,459 wm->font()->PutString(main_screen, vec2i(x + ns_w / 2 - strlen(nw_s) * fnt->Size().x / 2, y + 21 / 2 - fnt->Size().y / 2), 460 460 nw_s,wm->medium_color()); 461 461 { 462 462 463 463 char const *server_str = symbol_str("server"); 464 button *sb=new button(x+40, y+ns_h-23-fnt->height(),NET_SERVER,server_str,NULL);464 button *sb=new button(x+40, y+ns_h-23-fnt->Size().y, NET_SERVER, server_str, NULL); 465 465 466 466 if (main_net_cfg && (main_net_cfg->state==CLIENT || main_net_cfg->state==SERVER)) 467 sb=new button(x+40, y+ns_h-9-fnt->height(),NET_SINGLE,symbol_str("single_play"),sb);467 sb=new button(x+40, y+ns_h-9-fnt->Size().y, NET_SINGLE, symbol_str("single_play"), sb); 468 468 469 469 InputManager inm(main_screen,sb); … … 525 525 if (find) 526 526 { 527 int bw=strlen(name)*fnt-> width();527 int bw=strlen(name)*fnt->Size().x; 528 528 inm.add(new button(x+ns_w/2-bw/2,y+button_y,NET_GAME+total_games,name,NULL)); 529 529 find->set_port(server_port); … … 531 531 532 532 total_games++; 533 button_y +=fnt->height()+10;533 button_y += fnt->Size().y + 10; 534 534 inm.redraw(); 535 535 } -
abuse/trunk/src/profile.cpp
r655 r668 62 62 prof_win=wm->new_window(prop->getd("profile x",-1), 63 63 prop->getd("profile y",-1), 64 20 *console_font->width(),65 (prof_height +1)*console_font->height(),64 20 * console_font->Size().x, 65 (prof_height + 1) * console_font->Size().y, 66 66 NULL, 67 67 "PROFILE"); … … 128 128 for (; i<prof_height; i++) 129 129 { 130 console_font-> put_string(prof_win->m_surf,spliter+1,dy,object_names[prof_list[i].otype]);130 console_font->PutString(prof_win->m_surf, vec2i(spliter + 1, dy), object_names[prof_list[i].otype]); 131 131 prof_win->m_surf->Bar(vec2i(spliter - 1 - (int)(prof_list[i].total_time * time_scaler), dy + 1), 132 vec2i(spliter - 1, dy + console_font-> height()- 1),132 vec2i(spliter - 1, dy + console_font->Size().y - 1), 133 133 wm->bright_color()); 134 dy+=console_font-> height()+1;134 dy+=console_font->Size().y+1; 135 135 } 136 137 136 } 138 137 139 140 141 142 143
Note: See TracChangeset
for help on using the changeset viewer.