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


C++ RenderWindow::GetHeight方法代码示例

本文整理汇总了C++中sf::RenderWindow::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow::GetHeight方法的具体用法?C++ RenderWindow::GetHeight怎么用?C++ RenderWindow::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sf::RenderWindow的用法示例。


在下文中一共展示了RenderWindow::GetHeight方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: draw_circle

void draw_circle(sf::RenderWindow& app, Point pos, const sf::Color& col)
{
	sf::Shape h;
	h.AddPoint(pos.x/10*app.GetWidth()-4, pos.y/10*app.GetHeight(), col);
	h.AddPoint(pos.x/10*app.GetWidth(), pos.y/10*app.GetHeight()-4, col);
	h.AddPoint(pos.x/10*app.GetWidth()+4, pos.y/10*app.GetHeight(), col);
	h.AddPoint(pos.x/10*app.GetWidth(), pos.y/10*app.GetHeight()+4, col);
	app.Draw(h);
}
开发者ID:MakSim345,项目名称:cpp,代码行数:9,代码来源:main.cpp

示例2:

void df::Context::ExtractRenderWindowStatus(sf::RenderWindow const &renderWindow)
{
	_ellapsedTime = renderWindow.GetFrameTime();
	_frameRate = 1.f/_ellapsedTime;
	_windowSize.Width = renderWindow.GetWidth();
	_windowSize.Height = renderWindow.GetHeight();
}
开发者ID:DavidVondras,项目名称:charlydogfightgame,代码行数:7,代码来源:Context.cpp

示例3: DrawQuad

void DrawQuad(GLuint programID)
{		
	GL_CHECK(glMatrixMode(GL_PROJECTION));
	GL_CHECK(glLoadIdentity());
	GL_CHECK(gluOrtho2D(-1, 1, -1, 1));
	glViewport(0, 0, window.GetWidth(), window.GetHeight());
	
	GL_CHECK(glMatrixMode(GL_MODELVIEW));
	GL_CHECK(glLoadIdentity());
	GL_CHECK(glEnable(GL_TEXTURE_2D));
	
	loadShaderVariables(programID);
	
	frame->Bind();
	
	glBegin(GL_QUADS);
	glTexCoord2f(0, 1);
	glVertex2f(-1, -1);
	
	glTexCoord2f(1, 1);
	glVertex2f(1, -1);
	
	glTexCoord2f(1, 0);
	glVertex2f(1, 1);
	
	glTexCoord2f(0, 0);
	glVertex2f(-1, 1);
	glEnd();
}
开发者ID:mly,项目名称:BMW,代码行数:29,代码来源:Main.cpp

示例4: tan

FreeFlyCamera::FreeFlyCamera(const sf::Vector3f & position, const sf::Vector3f & target, sf::RenderWindow & win) {

	lastPosition = position;

	up = _UP_;

	fov = 80;
	_near = 0.1;
	_far = 10000;
	ratio = ((float)win.GetWidth() / (float)win.GetHeight());

	speed = 100.f;
	this->position = position;
	this->target = target;

	sensivity = 0.5f;

	theta 	= 45;//utils::VectorsAngle(sf::Vector2f(target.x, target.z), sf::Vector2f(position.x, position.z));
	phi		= -45;//utils::VectorsAngle(sf::Vector2f(target.z, target.y), sf::Vector2f(up.x, up.y));

	psi = 0;

	CompileVectors();

	float tang = (float) tan(fov * 0.5f * M_PI / 180.f);

	Hnear = tang * _near;
	Wnear = Hnear * ratio;


	Hfar = tang * _far;
	Wfar = Hfar * ratio;
}
开发者ID:zapo,项目名称:BomberSFML-3D,代码行数:33,代码来源:FreeFlyCamera.cpp

示例5: Display

