本文整理汇总了C++中Bitmap::DrawRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Bitmap::DrawRect方法的具体用法?C++ Bitmap::DrawRect怎么用?C++ Bitmap::DrawRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitmap
的用法示例。
在下文中一共展示了Bitmap::DrawRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_text_window_and_bar
void draw_text_window_and_bar(Bitmap **text_window_ds, bool should_free_ds,
int*xins,int*yins,int*xx,int*yy,int*wii,color_t *set_text_color,int ovrheight, int ifnum) {
draw_text_window(text_window_ds, should_free_ds, xins, yins, xx, yy, wii, set_text_color, ovrheight, ifnum);
if ((topBar.wantIt) && (text_window_ds && *text_window_ds)) {
// top bar on the dialog window with character's name
// create an enlarged window, then free the old one
Bitmap *ds = *text_window_ds;
Bitmap *newScreenop = BitmapHelper::CreateBitmap(ds->GetWidth(), ds->GetHeight() + topBar.height, game.GetColorDepth());
newScreenop->Blit(ds, 0, 0, 0, topBar.height, ds->GetWidth(), ds->GetHeight());
delete *text_window_ds;
*text_window_ds = newScreenop;
ds = *text_window_ds;
// draw the top bar
color_t draw_color = ds->GetCompatibleColor(play.top_bar_backcolor);
ds->FillRect(Rect(0, 0, ds->GetWidth() - 1, topBar.height - 1), draw_color);
if (play.top_bar_backcolor != play.top_bar_bordercolor) {
// draw the border
draw_color = ds->GetCompatibleColor(play.top_bar_bordercolor);
for (int j = 0; j < play.top_bar_borderwidth; j++)
ds->DrawRect(Rect(j, j, ds->GetWidth() - (j + 1), topBar.height - (j + 1)), draw_color);
}
// draw the text
int textx = (ds->GetWidth() / 2) - wgettextwidth_compensate(topBar.text, topBar.font) / 2;
color_t text_color = ds->GetCompatibleColor(play.top_bar_textcolor);
wouttext_outline(ds, textx, play.top_bar_borderwidth + 1, topBar.font, text_color, topBar.text);
// don't draw it next time
topBar.wantIt = 0;
// adjust the text Y position
yins[0] += topBar.height;
}
else if (topBar.wantIt)
topBar.wantIt = 0;
}
示例2: __actual_invscreen
//.........这里部分代码省略.........
}
else if (cmode==MODE_USE) {
// use objects on each other
play.usedinv=toret;
// set the activeinv so the script can check it
int activeinvwas = playerchar->activeinv;
playerchar->activeinv = toret;
domouse(2);
run_event_block_inv(dii[clickedon].num, 3);
// if the script didn't change it, then put it back
if (playerchar->activeinv == toret)
playerchar->activeinv = activeinvwas;
// in case the script did anything to the screen, redraw it
mainloop();
// They used the active item and lost it
if (playerchar->inv[toret] < 1) {
cmode = CURS_ARROW;
set_mouse_cursor(cmode);
toret = -1;
}
goto start_actinv;
// continue;
}
toret=dii[clickedon].num;
// int plusng=play.using; play.using=toret;
update_inv_cursor(toret);
set_mouse_cursor(MODE_USE);
cmode=MODE_USE;
// play.using=plusng;
// break;
continue;
}
else {
if (mousex >= windowxp+windowwid-ARROWBUTTONWID) {
if (mousey < buttonyp + get_fixed_pixel_size(2) + ARROWBUTTONWID) {
if (top_item > 0) {
top_item -= ICONSPERLINE;
domouse(2);
goto start_actinv;
}
}
else if ((mousey < buttonyp + get_fixed_pixel_size(4) + ARROWBUTTONWID*2) && (top_item + num_visible_items < numitems)) {
top_item += ICONSPERLINE;
domouse(2);
goto start_actinv;
}
continue;
}
int buton=(mousex-windowxp)-2;
if (buton<0) continue;
buton/=BUTTONWID;
if (buton>=3) continue;
if (buton==0) { toret=-1; cmode=MODE_LOOK; }
else if (buton==1) { cmode=CURS_ARROW; toret=-1; }
else break;
set_mouse_cursor(cmode);
}
}
else if (mclick == RIGHT) {
if (cmode == CURS_ARROW)
cmode = MODE_LOOK;
else
cmode = CURS_ARROW;
toret = -1;
set_mouse_cursor(cmode);
}
else if (isonitem!=wasonitem) { domouse(2);
int rectxp=barxp+1+(wasonitem%4)*widest;
int rectyp=bartop+1+((wasonitem - top_item)/4)*highest;
if (wasonitem>=0) {
draw_color = ds->GetCompatibleColor(0);
ds->DrawRect(Rect(rectxp,rectyp,rectxp+widest-1,rectyp+highest-1), draw_color);
}
if (isonitem>=0) { draw_color = ds->GetCompatibleColor(14);//opts.invrectcol);
rectxp=barxp+1+(isonitem%4)*widest;
rectyp=bartop+1+((isonitem - top_item)/4)*highest;
ds->DrawRect(Rect(rectxp,rectyp,rectxp+widest-1,rectyp+highest-1), draw_color);
}
domouse(1);
}
wasonitem=isonitem;
while (timerloop == 0) {
update_polled_stuff_if_runtime();
platform->YieldCPU();
}
}
while (kbhit()) getch();
set_default_cursor();
domouse(2);
construct_virtual_screen(true);
in_inv_screen--;
return toret;
}