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


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

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


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

示例1: Run

void EngineGraphic::Run(sf::RenderWindow &App, config &configuration)
{
    //Créer la fenêtre
    MyImageManager.build(configuration);
    App.Create(VideoMode(LARGEUR_FENETRE+120,HAUTEUR_FENETRE,32),"SFML moteur 2D");
    App.SetFramerateLimit(60);
}
开发者ID:JyBP,项目名称:Shoot-Em-Up-cpp,代码行数:7,代码来源:EngineGraphic.cpp

示例2: init

void init(){
  _backgroundImage.LoadFromFile("assets/wood-puzzle-floor.png");
  _backgroundSprite.SetImage(_backgroundImage);
  
  _robotImage.LoadFromFile("assets/roomba.png");
  _robotSprite.SetImage(_robotImage);
  _robotSprite.SetCenter(_robotSprite.GetSize().x/2, _robotSprite.GetSize().y/2);
  _fakeRobotSprite.SetImage(_robotImage);
  _fakeRobotSprite.SetCenter(_fakeRobotSprite.GetSize().x/2, _fakeRobotSprite.GetSize().y/2);
  _fakeRobotSprite.SetColor(sf::Color(100,100,255));

  _landmarkImage.LoadFromFile("assets/landmark.png");
  _landmarkSprite.SetImage(_landmarkImage);
  _landmarkSprite.SetCenter(_landmarkSprite.GetSize().x/2, _landmarkSprite.GetSize().y/2);

  _rangeImage.LoadFromFile("assets/range.png");
  _rangeSprite.SetImage(_rangeImage);
  original_range_sprite_size_x = _rangeSprite.GetSize().x;
  original_range_sprite_size_y = _rangeSprite.GetSize().y;
  updateRangeSpriteScale();
  _rangeSprite.SetCenter((original_range_sprite_size_x/2), (original_range_sprite_size_y/2));

  _window.Create(sf::VideoMode(window_width,window_height,32), "Bearing simulator");

  move_amount = 0;
  rotation_amount = 0;
  time_to_capture = false;
  
  walk = 0;
  rotation = 0;
}
开发者ID:ieatmosquitos,项目名称:bearingsimulator,代码行数:31,代码来源:simulator.cpp

示例3: startNewGame

//function
bool AccessOptions::startNewGame(sf::RenderWindow &Menu, sf::RenderWindow &App)
{
    //needs world making to be made into a
    //function instead of something just found in the main.
     Menu.Close();

    App.Create(sf::VideoMode(800, 600, 32), "SectorTD");
    GameHandler::PlayGame(App);
    return true;

}
开发者ID:dustinslade,项目名称:Sector_TD,代码行数:12,代码来源:AccessOptions.cpp

示例4: main

int main()
{
    // Create the main rendering window
    App.Create(sf::VideoMode(640,480,32), "SFML Graphics");
	UIState uistate;
	uistate.renderer = &App;

	InitEntities();
	PhysicsSub physSub(&App, &entitysystem); 
	RenderingSystem renderSys(&App, &entitysystem);
	ControllerSystem controller(&App, &entitysystem);
	ProjectileSystem projSys(&App, &entitysystem);

	bool inventory = false;
	int invX; 
	int invY;

	std::vector<Entity*> players; 
	entitysystem.getEntities<CompPlayer>(players);
	Entity* player = players[0];

    // Start game loop
	while (App.IsOpen())
    {
        // Process events
        sf::Event Event;
		while (App.PollEvent(Event))
        {
			uistate.uiEvents(Event);
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
			if(Event.Type == sf::Event::MouseButtonPressed && Event.MouseButton.Button == sf::Mouse::Right)
			{
				inventory = !inventory;
				if(inventory)
					invX = sf::Mouse::GetPosition(App).x;
					invY = sf::Mouse::GetPosition(App).y; 
			}
			if(Event.Type == sf::Event::MouseButtonPressed && Event.MouseButton.Button == sf::Mouse::Left)
				makeProjectile();
		}

		controller.Tick(Clock.GetElapsedTime().AsSeconds());
		physSub.Tick(Clock.GetElapsedTime().AsSeconds());
		projSys.Tick(Clock.GetElapsedTime().AsSeconds());

        // Clear the screen with red color
		App.Clear(sf::Color::Black);

		uistate.imgui_prepare();
		if(widget::button(uistate, GEN_ID, sf::Vector2f(100, 30), sf::Vector2f(520, 10), "button", 24))
			entitysystem.deleteEntity(player);
		if(inventory)
			if(widget::button(uistate, GEN_ID, sf::Vector2f(100, 30), sf::Vector2f(invX, invY), "inventory", 20))
				player = makePlayer();

		uistate.imgui_finish();

		renderSys.Tick(Clock.GetElapsedTime().AsSeconds());

        // Display window contents on screen
        App.Display();

		Clock.Restart();
    }

    return EXIT_SUCCESS;
}
开发者ID:stephenap07,项目名称:Stargate,代码行数:69,代码来源:main.cpp


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