void KeyboardMenu::Display(sf::RenderWindow& Window, VerticalPositions VPos, HorizontalPositions HPos)
{
	Window.SetActive(true);

	sf::String DisplayString;
	DisplayString.SetFont(font);
	DisplayString.SetSize(default_size);
	DisplayString.SetColor(sf::Color::Red);

	int startHeight;
	int Height;

	if(menu_options.size() > 10)
	{
		throw std::runtime_error("Not Implemented: Option List Larger than 10");
	}
	else
	{
		if(VPos == VerticalPositions::TOP)
		{
			startHeight = Height = 10;

			for(int i = 0; i < menu_options.size(); i++)
			{
				DisplayString.SetText(key_list[i].OutputString + " : " + menu_options[i]);

				set_string_position(DisplayString, Height, Window.GetWidth());
				Window.Draw(DisplayString);

				Height += default_size + 10;
			}
		}
		else
		{
			startHeight = Height = Window.GetHeight() - 10;

			for(int i = menu_options.size() - 1; i >= 0; i--)
			{
				DisplayString.SetText(key_list[i].OutputString + " : " + menu_options[i]);

				Height -= DisplayString.GetRect().GetHeight();

				set_string_position(DisplayString, Height, Window.GetWidth());
				Window.Draw(DisplayString);

				Height -= 10;
			}
		}
	}
}
开发者ID:JonBoyle87,项目名称:OpenJL,代码行数:50,代码来源:KeyboardMenu.cpp

示例6: Show

void SplashScreen::Show(sf::RenderWindow& renderWindow)
{
	sf::Image image;
	sf::Color bgColor = sf::Color(40,40,40);
	
	//Replace this?
	if (image.LoadFromFile("test.png") != true)
		return;
	
	sf::Sprite sprite(image);
	cerr<<renderWindow.GetWidth()/2<<" "<< renderWindow.GetHeight()/2<<endl;
	sprite.SetCenter(184/2,184/2);
	sprite.SetPosition(renderWindow.GetWidth()/2 , renderWindow.GetHeight()/2);
	
	renderWindow.Clear(bgColor);
	renderWindow.Draw(sprite);
	renderWindow.Display();
	
	sf::Event event;
	sf::Clock clock;
	
	while(clock.GetElapsedTime()<3)
	{
		while(renderWindow.GetEvent(event))
		{
			if (   event.Type == sf::Event::KeyPressed 
				|| event.Type == sf::Event::MouseButtonPressed
				|| event.Type == sf::Event::Closed) 
			{
				renderWindow.Clear(bgColor);
				return;
			}
		}
	}
	renderWindow.Clear(bgColor);
	return;
}
开发者ID:thgil,项目名称:LightGUIEngine,代码行数:37,代码来源:SplashScreen.cpp

示例7: display

void DisplayManager::display(AnimatedManager &AM, sf::RenderWindow &App){
    if(sprites.isEmpty())
        return;
    for(int j = 0 ;j < App.GetHeight()/TAILLE ; j++ ){
        spriteMap::iterator it = sprites.find(j);
        if(it == sprites.end())
            continue;
        QVector<sprite> tmp = it.value();
        for(int i = 0; i < tmp.size();i++){
          QPoint coord = tmp[i].first;
          //if(tmp[i].second!=1)
             //EM.value(tmp[i].second)->get_trigger().draw(App);
          //AM.get(EM.value(tmp[i].second)->get_nom()).setFrame(EM.value(tmp[i].second)->getFrame());

          //affichage de la trainee derriere la mouche
          if(tmp[i].second == 1){//!(((Fly*) EM.value(tmp[i].second))->getPos().isEmpty()) ){
              QPoint tmpPoint;
             // AM.get(EM.value(tmp[i].second)->get_nom()).setAngle(-EM.value(tmp[i].second)->getAngle());
              for(int k = 0; k < ((Fly*) EM.value(tmp[i].second))->getPos().size()-5; k++){
                  tmpPoint = ((Fly*) EM.value(tmp[i].second))->getPos()[k];
                  AM.get("Circle").getImage().Resize(k/2+TAILLE,k/2+TAILLE);
                  AM.get("Circle").setPosition(tmpPoint.x(),tmpPoint.y());
                  AM.get("Circle").affichage(App);

              }
          }

          //Displays of all entity
          if(EM.contains(tmp[i].second)){
            AM.get(EM.value(tmp[i].second)->get_nom()).setFrame(EM.value(tmp[i].second)->getFrame());
            AM.get(EM.value(tmp[i].second)->get_nom()).setPosition(coord.x(),coord.y());
            AM.get(EM.value(tmp[i].second)->get_nom()).affichage(App);
          }

        }
    }
}
开发者ID:AntipodGames,项目名称:Fly,代码行数:37,代码来源:displaymanager.cpp

示例8:

