当前位置: 首页>>代码示例>>C++>>正文


C++ RenderWindow类代码示例

本文整理汇总了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();
}
开发者ID:RSATom,项目名称:Qt,代码行数:57,代码来源:widget.cpp

示例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]);
}
开发者ID:DrJonki,项目名称:SpaceDash,代码行数:9,代码来源:OtherObjects.cpp

示例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]);
	}
}
开发者ID:DrJonki,项目名称:SpaceDash,代码行数:9,代码来源:OtherObjects.cpp

示例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;
}
开发者ID:corebob,项目名称:nostalgic-games,代码行数:9,代码来源:BreakoutAboutState.cpp

示例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);
}
开发者ID:ultimatum424,项目名称:Screensaver,代码行数:9,代码来源:main.cpp

示例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;
}
开发者ID:freemaul,项目名称:SFML,代码行数:9,代码来源:sfRenderWindow.cpp

示例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;
}
开发者ID:freemaul,项目名称:SFML,代码行数:9,代码来源:sfRenderWindow.cpp

示例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);
		}
	}
}
开发者ID:DrJonki,项目名称:SpaceDash,代码行数:10,代码来源:Player.cpp

示例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;
}
开发者ID:antony-krav,项目名称:sandbox,代码行数:11,代码来源:Hero.cpp

示例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;
}
开发者ID:kychka,项目名称:sfml-game-test.reborn,代码行数:10,代码来源:StartMenu.cpp

示例11: drawMeters

void OtherObjects::drawMeters(RenderWindow &window)
{
	if (!hardcore){
		window.draw(healthMeter);
		window.draw(healthIconSprite[0]);
	}
	
	window.draw(fuelMeter);
	window.draw(fuelIconSprite[0]);
}
开发者ID:DrJonki,项目名称:SpaceDash,代码行数:10,代码来源:OtherObjects.cpp

示例12: drawPlayer

void Player::drawPlayer(RenderWindow &window)
{
	window.draw(playerSprite);

	if (drawCollisionShapes){
		window.draw(collisionCircle[0]);
		window.draw(collisionCircle[1]);
		window.draw(collisionCircle[2]);
	}
}
开发者ID:DrJonki,项目名称:SpaceDash,代码行数:10,代码来源:Player.cpp

示例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;
}
开发者ID:freemaul,项目名称:SFML,代码行数:10,代码来源:sfRenderWindow.cpp

示例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();
}
开发者ID:erikkacsm,项目名称:encounters,代码行数:10,代码来源:game.cpp

示例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);
}
开发者ID:JokerSSmile,项目名称:Projects,代码行数:10,代码来源:Game_iteration1.cpp


注:本文中的RenderWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。