本文整理汇总了C++中drawBox函数的典型用法代码示例。如果您正苦于以下问题:C++ drawBox函数的具体用法?C++ drawBox怎么用?C++ drawBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawBox函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawBox
void GPUOctree::drawBoxNode(const XYZ& center, float size, int x, int y) const
{
drawBox(center, size);
int pools = x * 2;
int poolt = y * 2;
float halfSize = size/2;
XYZ halfCenter;
for (int k=0;k<2;k++) {
for (int j=0;j<2;j++) {
for (int i=0;i<2;i++) {
unsigned long poolloc = (poolt + j)*INDIRECTIONPOOLWIDTH + pools + i;
if(i==0) halfCenter.x = center.x - halfSize;
else halfCenter.x = center.x + halfSize;
if(j==0) halfCenter.y = center.y - halfSize;
else halfCenter.y = center.y + halfSize;
if(k==0) halfCenter.z = center.z - halfSize;
else halfCenter.z = center.z + halfSize;
if(k==0) {
x = m_idr[poolloc*4];
y = m_idr[poolloc*4+1];
if(x >=0) drawBoxNode(halfCenter, halfSize, x, y);
}
else {
x = m_idr[poolloc*4+2];
y = m_idr[poolloc*4+3];
if(x >=0) drawBoxNode(halfCenter, halfSize, x, y);
}
}
}
}
}
示例2: DebugPrintf
void ScummDebugger::printBox(int box) {
if (box < 0 || box >= _vm->getNumBoxes()) {
DebugPrintf("%d is not a valid box!\n", box);
return;
}
BoxCoords coords;
int flags = _vm->getBoxFlags(box);
int mask = _vm->getMaskFromBox(box);
int scale = _vm->getBoxScale(box);
_vm->getBoxCoordinates(box, &coords);
// Print out coords, flags, zbuffer mask
DebugPrintf("%d: [%d x %d] [%d x %d] [%d x %d] [%d x %d], flags=0x%02x, mask=%d, scale=%d\n",
box,
coords.ul.x, coords.ul.y, coords.ll.x, coords.ll.y,
coords.ur.x, coords.ur.y, coords.lr.x, coords.lr.y,
flags, mask, scale);
// Draw the box
drawBox(box);
}
示例3: switch
void QGLE::drawOSnap(QPainter *p, QPair<QPointF, int> snap)
{
p->setPen(osnapPen());
// Switch on snap.second
switch(snap.second)
{
case PerpendicularSnap:
drawPerpMark(p,snap.first,osnapPen());
break;
case TangentSnap:
drawTangentMark(p,snap.first,osnapPen());
break;
case IntersectSnap:
drawIntersectMark(p, snap.first, osnapPen());
break;
default:
drawBox(p,snap.first,OSNAP_BOX_SIZE,osnapPen());
}
}
示例4: glColor3d
unsigned int nRenderer::drawNode(nRTreeNode *node, unsigned int lev){
if(node->isNull() || (node->isLeaf() && node->getChildren().size() == 1)) {
return 0;
}
unsigned int nodes = 1;
unsigned int mod = lev % 7 + 1;
glColor3d((mod & 0b001) ? 1 : 0, (mod & 0b010) ? 1 : 0, (mod & 0b100) ? 1 : 0);
DrawMode m = getDrawMode();
setDrawMode(WireFrame);
setAttribute(BackFaceCulling, false);
drawBox(nBoundingBox::create(node->getNegative(), node->getPositive()));
if(!node->isLeaf()) {
list<nRTreeNode *> lst = node->getSubNodes();
for(list<nRTreeNode *>::iterator it = lst.begin(); it != lst.end(); it++) {
nodes += drawNode(*it, lev + 1);
}
}
setAttribute(BackFaceCulling, true);
setDrawMode(m);
nMaterial::release();
return nodes;
}
示例5: drawCursor
void drawCursor()
{
Entity *e;
if (cursor.type == TILES)
{
drawImage(tileImage(cursor.tileID), cursor.x, cursor.y, FALSE, 255);
drawImage(tileImage(BLANK_TILE), cursor.x, cursor.y, FALSE, 255);
}
else
{
e = isSpaceEmpty(&cursor.entity);
if (isValidOnMap(&cursor.entity) == 0 || e != NULL)
{
drawBox(game.screen, cursor.x, cursor.y, cursor.entity.w, cursor.entity.h, 255, 0, 0);
}
if (e != NULL)
{
setStatusPanelMessage("%s : %d %d", (strlen(e->objectiveName) == 0 ? e->name : e->objectiveName), (int)e->x, (int)e->y);
}
else
{
setStatusPanelMessage("");
}
cursor.entity.x = getMapStartX() + cursor.x;
cursor.entity.y = getMapStartY() + cursor.y;
self = &cursor.entity;
self->draw();
}
}
示例6: getWidth
void RadioButton::draw(Graphics* graphics)
{
graphics->pushClipArea(Rectangle(1,
1,
getWidth() - 1,
getHeight() - 1));
drawBox(graphics);
graphics->popClipArea();
graphics->setFont(getFont());
graphics->setColor(getForegroundColor());
if (isFocused())
{
int fh;
if (getHeight()%2 == 0)
{
fh = getHeight() - 4;
}
else
{
fh = getHeight() - 3;
}
int hh = (fh + 1) / 2;
graphics->drawLine(0, hh + 1, hh + 1, 0);
graphics->drawLine(hh + 2, 1, fh + 2, hh + 1);
graphics->drawLine(fh + 1, hh + 2, hh + 1, fh + 2);
graphics->drawLine(hh + 1, fh + 2, 1, hh + 2);
}
int h = getHeight() + getHeight() / 2;
graphics->drawText(getCaption(), h - 2, 0);
}
示例7: glClearColor
void GLWidget::paintGL()
{
glClearColor(0.0, 0.3, 0.0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
drawInfo();
m_camera->setUp();
m_light->setUp();
m_forklift->draw();
drawBox();
glFlush();
}
示例8: printSelect
// Select a card to play
void printSelect(GlobalState* globalData) {
// LCD menu
clean(RED);
drawBoxFill(0, 0, 20, V - 1, RED);
drawBox(0, 0, 20, V - 1, 2, WHITE);
// Prints messages to LCD based off of keypad input
switch(globalData->keyStatus) {
case 0:
prints(35, 7, WHITE, RED, "Choose a card by its slot number:", 1);
break;
case 1:
prints(35, 7, WHITE, RED, "Invalid input. Please enter a key between 1 to 4:", 1);
break;
case 2:
prints(35, 7, WHITE, RED, "No card found. Please try again:", 1);
break;
}
// Display commands to select a slot - the LED's should indicate if a card is read
prints(35, 30, WHITE, BLACK, "Slot 1", 1);
prints(35, 60, WHITE, BLACK, "Slot 2", 1);
prints(35, 90, WHITE, BLACK, "Slot 3", 1);
prints(35, 120, WHITE, BLACK, "Slot 4", 1);
}
示例9: PainterShow
void PainterShow (KinoWidget w, LargeRegion r, Boolean move)
{
#ifdef DEBUG
fprintf (stderr, "+++ %s: (%d|%d)-(%dx%d)\n", __PRETTY_FUNCTION__,
r.x, r.y, r.width, r.height);
#endif
if (XtWindow (w) != None && w->kino.document && w->kino.painterEnable)
{
/* move all insets to their new places */
if (move) PainterRepositionInsets (w);
/* clear the exposed area */
XClearArea (XtDisplay (w), XtWindow (w),
r.x, r.y, r.width, r.height, False);
/* draw all Node elements */
drawBox (w, w->kino.document->root, 0, 0, r);
}
}
示例10: drawSkyDome
void drawSkyDome(Vector position, int size, Texture *texture)
{
glDepthMask(GL_FALSE);
glDisable(GL_FOG);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glBindTexture(GL_TEXTURE_2D, texture->data);
drawBox(position, 24, 24, 24, mission->skySphereSize);
glEnable(GL_FOG);
glDepthMask(GL_TRUE);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
}
示例11: renderScene
void renderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();
glTranslatef(-0.2, 0, 0); // 平移
//glScalef(2, 1, 1); // 缩放
times++;
if(times > 100)
{
times = 0;
}
if(times % 100 == 0)
{
rotate += 0.3;
}
glRotatef(rotate, 0, 1, 0);
glRotatef(rotate, 1, 0, 0);
//
glColor3f(1, 0, 0);
//
// DrawCube();
drawBox(0,0,0,0.5,0.5,0.5);
glPopMatrix();
glutSwapBuffers();
}
示例12: drawTowerExplain
void drawTowerExplain() {
int startX = 125;
int startY = 20;
drawBox(startX,startY,40,22,0);
mvaddstr(startY+2,startX+8,"Tower Types");
mvaddch(startY+4, startX+3, basicLine | A_ALTCHARSET);
mvaddstr(startY+4,startX+5,"- Single shot tower (Attacks only");
mvaddstr(startY+5,startX+5," a single unit at a time)");
mvaddch(startY+7, startX+3, AOE | A_ALTCHARSET);
mvaddstr(startY+7,startX+5,"- Area of effect tower (Attacks");
mvaddstr(startY+8,startX+5," all units in the area)");
mvaddch(startY+10, startX+3, bomb | A_ALTCHARSET);
mvaddstr(startY+10,startX+5,"- Bomb tower (Attacks one unit,");
mvaddstr(startY+11,startX+5," and does splash damage to");
mvaddstr(startY+12,startX+5," nearby units)");
mvaddch(startY+14, startX+3, collat | A_ALTCHARSET);
mvaddstr(startY+14,startX+5,"- Collateral (Attacks one unit,");
mvaddstr(startY+15,startX+5," and chains to multiple");
mvaddstr(startY+16,startX+5," following units)");
mvaddch(startY+18, startX+3, reset | A_ALTCHARSET);
mvaddstr(startY+18,startX+5,"- Reset tower (Moves a unit to");
mvaddstr(startY+19,startX+5," the beginning of the pathway)");
}
示例13: perceptualGrouping
//.........这里部分代码省略.........
boxes[i].bottom.i = -1;
boxes[i].bottom.j = -1;
boxes[i].size = 0;
//for each positive blob
for(int j = 0;j < c;j++)
{
//if its in this group
if(positiveBlobs[j].group == i)
{
//add it to the bbox
boxes[i].size++;
boxes[i] = extendBox(boxes[i],positiveBlobs[j].top,positiveBlobs[j].bottom);
}
}
//for each negative blob
for(int j = 0;j < n;j++)
{
//if its in this group
if(negativeBlobs[j].group == i)
{
//add it to the bbox
boxes[i].size++;
boxes[i] = extendBox(boxes[i],negativeBlobs[j].top,negativeBlobs[j].bottom);
}
}
}
//for each box
for(int i = 0;i < groupCount;i++)
{
//if its got more than one thing in it
//printf("%i \n",boxes[i].size);
if(boxes[i].size > 1)
{
//draw it
drawBox(boxes[i],displayImage);
}
}
//show the image
cvSaveImage("grouping.png",displayImage);
cvNamedWindow("ImageWindow", CV_WINDOW_AUTOSIZE);
cvShowImage("ImageWindow", displayImage);
printf("Image displayed...\n");
//wait till key is pressed
printf("PRESS A KEY NOW...\n");
cvWaitKey(0);
//update img
int target[positiveSource.height][positiveSource.width];
for(int i = 0;i < positiveSource.height;i++)
{
for(int j = 0;j < positiveSource.width;j++)
{
int pos = positiveSource.labels[(i * positiveSource.width) + j];
pos = positiveMappings[pos];
if(pos != -1)
{
pos = positiveBlobs[pos].group;
pos = boxes[pos].size;
}
int neg = negativeSource.labels[(i * negativeSource.width) + j];
//int neg = -1;
neg = negativeMappings[neg];
if(pos != -1)
{
neg = negativeBlobs[neg].group;
neg = boxes[neg].size;
}
if(pos > 1 || neg > 1)
{
target[i][j] = 255;
}else
{
target[i][j] = 0;
}
}
}
uchar* data = (uchar *)img->imageData;
//copy new data into image
for(int i = 0; i < positiveSource.height;i++)
{
for(int j = 0; j < positiveSource.width; j++)
{
data[(i*img->widthStep) + j ] = target[i][j];
//printf("%i %i %u \n",i,j,test[i][j]);
}
}
img->imageData = (char*)data;
printf("Done\n");
}
示例14: drawBox
void EndLevel::draw()
{
if(m_visible)
{
txtcord+=dirmov*ft;
const Vector3D m_taille=m_size;
double mosaic=1;
Lighting::getInstance()->glEnableLighting();
if(m_selected)
drawBox();
glColor4ub(255,255,255,255);
if(m_texture!=NULL)
m_texture->bind();
glPushMatrix();
glTranslated(m_position.X,m_position.Y,m_position.Z);
Lighting::getInstance()->glDisableLighting();
glTranslated(0,0,m_taille.Z*2*0);
glDisable(GL_CULL_FACE);
m_texture->bind();
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glEnable(GL_BLEND);
glBegin(GL_QUADS);
glNormal3d(0.0,1.0,0.0);
glTexCoord2d(0-txtcord.Y/100,m_taille.Z*2/mosaic-txtcord.X/100); glVertex3d(m_taille.X,m_taille.Y,m_taille.Z*2);
glTexCoord2d(0-txtcord.Y/100,0-txtcord.X/100); glVertex3d(m_taille.X,m_taille.Y,0);
glTexCoord2d(m_taille.X*2/mosaic-txtcord.Y/100,0-txtcord.X/100); glVertex3d(-m_taille.X,m_taille.Y,0);
glTexCoord2d(m_taille.X*2/mosaic-txtcord.Y/100,m_taille.Z*2/mosaic-txtcord.X/100); glVertex3d(-m_taille.X,m_taille.Y,m_taille.Z*2);
glNormal3d(1.0,0.0,0.0);
glTexCoord2d(0-txtcord.Y/100,m_taille.Z*2/mosaic-txtcord.X/100); glVertex3d(m_taille.X,-m_taille.Y,m_taille.Z*2);
glTexCoord2d(0-txtcord.Y/100,0-txtcord.X/100); glVertex3d(m_taille.X,-m_taille.Y,-m_taille.Z*0);
glTexCoord2d(m_taille.Y*2/mosaic-txtcord.Y/100,0-txtcord.X/100); glVertex3d(m_taille.X,m_taille.Y,-m_taille.Z*0);
glTexCoord2d(m_taille.Y*2/mosaic-txtcord.Y/100,m_taille.Z*2/mosaic-txtcord.X/100); glVertex3d(m_taille.X,m_taille.Y,m_taille.Z*2);
glNormal3d(0.0,-1.0,0.0);
glTexCoord2d(0-txtcord.Y/100,m_taille.Z*2/mosaic-txtcord.X/100); glVertex3d(-m_taille.X,-m_taille.Y,m_taille.Z*2);
glTexCoord2d(0-txtcord.Y/100,0-txtcord.X/100); glVertex3d(-m_taille.X,-m_taille.Y,-m_taille.Z*0);
glTexCoord2d(m_taille.X*2/mosaic-txtcord.Y/100,0-txtcord.X/100); glVertex3d(m_taille.X,-m_taille.Y,-m_taille.Z*0);
glTexCoord2d(m_taille.X*2/mosaic-txtcord.Y/100,m_taille.Z*2/mosaic-txtcord.X/100); glVertex3d(m_taille.X,-m_taille.Y,m_taille.Z*2);
glNormal3d(-1.0,0.0,0.0);
glTexCoord2d(0-txtcord.Y/100,m_taille.Z*2/mosaic-txtcord.X/100); glVertex3d(-m_taille.X,m_taille.Y,m_taille.Z*2);
glTexCoord2d(0-txtcord.Y/100,0-txtcord.X/100); glVertex3d(-m_taille.X,m_taille.Y,-m_taille.Z*0);
glTexCoord2d(m_taille.Y*2/mosaic-txtcord.Y/100,0-txtcord.X/100); glVertex3d(-m_taille.X,-m_taille.Y,-m_taille.Z*0);
glTexCoord2d(m_taille.Y*2/mosaic-txtcord.Y/100,m_taille.Z*2/mosaic-txtcord.X/100); glVertex3d(-m_taille.X,-m_taille.Y,m_taille.Z*2);
glEnd();
glDisable(GL_BLEND);
glPopMatrix();
glColor3ub(255,255,255);
Lighting::getInstance()->glEnableLighting();
}
}
示例15: drawTitle
//senquack - partial conversion to fixed point
//void drawTitle() {
// int i;
// int r, g, b;
// int sx, sy;
// char *stgChr = "STAGE";
// char *quitChr = "QUIT";
// char *mdChr[] = {"NORMAL MODE", "PSY MODE", "IKA MODE", "GW MODE"};
// int mdChrX[] = {270, 330, 330, 350};
// char mdIni[] = {'N', 'P', 'I', 'G'};
// drawTitleBoard();
//
// for ( i=-MODE_NUM ; i<STAGE_NUM+1 ; i++ ) {
// if ( i < 0 ) {
// if ( 4+i == mode ) {
// r = 100; g = 100; b = 240;
// } else {
// r = 150; g = 150; b = 200;
// }
// } else if ( i < QUIT_STAGE_NUM && hiScore.cleard[mode][i] ) {
// r = 240; g = 180; b = 180;
// } else {
// r = 210; g = 210; b = 240;
// }
// sx = stageX[i+MODE_NUM]; sy = stageY[i+MODE_NUM];
// if ( i == slcStg ) {
// int sz = STG_BOX_SIZE*3/2;
// if ( titleCnt < 16 ) sz = sz*titleCnt/16;
// drawBox(sx, sy, sz, sz, r, g, b);
// sz = sz*3/5;
// if ( i < 0 ) {
// int md = MODE_NUM+i;
// drawString(mdChr[md], mdChrX[md], 133, 12, 0, 150, 150, 200);
// drawLetter(mdIni[md]-'A'+10, sx, sy, sz, 0, 150, 150, 240);
// } else if ( i < QUIT_STAGE_NUM ) {
// makeStageStr(i);
// drawString(stageStr, sx-sz, sy, sz, 0, 210, 210, 240);
// drawString(stgChr, 330, 133, 12, 0, 210, 210, 240);
// drawString(stageStr, 445, 133, 12, 0, 210, 210, 240);
// drawNumCenter(hiScore.score[mode][i], 466, 168, 12, 210, 210, 240);
// } else {
// drawLetter('Q'-'A'+10, sx, sy, sz, 0, 210, 210, 240);
// drawString(quitChr, 410, 133, 12, 0, 210, 210, 240);
// }
// } else {
// drawBox(sx, sy, STG_BOX_SIZE/2, STG_BOX_SIZE/2, r*2/3, g*2/3, b*2/3);
// }
// }
// drawString(mdChr[mode], mdChrX[mode], 455, 12, 0, 150, 150, 200);
//}
void drawTitle() {
int i;
int r, g, b;
int sx, sy;
char *stgChr = "STAGE";
char *quitChr = "QUIT";
char *mdChr[] = {"NORMAL MODE", "PSY MODE", "IKA MODE", "GW MODE"};
int mdChrX[] = {270, 330, 330, 350};
char mdIni[] = {'N', 'P', 'I', 'G'};
drawTitleBoard();
for ( i=-MODE_NUM ; i<STAGE_NUM+1 ; i++ ) {
if ( i < 0 ) {
if ( 4+i == mode ) {
r = 100; g = 100; b = 240;
} else {
r = 150; g = 150; b = 200;
}
} else if ( i < QUIT_STAGE_NUM && hiScore.cleard[mode][i] ) {
r = 240; g = 180; b = 180;
} else {
r = 210; g = 210; b = 240;
}
sx = stageX[i+MODE_NUM]; sy = stageY[i+MODE_NUM];
if ( i == slcStg ) {
int sz = STG_BOX_SIZE*3/2;
if ( titleCnt < 16 ) sz = sz*titleCnt/16;
#ifdef FIXEDMATH
drawBox(INT2FNUM(sx), INT2FNUM(sy), INT2FNUM(sz), INT2FNUM(sz), r, g, b);
#else
drawBox(sx, sy, sz, sz, r, g, b);
#endif //FIXEDMATH
sz = sz*3/5;
if ( i < 0 ) {
int md = MODE_NUM+i;
drawString(mdChr[md], mdChrX[md], 133, 12, 0, 150, 150, 200);
// letter at top N/P/G/I
drawLetter(mdIni[md]-'A'+10, sx, sy, sz, 0, 150, 150, 240);
} else if ( i < QUIT_STAGE_NUM ) {
makeStageStr(i);
// 2-char stage ID below (1a, 2a, etc)
drawString(stageStr, sx-sz, sy, sz, 0, 210, 210, 240);
drawString(stgChr, 330, 133, 12, 0, 210, 210, 240);
drawString(stageStr, 445, 133, 12, 0, 210, 210, 240);
drawNumCenter(hiScore.score[mode][i], 466, 168, 12, 210, 210, 240);
} else {
// "q" for quit
//.........这里部分代码省略.........