void WorldCamera2D::Reset (sf::RenderWindow& win) {
	sfView.SetFromRect(sf::FloatRect(0, 0, win.GetWidth(), win.GetHeight()));
	sfView.SetCenter(camCenterPos * fakeScale);
	sfView.Zoom(zoom);
}
开发者ID:matyicsapo,项目名称:Infiltrator,代码行数:5,代码来源:WorldCamera2D.cpp

示例9:

gra_screen::gra_screen(sf::RenderWindow &App,sf::Font & font)
{
	osttime=0;
	korektatime=0;
	zam=false;
	WspolTarciaGracz=0;
	WspolTarciaPilka=0;
	dan=0;
	pozres=false;
	lingran=0;
	pilka=0;
	slupek=0;
	gracz1_im=0;
	gracz2_im=0;
	gracz=0;
	boisko_im=0;
	wynl=0;
	wynp=0;
	bg=100;
	bd=500;
	bl=100;
	bp=700;
	bramka=100;
	gracze_ob=0;
	gracze_ev=0;
	obiekty=0;
	loaded=false;
	view=App.GetDefaultView();
	events=new EventComp;
	(*events).Set(sf::Event::KeyPressed,sf::Key::Escape);
	wynik_obl.SetFont(font);
	//wynik_obs.SetFont(font);
	wynik_obp.SetFont(font);
	Timer_ob1.SetFont(font);
	//Timer_ob2.SetFont(font);
	wynik_obl.SetSize(80);
	//wynik_obs.SetSize(80);
	wynik_obp.SetSize(80);
	wynik_obl.SetStyle(sf::String::Bold);
	//wynik_obs.SetStyle(sf::String::Bold);
	wynik_obp.SetStyle(sf::String::Bold);
	wynik_obl.SetText("0");
	//wynik_obs.SetText(":");
	wynik_obp.SetText("0");
	wynik_obl.SetPosition(App.GetWidth()/4,wynik_obl.GetRect().GetHeight()/2);
	//wynik_obs.SetPosition(App.GetWidth()/2-wynik_obs.GetRect().GetWidth()/2,0);
	wynik_obp.SetPosition(App.GetWidth()*3/4,wynik_obp.GetRect().GetHeight()/2);
	wynik_obl.SetColor(sf::Color(30,30,250));
	//wynik_obs.SetColor(sf::Color(250,30,30));
	wynik_obp.SetColor(sf::Color(30,250,30));
	wynik_obl.SetCenter(wynik_obl.GetRect().GetWidth()/2,wynik_obl.GetRect().GetHeight()/2);
	wynik_obp.SetCenter(wynik_obp.GetRect().GetWidth()/2,wynik_obp.GetRect().GetHeight()/2);
	Timer_ob1.SetSize(60);
	//Timer_ob2.SetSize(60);
	Timer_ob1.SetStyle(sf::String::Bold);
	//Timer_ob2.SetStyle(sf::String::Bold);
	Timer_ob1.SetText("00:00");
	//Timer_ob2.SetText("00:00");
	Timer_ob1.SetPosition(App.GetWidth()/2,wynik_obl.GetRect().GetHeight()/2);  // wynik_obl zastosowany umyslnie. aby byly wzglednie wysrodkowane.
	Timer_ob1.SetCenter(Timer_ob1.GetRect().GetWidth()/2,Timer_ob1.GetRect().GetHeight()/2);
	//Timer_ob2.SetPosition(App.GetWidth()-Timer_ob2.GetRect().GetWidth(),0);
	Techdata.SetPosition(10,App.GetHeight()-40);
}
开发者ID:cytadela8,项目名称:GameBall,代码行数:63,代码来源:gra_screen.cpp

示例10: init

void ScreenManager::init(sf::RenderWindow& app)  
{
	ScreenManager::_app = &app;
	ScreenManager::_screenLayout = Layout(sf::FloatRect(0,0,(float)app.GetWidth(),(float)app.GetHeight()));
}
开发者ID:marlowe-ml,项目名称:Puzzled,代码行数:5,代码来源:ScreenManager.cpp

示例11: DrawLevel

