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


C++ AnimatedSprite::SetSubRectOffset方法代码示例

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


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

示例1: InitializeAsClient

void Root::InitializeAsClient(const sf::VideoMode& video_mode, 
							  const std::string& window_title, 
							  const bool is_fullscreen,
							  const sf::IpAddress& server_ip, 
							  const sf::Uint16 server_port,
							  const std::string name,
							  bool is_verbose) {
    mIsServer = false;

	if(is_verbose)
		mLogger.SetShowLevels(0x00011111);
	else
		mLogger.SetShowLevels(0x00011100);

	Logger::Urgent(LogOrigin::ROOT, "Initializing Root as client.");

	// Request a 24 bits depth buffer
	// Request a 8 bits stencil buffer
	// Request 8 levels of antialiasing
	sf::ContextSettings Settings(24, 8, 8);
	
	mRenderWindow = boost::shared_ptr<sf::RenderWindow>(new sf::RenderWindow());

    // Create Render Window
    if(is_fullscreen)
        mRenderWindow->Create(video_mode, window_title, sf::Style::Fullscreen, Settings);
    else
		mRenderWindow->Create(video_mode, window_title, sf::Style::Close | sf::Style::Resize, Settings);

	// Create & initialize world view
	ResetView();

	// Load Engine Resources (Default GUI etc.)
	mResourceManager.AddImage(boost::filesystem::path("../engine/gui"),"default_gui.svg", 512.f/mWorldPixelsPerFloat, 512.f/mWorldPixelsPerFloat, "default_gui");
	GuiTexture default_gui_texture;
	default_gui_texture.LoadLayoutFile("../engine/gui/default_layout.info");
	mResourceManager.AddGuiTexture(default_gui_texture);

	int cursor_size = 24;
	mResourceManager.AddImage(boost::filesystem::path("../engine/gui"),"cursors.svg", cursor_size*16.f/mWorldPixelsPerFloat, cursor_size*16.f/mWorldPixelsPerFloat, "gui.default.cursors");

	AnimatedSprite arrow;
	arrow.SetImage(mResourceManager.GetImage("gui.default.cursors"));
	arrow.SetSubRectSize(sf::Vector2f(cursor_size,cursor_size));
	arrow.SetSubRectOffset(sf::Vector2f(0,0));
	arrow.SetFPS(0);
	arrow.SetNumFrames(1);
	mResourceManager.SetCursorSprite(arrow, MOUSECURSOR_ARROW);

	AnimatedSprite busy;
	busy.SetImage(mResourceManager.GetImage("gui.default.cursors"));
	busy.SetSubRectSize(sf::Vector2f(cursor_size,cursor_size));
	busy.SetSubRectOffset(sf::Vector2f(0,cursor_size));
	busy.SetFPS(8);
	busy.SetNumFrames(8);
	mResourceManager.SetCursorSprite(busy, MOUSECURSOR_BUSY);

	mResourceManager.SetCursor(MOUSECURSOR_ARROW);


    //mInputManager = InputManager();
    //mStateManager = StateManager();
    //mResourceManager = ResourceManager();

    // Create and Initialize Network Manager
    // mNetworkManager = NetworkManager();
    mClientName = name;
    mNetworkManager.InitializeAsClient(server_ip, server_port, name);

	mTakeScreenshot = false;
}
开发者ID:svenstaro,项目名称:NoisyHunter,代码行数:71,代码来源:Root.cpp


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