Ignore:
Timestamp:
Sep 12, 2011, 10:17:23 PM (8 years ago)
Author:
Sam Hocevar
Message:

core: rename vec2i to ivec2 and update matrix.h from Lol Engine.

File:
1 edited

Legend:

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

    r679 r682  
    4545
    4646//percent is 0..256
    47 static void TintArea(vec2i aa, vec2i bb,
     47static void TintArea(ivec2 aa, ivec2 bb,
    4848                     int r_to, int g_to, int b_to, int percent)
    4949{
    50     vec2i caa, cbb;
     50    ivec2 caa, cbb;
    5151    main_screen->GetClip(caa, cbb);
    5252    aa = Max(aa, caa);
     
    7575}
    7676
    77 void DarkWidget(vec2i aa, vec2i bb, int br, int dr, int amount)
     77void DarkWidget(ivec2 aa, ivec2 bb, int br, int dr, int amount)
    7878{
    7979    main_screen->AddDirty(aa, bb);
    80     main_screen->Line(aa, vec2i(aa.x, bb.y - 1), br);
    81     main_screen->Line(aa, vec2i(bb.x - 1, aa.y), br);
    82     main_screen->Line(vec2i(bb.x - 1, aa.y + 1), bb - vec2i(1), dr);
    83     main_screen->Line(vec2i(aa.x + 1, bb.y - 1), bb - vec2i(1), dr);
    84     TintArea(aa + vec2i(1), bb, 0, 0, 0, amount);
     80    main_screen->Line(aa, ivec2(aa.x, bb.y - 1), br);
     81    main_screen->Line(aa, ivec2(bb.x - 1, aa.y), br);
     82    main_screen->Line(ivec2(bb.x - 1, aa.y + 1), bb - ivec2(1), dr);
     83    main_screen->Line(ivec2(aa.x + 1, bb.y - 1), bb - ivec2(1), dr);
     84    TintArea(aa + ivec2(1), bb, 0, 0, 0, amount);
    8585}
    8686
     
    131131
    132132
    133   main_screen->AddDirty(vec2i(mx, my), vec2i(mx + mw, my + mh));
     133  main_screen->AddDirty(ivec2(mx, my), ivec2(mx + mw, my + mh));
    134134
    135135  if (title)
     
    137137    int tl=strlen(title)*font->Size().x;
    138138    int tx=main_screen->Size().x/2-tl/2;
    139     DarkWidget(vec2i(tx - 2, my-font->Size().y - 4), vec2i(tx + tl + 3, my - 1), wm->medium_color(),wm->dark_color(),180);
    140     font->PutString(main_screen, vec2i(tx + 1, my-font->Size().y - 2), title, wm->bright_color());
    141   }
    142 
    143   DarkWidget(vec2i(mx, my), vec2i(mx + mw, my + mh),
     139    DarkWidget(ivec2(tx - 2, my-font->Size().y - 4), ivec2(tx + tl + 3, my - 1), wm->medium_color(),wm->dark_color(),180);
     140    font->PutString(main_screen, ivec2(tx + 1, my-font->Size().y - 2), title, wm->bright_color());
     141  }
     142
     143  DarkWidget(ivec2(mx, my), ivec2(mx + mw, my + mh),
    144144             wm->medium_color(), wm->dark_color(), 200);
    145145
     
    149149  {
    150150    char *ms=men_str(CAR(c));
    151     font->PutString(main_screen, vec2i(mx + 10 + 1, y + 1), ms, wm->black());
    152     font->PutString(main_screen, vec2i(mx + 10, y), ms, wm->bright_color());
     151    font->PutString(main_screen, ivec2(mx + 10 + 1, y + 1), ms, wm->black());
     152    font->PutString(main_screen, ivec2(mx + 10, y), ms, wm->bright_color());
    153153    y+=font->Size().y+1;
    154154  }
     
    158158  int choice=0,done=0;
    159159  int bh=font->Size().y+3;
    160   image *save = new image(vec2i(mw - 2,bh));
     160  image *save = new image(ivec2(mw - 2,bh));
    161161  int color=128,cdir=50;
    162162
     
    214214      int by2=by1+bh-1;
    215215
    216       save->PutPart(main_screen, vec2i(0, 0), vec2i(mx + 1, by1), vec2i(mx + mw - 1, by2 + 1));
    217       TintArea(vec2i(mx + 1, by1), vec2i(mx + mw - 1, by2 + 1),
     216      save->PutPart(main_screen, ivec2(0, 0), ivec2(mx + 1, by1), ivec2(mx + mw - 1, by2 + 1));
     217      TintArea(ivec2(mx + 1, by1), ivec2(mx + mw - 1, by2 + 1),
    218218               63, 63, 63, color);
    219219
    220220      char *cur=men_str(nth(choice,args));
    221       font->PutString(main_screen, vec2i(mx + 10 + 1, by1 + 3), cur, wm->black());
    222       font->PutString(main_screen, vec2i(mx + 10, by1 + 2), cur, wm->bright_color());
    223       main_screen->Rectangle(vec2i(mx + 1, by1), vec2i(mx + mw - 2, by2),
     221      font->PutString(main_screen, ivec2(mx + 10 + 1, by1 + 3), cur, wm->black());
     222      font->PutString(main_screen, ivec2(mx + 10, by1 + 2), cur, wm->bright_color());
     223      main_screen->Rectangle(ivec2(mx + 1, by1), ivec2(mx + mw - 2, by2),
    224224                             wm->bright_color());
    225225
     
    232232      }
    233233      wm->flush_screen();
    234       main_screen->PutImage(save, vec2i(mx + 1, by1));
     234      main_screen->PutImage(save, ivec2(mx + 1, by1));
    235235    } else { Timer tmp; tmp.WaitMs(10); }
    236236
     
    376376  if (DEFINEDP(ss->GetValue()))
    377377  {
    378     image blank(vec2i(2, 2)); blank.clear();
    379     wm->SetMouseShape(blank.copy(), vec2i(0, 0));      // don't show mouse
     378    image blank(ivec2(2, 2)); blank.clear();
     379    wm->SetMouseShape(blank.copy(), ivec2(0, 0));      // don't show mouse
    380380
    381381    LObject *tmp = (LObject *)ss->GetValue();
     
    396396      tmp = (LObject *)CDR(tmp);
    397397    }
    398     wm->SetMouseShape(cache.img(c_normal)->copy(), vec2i(1, 1));
     398    wm->SetMouseShape(cache.img(c_normal)->copy(), ivec2(1, 1));
    399399  }
    400400}
     
    640640    inm->clear_current();
    641641
    642     main_screen->AddDirty(vec2i(0), vec2i(320, 200));
     642    main_screen->AddDirty(ivec2(0), ivec2(320, 200));
    643643
    644644    Event ev;
Note: See TracChangeset for help on using the changeset viewer.