本文整理匯總了C++中Box2D::getTopSide方法的典型用法代碼示例。如果您正苦於以下問題:C++ Box2D::getTopSide方法的具體用法?C++ Box2D::getTopSide怎麽用?C++ Box2D::getTopSide使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Box2D
的用法示例。
在下文中一共展示了Box2D::getTopSide方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: draw
void RectangleSDL::draw(Box2D & area, Color::enColor color, SDL_Surface *screen) {
GLfloat c = 0.5;
glBegin(GL_LINE_LOOP);
glColor3f(c, c, c);
glVertex2i(area.getLeftSide(), area.getTopSide());
glVertex2i(area.getRightSide(), area.getTopSide());
glVertex2i(area.getRightSide(), area.getBottomSide());
glVertex2i(area.getLeftSide(), area.getBottomSide());
glEnd();
/*
SDL_Color c = Color::getColor(color);
boxRGBA(screen, area.getLeftSide(), area.getTopSide(), area.getRightSide(), area.getBottomSide(), c.r, c. g, c. b, 255);
*/
}
示例2: generateObjects
/*
* Gera n objetos aleatórios
*/
void QtSDL::generateObjects(int n) {
int x, y, size;
bool horizontal;
bool vertical;
int speed;
objects->clear();
Box2D limits = getRoot()->getArea();
for (int i=0; i < n; i++) {
x = randomNumber(limits.getLeftSide() + 5, limits.getRightSide() - 5);
y = randomNumber(limits.getTopSide() + 5, limits.getBottomSide() - 5);
size = randomNumber(2, 6);
horizontal = randomBool();
vertical = randomBool();
speed = randomNumber(1, 2);
objects->push_back(new RectangleSDL(Color::Blue, x, y, size, horizontal, vertical, speed));
}
}