本文整理汇总了C++中RenderWindow类的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow类的具体用法?C++ RenderWindow怎么用?C++ RenderWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void Widget::start()
{
QSurfaceFormat fmt;
int idx = m_version->currentIndex();
if (idx < 0)
return;
fmt.setVersion(versions[idx].major, versions[idx].minor);
for (size_t i = 0; i < sizeof(profiles) / sizeof(Profile); ++i)
if (static_cast<QRadioButton *>(m_profiles->itemAt(int(i))->widget())->isChecked()) {
fmt.setProfile(profiles[i].profile);
break;
}
bool forceGLSL110 = false;
for (size_t i = 0; i < sizeof(options) / sizeof(Option); ++i)
if (static_cast<QCheckBox *>(m_options->itemAt(int(i))->widget())->isChecked()) {
if (options[i].option)
fmt.setOption(options[i].option);
else if (i == 3)
forceGLSL110 = true;
}
for (size_t i = 0; i < sizeof(renderables) / sizeof(Renderable); ++i)
if (static_cast<QRadioButton *>(m_renderables->itemAt(int(i))->widget())->isChecked()) {
fmt.setRenderableType(renderables[i].renderable);
break;
}
// The example rendering will need a depth buffer.
fmt.setDepthBufferSize(16);
m_output->clear();
m_extensions->clear();
qDebug() << "Requesting surface format" << fmt;
m_renderWindowLayout->removeWidget(m_renderWindowContainer);
delete m_renderWindowContainer;
RenderWindow *renderWindow = new RenderWindow(fmt);
if (!renderWindow->context()) {
m_output->append(tr("Failed to create context"));
delete renderWindow;
m_renderWindowContainer = new QWidget;
addRenderWindow();
return;
}
m_surface = renderWindow;
renderWindow->setForceGLSL110(forceGLSL110);
connect(renderWindow, &RenderWindow::ready, this, &Widget::renderWindowReady);
connect(renderWindow, &RenderWindow::error, this, &Widget::renderWindowError);
m_renderWindowContainer = QWidget::createWindowContainer(renderWindow);
addRenderWindow();
}
示例2: drawBonusObjects
void OtherObjects::drawBonusObjects(RenderWindow &window)
{
if (starSprite.getPosition().x < VideoMode::getDesktopMode().width + 300){
window.draw(starSprite);
}
window.draw(fuelIconSprite[1]);
if (!hardcore) window.draw(healthIconSprite[1]);
}
示例3: drawBorders
void OtherObjects::drawBorders(RenderWindow &window)
{
for (int i=0; i<2; i++){
window.draw(debrisSprite[i]);
}
for (int i=2; i<4; i++){
window.draw(debrisSprite[i]);
}
}
示例4: FrameRender
bool BreakoutAboutState::FrameRender(RenderWindow& window, float frametime)
{
text.setString("About Breakout");
text.setCharacterSize(20);
text.setPosition(window.getSize().x / 2 - text.getGlobalBounds().width / 2, 120);
window.draw(text);
return false;
}
示例5: Draw
void Draw(RenderWindow& window, RectangleStruct rect[QUANTITY])
{
for (int i = 0; i < QUANTITY; i++)
{
window.draw(rect[i].square);
}
window.display();
window.clear(sf::Color::White);
}
示例6: RenderWindow_set_backgroundColor
static VALUE RenderWindow_set_backgroundColor(VALUE vSelf, VALUE vColor) {
// Get C++ object pointer from vSelf
RenderWindow *pSelf;
Data_Get_Struct(vSelf, RenderWindow, pSelf);
Color *pColor;
Data_Get_Struct(vColor, Color, pColor);
pSelf->SetBackgroundColor(*pColor);
return Qnil;
}
示例7: RenderWindow_set_view
static VALUE RenderWindow_set_view(VALUE vSelf, VALUE vView) {
// Get C++ object pointer from vSelf
RenderWindow *pSelf;
Data_Get_Struct(vSelf, RenderWindow, pSelf);
View *pView;
Data_Get_Struct(vView, View, pView);
pSelf->SetView(pView);
return Qnil;
}
示例8: drawFlames
void Player::drawFlames(RenderWindow &window, bool paused)
{
if(getPlayerFuel() > 0){
window.draw(flameSpriteTop);
if (Keyboard::isKeyPressed(Keyboard::Space) || paused || controlScheme == 2 || controlScheme == 3){
window.draw(flameSpriteBottom);
}
}
}
示例9:
///Камера///
Kamera::Kamera(Hero &hero, lv::Level &level, RenderWindow &window)
{
this->hero = &hero;
this->level = &level;
this->window = &window;
view.reset(FloatRect(0.0, 0.0, window.getSize().x, window.getSize().y)); // камера по размеру окна
MapRect.height = level.GetMapSize().y*level.GetTileSize().y; MapRect.width = level.GetMapSize().x*level.GetTileSize().x; // данные о размере карты
L_W_H_Size.x = level.GetMapSize().x*level.GetTileSize().x;
L_W_H_Size.y = level.GetMapSize().y*level.GetTileSize().y;
}
示例10:
startMenu::startMenu(RenderWindow &window, Event &event) :
_start("Старт", Vector2f(window.getView().getSize().x / 2.5f, window.getView().getSize().y / 2.5f), 50),
_options("Настройки", Vector2f(_start.getGlobalBounds().left, _start.getGlobalBounds().top + _start.getGlobalBounds().height), 50),
_autors("Авторы", Vector2f(_start.getGlobalBounds().left, _options.getGlobalBounds().top + _options.getGlobalBounds().height), 50),
_quit("Выход", Vector2f(_start.getGlobalBounds().left, _autors.getGlobalBounds().top + _autors.getGlobalBounds().height), 50),
_window(window), _event(event)
{
_ButtFocus = start;
}
示例11: drawMeters
void OtherObjects::drawMeters(RenderWindow &window)
{
if (!hardcore){
window.draw(healthMeter);
window.draw(healthIconSprite[0]);
}
window.draw(fuelMeter);
window.draw(fuelIconSprite[0]);
}
示例12: drawPlayer
void Player::drawPlayer(RenderWindow &window)
{
window.draw(playerSprite);
if (drawCollisionShapes){
window.draw(collisionCircle[0]);
window.draw(collisionCircle[1]);
window.draw(collisionCircle[2]);
}
}
示例13: RenderWindow_getEvent
static VALUE RenderWindow_getEvent(VALUE vSelf) {
// Get C++ object pointer from vSelf
RenderWindow *pSelf;
Data_Get_Struct(vSelf, RenderWindow, pSelf);
Event ePoll;
if(!pSelf->GetEvent(ePoll))
return Qnil;
DECLARE_OBJ_VAR(Event, Event, ePoll);
return vEvent;
}
示例14: loadingScreen
void loadingScreen(RenderWindow& window) {
Text loadingMessage;
loadingMessage.setFont(infoFont);
loadingMessage.setColor(Color::Green);
loadingMessage.setString("Loading...");
loadingMessage.setPosition(Vector2f(660, 750));
window.clear(Color::Black);
window.draw(loadingMessage);
window.display();
}
示例15: DrawBackground
void DrawBackground(RenderWindow & window, Sprite & wallBackgroundSprite, Sprite & floorBackgroundSprite)
{
//background
wallBackgroundSprite.setOrigin(wallBackgroundSprite.getGlobalBounds().width / 2, wallBackgroundSprite.getGlobalBounds().height / 2);
wallBackgroundSprite.setPosition(view.getCenter().x, view.getCenter().y);
floorBackgroundSprite.setOrigin(floorBackgroundSprite.getGlobalBounds().width / 2, floorBackgroundSprite.getGlobalBounds().height / 2);
floorBackgroundSprite.setPosition(view.getCenter().x, view.getCenter().y);
window.draw(wallBackgroundSprite);
window.draw(floorBackgroundSprite);
}