Ignore:
Timestamp:
May 16, 2011, 2:37:19 AM (11 years ago)
Author:
Sam Hocevar
Message:

imlib: make JCFont use vec2i classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/menu.cpp

    r665 r668  
    139139
    140140  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;
    142142
    143143  Cell *c=(Cell *)args;
     
    148148  }
    149149
    150   int mw=(font->width())*maxw+20;
     150  int mw=(font->Size().x)*maxw+20;
    151151  int mx=main_screen->Size().x/2-mw/2,
    152152      my=main_screen->Size().y/2-mh/2;
     
    157157  if (title)
    158158  {
    159     int tl=strlen(title)*font->width();
     159    int tl=strlen(title)*font->Size().x;
    160160    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());
    163163  }
    164164
     
    170170  {
    171171    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;
    175175  }
    176176
     
    178178  Event ev;
    179179  int choice=0,done=0;
    180   int bh=font->height()+3;
     180  int bh=font->Size().y+3;
    181181  image *save = new image(vec2i(mw - 2,bh));
    182182  int color=128,cdir=50;
     
    216216        ev.mouse_move.y<my+mh)
    217217    {
    218       int msel=(ev.mouse_move.y-my)/(font->height()+1);
     218      int msel=(ev.mouse_move.y-my)/(font->Size().y+1);
    219219      if (msel>=options) msel=options-1;
    220220      if (msel==choice)                    // clicked on already selected item, return it
     
    232232      last_color_time=new time_marker;
    233233
    234       int by1=(font->height()+1)*choice+my+5-2;
     234      int by1=(font->Size().y+1)*choice+my+5-2;
    235235      int by2=by1+bh-1;
    236236
     
    239239
    240240      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());
    243243      main_screen->Rectangle(vec2i(mx + 1, by1), vec2i(mx + mw - 2, by2),
    244244                             wm->bright_color());
Note: See TracChangeset for help on using the changeset viewer.