static void DrawLevel(const WadLevel_c &level, sf::RenderWindow& screen, uint32_t flags)
{
    float scaleX, scaleY;
    float offsetX, offsetY;

    const Vertex_s &mapMin = level.GetMin();
    const Vertex_s &mapMax = level.GetMax();

    scaleX = (float)screen.GetWidth() / ((float)(mapMax.iX - mapMin.iX) * 1.05f);
    scaleY = (float)screen.GetHeight() / ((float)(mapMax.iY - mapMin.iY) * -1.05f);

    offsetX = -mapMin.iX * scaleX;
    offsetY = (-mapMin.iY * scaleY) + screen.GetHeight();

    const uint32_t red = 0xFF0000FF;
    const uint32_t white = 0xFFFFFFFF;
    const uint32_t yellow = 0xFFFF00FF;

    const LineDef_s *lineDefs = level.GetLineDefs();
    const size_t numLineDefs = level.GetNumLineDefs();

    const Vertex_s *vertices = level.GetVertices();
    for(size_t i = 0; i < numLineDefs; ++i)
    {
        const Vertex_s &a = vertices[lineDefs[i].iStartVertex];
        const Vertex_s &b = vertices[lineDefs[i].iEndVertex];

        float x1 = (a.iX * scaleX) + offsetX;
        float y1 = (a.iY * scaleY) + offsetY;
        float x2 = (b.iX * scaleX) + offsetX;
        float y2 = (b.iY * scaleY) + offsetY;

        sf::Color color = (lineDefs[i].iLeftSideDef < 0) ? sf::Color::White : sf::Color::Red;

        if (lineDefs[i].iSpecialType > 0)
            color = sf::Color::Yellow;

        //uint32_t color = (lineDefs[i].iLeftSideDef < 0) ? white : red;
        //color = lineDefs[i].iSpecialType > 0 ? yellow : color;
        //lineColor(screen, (int16_t)x1, (int16_t)y1, (int16_t)x2, (int16_t)y2, color);

        DrawLine(screen, x1, y1, x2, y2, 1.f, color);

        float midX = (a.iX + b.iX) / 2.0f;
        float midY = (a.iY + b.iY) / 2.0f;

        if(flags & DF_SHOW_LINE_SIDES)
        {
            Vector2d_s v(Vector2d_s(b.iX, b.iY), Vector2d_s(a.iX, a.iY));
            v.Normalize();
            v.Rotate90();
            v.Scale(20.0f);
            v.Add(Vector2d_s(midX, midY));

            x1 = (midX * scaleX) + offsetX;
            y1 = (midY * scaleY) + offsetY;
            x2 = (v.fX * scaleX) + offsetX;
            y2 = (v.fY * scaleY) + offsetY;

            DrawLine(screen, x1, y1, x2, y2, 1.f, color);
        }

        if(flags & DF_SHOW_VERTICES)
        {
            //filledCircleColor(screen, (int16_t)x1, (int16_t)y1, 1, 0x0000FFFF);
            //filledCircleColor(screen, (int16_t)x2, (int16_t)y2, 1, 0x0000FFFF);

            DrawCircle(screen, x1, y1,1.f, sf::Color(0,0,255));
            DrawCircle(screen, x2, y2,1.f, sf::Color(0,0,255));
        }
    }
    if(flags & DF_SHOW_SEGMENTS)
    {
        const Segment_s *segments = level.GetSegments();
        const size_t numSegments = level.GetNumSegments();
        for(size_t i = 0; i < numSegments; ++i)
        {
            const Vertex_s &a = vertices[segments[i].iStartVertex];
            const Vertex_s &b = vertices[segments[i].iEndVertex];

            float x1 = (a.iX * scaleX) + offsetX;
            float y1 = (a.iY * scaleY) + offsetY;
            float x2 = (b.iX * scaleX) + offsetX;
            float y2 = (b.iY * scaleY) + offsetY;

            DrawCircle(screen, x1, y1, 1.f, sf::Color(255,0,255));
            DrawCircle(screen, x2, y2, 1.f, sf::Color(255,0,255));

            //filledCircleColor(screen, (int16_t)x1, (int16_t)y1, 1, 0x00FF00FF);
            //filledCircleColor(screen, (int16_t)x2, (int16_t)y2, 1, 0x00FF00FF);
        }
    }

    if(flags & DF_SHOW_PARTITION_LINES)
    {
        const Node_s *nodes = level.GetNodes();
        const size_t numNodes = level.GetNumNodes();
        for(size_t i = 0; i < numNodes; ++i)
        {
            Vector2d_s a(nodes[i].iX, nodes[i].iY);
//.........这里部分代码省略.........
开发者ID:bcsanches,项目名称:wadlib,代码行数:101,代码来源:main.cpp


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