• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TextureManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TextureManager的典型用法代码示例。如果您正苦于以下问题:C++ TextureManager类的具体用法?C++ TextureManager怎么用?C++ TextureManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: unloadPlayerStats

void RebelleUpgradeScreenGUI::unloadPlayerStats()
{
	Game* game = Game::getSingleton();
	GameGraphics *graphics = game->getGraphics();
	TextureManager *guiTextureManager = graphics->getGUITextureManager();

	unsigned int speedIconTID = guiTextureManager->loadTexture(SPEED_ICON_PATH);
	unsigned int attackIconTID = guiTextureManager->loadTexture(ATTACK_ICON_PATH);
	unsigned int defenseIconTID = guiTextureManager->loadTexture(DEFENSE_ICON_PATH);

	list<OverlayImage*>* overlayImageList = this->getOverlayImageList();

	list<OverlayImage*>::iterator it = overlayImageList->begin();
	while (it != overlayImageList->end())
	{
		OverlayImage* image = *it;
		it++;

		if (image->imageID == speedIconTID
			|| image->imageID == attackIconTID
			|| image->imageID == defenseIconTID)
		{
			overlayImageList->remove(image);
			delete image;
		}
	}
}
开发者ID:bsbae402,项目名称:Rebelle_repo,代码行数:27,代码来源:RebelleUpgradeScreenGUI.cpp


示例2: Draw

void Item::Draw(sf::RenderWindow& renderWindow, sf::Text &text)
{
	TextureManager *t = Resources::getTextureManager("tileMap");
		sf::Sprite s;
		sf::Vector2f item_pos = GetPosition();
		t->generateSprite(id, item_pos, s, sf::Vector2f(GetWidth(),GetHeight()));
		renderWindow.draw(s);



	sf::Vector2f test_pos = GetPosition();
	text.setPosition(test_pos.x, test_pos.y);
	text.setScale(sf::Vector2f(1.5,1.5));
	renderWindow.draw(text);
		//renderWindow.draw(_sprite);
		/*if(amount >0){
			char c[10];
			sprintf(c, "%i", amount);
			std::string string(c);
			sf::String str(string);
			text.setString(str);
			text.setPosition(GetPosition().x, GetPosition().y);
			renderWindow.draw(text);	
		}*/

}
开发者ID:Obscurs,项目名称:genland,代码行数:26,代码来源:Item.cpp


示例3: initMap

void MainMenu::initMap(sf::RenderWindow &window, TextureManager &textureManager)
{
	//hardcoded positions

	backgroundSprite.setTexture(*textureManager.getResource("Config/Content/Images/Menus/Backgrounds/MainMenuBackground.png"));

	sf::RectangleShape playButton;
	playButton.setSize(sf::Vector2f(143.0f, 72.0f));
	playButton.setTexture(textureManager.getResource("Config/Content/Images/Menus/Buttons/playButton.png"));
	playButton.setPosition(window.getSize().x / 2 - playButton.getSize().x / 2, 210);

	sf::RectangleShape creditsButton;
	creditsButton.setSize(sf::Vector2f(213.0f, 72.0f));
	creditsButton.setTexture(textureManager.getResource("Config/Content/Images/Menus/Buttons/creditsButton.png"));
	creditsButton.setPosition(window.getSize().x / 2 - creditsButton.getSize().x / 2, 295);

	sf::RectangleShape highScoresButton;
	highScoresButton.setSize(sf::Vector2f(338.0f,72.0f));
	highScoresButton.setTexture(textureManager.getResource("Config/Content/Images/Menus/Buttons/highScoreButton.png"));
	highScoresButton.setPosition(window.getSize().x / 2 - highScoresButton.getSize().x / 2, 380);

	sf::RectangleShape exitButton;
	exitButton.setSize(sf::Vector2f(134.0f,72.0f));
	exitButton.setTexture(textureManager.getResource("Config/Content/Images/Menus/Buttons/exitButton.png"));
	exitButton.setPosition(window.getSize().x / 2 - exitButton.getSize().x / 2, 465);

	menuItems[PLAY] = playButton;
	menuItems[CREDITS] = creditsButton;
	menuItems[HIGHSCORES] = highScoresButton;
	menuItems[EXIT] = exitButton;
}
开发者ID:Kerswill,项目名称:Bacterium,代码行数:31,代码来源:MainMenu.cpp


示例4: WPN_Init

	void WPN_Init(TextureManager& textureManager, Sound& sound, Console& console)
	{
		std::set<Int32> nearestFilterBoom = { 5, 6, 9, 13, 14, 15, 16 };

		console.printLine("\n===Weapon initialization===");
		for (Weapon& weap : d6WpnDef)
		{
			const std::string wpnPath = Format("{0}{1,3|0}") << D6_TEXTURE_WPN_PATH << weap.index;
			weap.textures.boom = textureManager.load(Format("{0}/boom/") << wpnPath, nearestFilterBoom.find(weap.index) != nearestFilterBoom.end() ? GL_NEAREST : GL_LINEAR, true);
			weap.textures.gun = textureManager.load(Format("{0}/gun/") << wpnPath, GL_NEAREST, true);
			weap.textures.shot = textureManager.load(Format("{0}/shot/") << wpnPath, GL_NEAREST, true);

			if (weap.shotSound)
			{
				weap.shotSample = sound.loadSample(std::string(D6_FILE_WEAPON_SOUNDS) + weap.shotSound);
			}
			if (weap.boomSound)
			{
				weap.boomSample = sound.loadSample(std::string(D6_FILE_WEAPON_SOUNDS) + weap.boomSound);
			}
		}

		Color brownColor(83, 44, 0);
		PlayerSkinColors skinColors(brownColor);
		brownSkin = std::make_unique<PlayerSkin>("textures/man/", skinColors, textureManager);
	}
开发者ID:marcellus-trixus,项目名称:duel6r,代码行数:26,代码来源:Weapon.cpp


示例5: switch

const sf::Texture* GuiHelper::getUnitTexture(UNITTYPES type, int playerId)
{
	std::string textureName = "p" + std::to_string(playerId);

	switch(type)
    {
    case EUT_SWORDMAN:
        textureName += "swordman";
        break;
    case EUT_ARCHER:
        textureName += "archer";
        break;
    case EUT_SPEARMAN:
        textureName += "spearman";
        break;
    case EUT_LADDERCARRIER:
        textureName += "laddercarrier";
        break;
    default:
        textureName = "";
        break;
    }

    TextureManager* textureManager = TextureManager::getInstance();
    const sf::Texture* texture = textureName != "" ? textureManager->getTexture(textureName) : textureManager->getFallbackTexture();
    return texture;
}
开发者ID:namelessvoid,项目名称:qrwar,代码行数:27,代码来源:guihelper.cpp


示例6: InitApp

void InitApp(float width, float height)
{
	vec2 min, max;
	//fill in the blank
	min.x = -width/2;
	min.y = -height/2;
	max.x = width/2;
	max.y = height/2;

	pApp = new App();
	Screen* pScreen = new Screen(min.x, min.y, max.x, max.y); // create the screen so you can start using gl functions!
	//programs
	ProgramManager* pProgramManager = ProgramManager::GetProgramManager();
	int programID = pProgramManager->CreateProgram("vertex2.vert", "fragment2.frag");
	pProgramManager->AddProgram("program1", programID);
	//now add textures and programs to the App
	TextureManager* pTextureManager = TextureManager::GetTextureManager();
	pTextureManager->AddTexture("images/picture.png");
	
	//add objects
	vec2 quadDimensions = {512.0f, 512.0f};
	GLuint indices[6] = {0, 1, 3, 3, 1, 2};
	pScreen->SetMatrixUniform(); // set the projection matrix
	Quad* pQuad = new Quad(&quadDimensions, indices, 6, "images/picture.png", "program1");
	pScreen->AddObject(pQuad);
	pApp->AddObject(pScreen);
}
开发者ID:m4rk70ne5,项目名称:ImageFilters,代码行数:27,代码来源:Main.cpp


示例7: getBoundingSphere

	void ObjectClue::draw() {

		if (!_caught) {

			if (isDebug()) {

				float* color = getBoundingSphere(0)->getColor();
				glPushMatrix();

					glDisable(GL_LIGHTING);

					glColor3f(color[0], color[1], color[2]);
					glTranslated(getBoundingSphere(0)->getPosition()[0], getBoundingSphere(0)->getPosition()[1], getBoundingSphere(0)->getPosition()[2]);
					glutWireSphere(getBoundingSphere(0)->getRadius(), 20, 20);

					glEnable(GL_LIGHTING);

				glPopMatrix();
			}

			TextureManager* tm = dynamic_cast<TextureManager*>( cg::Registry::instance()->get("TextureManager"));
			MaterialManager* mm = dynamic_cast<MaterialManager*>( cg::Registry::instance()->get("MaterialManager"));
			GLuint txClue = tm->get("clue")->getTextureDL();
			
			glPushMatrix();
				
				glEnable(GL_TEXTURE_2D);
				//mm->get("emerald")->apply();
				glTranslated(_position[0], _position[1], _position[2] + CLUE_SIZE / 2);
				glScalef(CLUE_SIZE, CLUE_SIZE, CLUE_SIZE);
				unitCube(txClue);
				glDisable(GL_TEXTURE_2D);
			glPopMatrix();
		}
	}
开发者ID:Meldow,项目名称:HarudoboirudoNinja,代码行数:35,代码来源:ObjectClue.cpp


示例8: PurgeMesh

void LODManager::PurgeMesh(ID3DXBaseMesh *mesh, int MeshNum) {
  if (!EnabledLOD.Get())
    return;

  MeshManager *mm = MeshManager::GetSingleton();
  TextureManager *tm = TextureManager::GetSingleton();

  for (int l = 0; l < GRID_LODS; l++)
  for (int x = 0; x < GRID_SIZE; x++)
  for (int y = 0; y < GRID_SIZE; y++) {
    if ((MeshIDs[l][y][x] == MeshNum)) {
      int mid = MeshIDs[l][y][x]; MeshIDs[l][y][x] = 0xFEFEFEFE;
      int cid = ColrIDs[l][y][x]; ColrIDs[l][y][x] = 0xFEFEFEFE;
      int nid = NormIDs[l][y][x]; NormIDs[l][y][x] = 0xFEFEFEFE;

      if (mid != MeshNum) mm->ReleaseMesh   (MeshIDs[l][y][x]);
      if (cid >=       0) tm->ReleaseTexture(ColrIDs[l][y][x]);
      if (nid >=       0) tm->ReleaseTexture(NormIDs[l][y][x]);

      Meshes [l][y][x] = NULL;
      Colors [l][y][x] = NULL;
      Normals[l][y][x] = NULL;
    }
  }
}
开发者ID:shadeMe,项目名称:Oblivion-Graphics-Extender-v3,代码行数:25,代码来源:LODManager.cpp


示例9: SDL_GetError

void Game::init() {
    if (SDL_Init(SDL_INIT_EVERYTHING) != 0){
        std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
    }

    systemList = SystemFactory().createSystems();


    graphics = Graphics();
    graphics.clearRenderer();
    isRunning = true;

    TextureManager *manager = new TextureManager(graphics);
    manager->loadTextureWithName("guy.png");
    world.manager.setTextureManager(manager);

    EntityFactory factory;
    Entity guy = factory.createGuy(world);
    Position p;
    p.x = 600;
    p.y = 20;
    ColorMod c;
    c.r = 10;
    c.g = 170;
    c.b = 40;
    
    Entity *z = factory.createZombie(world, p, c);

}
开发者ID:recursivefaults,项目名称:mustached-wight,代码行数:29,代码来源:game.cpp


示例10: if

void CarReflection::Create()
{
	//bFirstFrame = true;
	if (pSet->refl_mode == 1)  cubetexName = "ReflectionCube"; // single: use 1st cubemap
	else if (pSet->refl_mode == 2)
	{
		cubetexName = "ReflectionCube" + toStr(iIndex);
		// first cubemap: no index
		if (cubetexName == "ReflectionCube0")
			cubetexName = "ReflectionCube";
	}
	else /* static */
		cubetexName = "ReflectionCube";
	
	TextureManager* tm = TextureManager::getSingletonPtr();
	int size = ciShadowSizesA[pSet->refl_size];  // /2 ?

	//  create cube render texture
	if ( !(pSet->refl_mode == 1 && iIndex != 0) )
	{
		cubetex = tm->createManual(cubetexName, 
			ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_CUBE_MAP, 
			size,size, 0/*mips*/, PF_R8G8B8, TU_RENDERTARGET);
			//LogO("created rt cube");

		for (int face = 0; face < 6; face++)
		{
			Camera* mCam = pSceneMgr->createCamera("Reflect_" + toStr(iIndex) + "_" + toStr(face));
			mCam->setAspectRatio(1.0f);  mCam->setFOVy(Degree(90));
			mCam->setNearClipDistance(0.1);
			mCam->setFarClipDistance(pSet->refl_dist * 1.1f);

			RenderTarget* mRT = cubetex->getBuffer(face)->getRenderTarget();
			//LogO( "rt face Name: " + mRT->getName() );
			mRT->removeAllViewports();
			Viewport* vp = mRT->addViewport(mCam);
			vp->setOverlaysEnabled(false);
			vp->setVisibilityMask(RV_MaskReflect);
			vp->setShadowsEnabled(false);
			vp->setMaterialScheme ("reflection");
			mRT->setAutoUpdated(false);
			//mRT->addListener(this);  //-
			mCam->setPosition(Vector3::ZERO);

			Vector3 lookAt(0,0,0), up(0,0,0), right(0,0,0);  switch(face)
			{
				case 0:  lookAt.x =-1;  up.y = 1;  right.z = 1;  break;  // +X
				case 1:  lookAt.x = 1;  up.y = 1;  right.z =-1;  break;	 // -X
				case 2:  lookAt.y =-1;  up.z = 1;  right.x = 1;  break;	 // +Y
				case 3:  lookAt.y = 1;  up.z =-1;  right.x = 1;  break;	 // -Y
				case 4:  lookAt.z = 1;  up.y = 1;  right.x =-1;  break;	 // +Z
				case 5:  lookAt.z =-1;  up.y = 1;  right.x =-1;  break;	 // -Z
			}
			Quaternion orient( right, up, lookAt );  mCam->setOrientation( orient );
			pCams[face] = mCam;
			pRTs[face] = mRT;
		}
	}
}
开发者ID:jacobgogogo,项目名称:stuntrally,代码行数:59,代码来源:CarReflection.cpp


示例11: ApplyGlyphStyle

void GUI_Element::ApplyGlyphStyle(){
	const GUI_Style& CurrentStyle = m_style[m_state];
	TextureManager* textures = m_owner->GetManager()->GetContext()->m_textureManager;
	if (CurrentStyle.m_glyph != ""){
		m_visual.m_glyph.setTexture(*textures->GetResource(CurrentStyle.m_glyph));
	}
	m_visual.m_glyph.setPosition(m_position + CurrentStyle.m_glyphPadding);
}
开发者ID:RyanSwann1,项目名称:SFML-Project---Example-from-book,代码行数:8,代码来源:GUI_Element.cpp


示例12: _loadTextures

void _loadTextures(void* arg)
{
	TextureManager* that = (TextureManager*) arg;

	that->loadTextures();

	threadMainLoop = false;
}
开发者ID:Wheth,项目名称:PHBank,代码行数:8,代码来源:texture_manager.cpp


示例13: string

/*
	This method loads all the sprite types found in the provided sprite type list file
	into the game state manager, including their images.
*/
bool PoseurSpriteTypesImporter::loadSpriteTypes(Game *game, wstring spriteTypesListFileName)
{
	int slashIndex = spriteTypesListFileName.rfind('/');
	dir = string(spriteTypesListFileName.begin(), spriteTypesListFileName.end()).substr(0, slashIndex+1);
	const char *spriteTypesListFile = newCharArrayFromWstring(spriteTypesListFileName);
	bool success = loadSpriteTypesListInfo(spriteTypesListFile);
	if (!success) return false;
	for (unsigned int i = 0; i < spriteTypes.size(); i++)
	{
		success = loadSpriteTypeInfo(spriteTypes[i]);
		if (!success) return false;
	}

	TextureManager *tm = game->getGraphics()->getWorldTextureManager();
	WStringTable *wStringTable = tm->getWStringTable();

	// NOW LET'S USE ALL THE INFO WE'VE LOADED 
	// LET'S START BY LOADING THE TEXTURES INTO THE WORLD TEXTURE MANAGER
	for (unsigned int i = 0; i < spriteTypes.size(); i++)
	{
		string spriteType = spriteTypes[i];
		unsigned int offset = wStringTable->getNumWStringsInTable();
		map<int, string> images = spriteTypesImages[spriteType];
		for (int j = 0; j < images.size(); j++)
		{
			string imageToLoad = images[j];
			wstring wImageToLoad(imageToLoad.begin(), imageToLoad.end());
			tm->loadTexture(wImageToLoad);
		}

		AnimatedSpriteType *ast = new AnimatedSpriteType();
		unsigned int spriteTypeId = game->getGSM()->getSpriteManager()->addSpriteType(ast);
		ast->setSpriteTypeID(spriteTypeId);
		Dimensions dim = spriteTypesDimensions[spriteType];
		ast->setTextureSize(dim.width, dim.height);
		
		map<string, vector<Pose>> animations = spriteTypesAnimationsLists[spriteType];
		map<string, vector<Pose>>::iterator it = animations.begin();
		while (it != animations.end())
		{
			string key = it->first;
			wstring wKey(key.begin(), key.end());
			ast->addAnimationSequence(wKey);
			vector<Pose> poseList = it->second;
			vector<Pose>::iterator poseIt = poseList.begin();
			while (poseIt != poseList.end())
			{
				Pose pose = *poseIt;
				ast->addAnimationFrame(wKey, pose.imageId + offset - 1, pose.duration);
				poseIt++;
			}				
			it++;
		}
	}


	return true;
}
开发者ID:CSE380Skulls,项目名称:ForceOfReaction,代码行数:62,代码来源:PoseurSpriteTypesImporter.cpp


示例14: Menu

CharacterSelectionMenu::CharacterSelectionMenu() : Menu()
{
    this->listAvatars = new vector<sf::Sprite*>();
    this->listValidation = new vector<bool>(NUMBER_FIGHTERS, false);

    Button * button;
    int indexLine = 0, indexColumn = 0;
    vector<bool> * active = new vector<bool>(NUMBER_FIGHTERS, true);
    sf::Sprite * sprite;
    TextureManager * textureManager = GameManager::getInstance()->getTextureManager();
    CharacterManager * characterManager = GameManager::getInstance()->getCharacterManager();
    Position * position;
	for (int i = 0; i < NUMBER_CHARACTERDATA; ++i)
    {
        indexColumn = i % NUMBER_CHARACTER_BY_LINE;
        indexLine = (int)(i / NUMBER_CHARACTER_BY_LINE);
        for (unsigned int j = 0; j < NUMBER_FIGHTERS; ++j)
        {
            position = new Position(POSITION_FIRST_CHARACTER_X + indexColumn * OFFSET_CHARACTER_X, POSITION_FIRST_CHARACTER_Y + indexLine * OFFSET_CHARACTER_Y);
            if (characterManager->getCharactersDataIndex()->size() > j)
            {
                if (characterManager->getCharactersDataIndex()->at(j) == i)
                    this->listButtons->push_back(new Button("", position, true, true, false, j));
                else
                    this->listButtons->push_back(new Button("", position, true, false, false, j));
                active->at(j) = false;
            }
            else
            {
                this->listButtons->push_back(new Button("", position, true, active->at(j), false, j));
                active->at(j) = false;
            }
            button = this->listButtons->at(this->listButtons->size() - 1);
            button->setAction(&Menu::actionValidateCharacter);
            button->setActionMove(&Menu::listMove);
        }

        this->listAvatars->push_back(new sf::Sprite());
        sprite = this->listAvatars->at(this->listAvatars->size() - 1);
        sprite->setTexture(*textureManager->getTexture(characterDataArray[i].getPathAvatar()));
        sprite->setPosition((float)(position->getX() - sprite->getTextureRect().width / 2), (float)(position->getY() - sprite->getTextureRect().height / 2));
    }
    characterManager->getCharactersDataIndex()->clear();

    // Button back
	this->listButtons->push_back(new Button("Back", new Position(POSITION_BACK_X, POSITION_BACK_Y), true, false, true, 0));
	button = this->listButtons->at(this->listButtons->size() - 1);
	button->setAction(&Menu::actionBack);
	button->setActionMove(&Menu::classicMove);

	this->title->setString("SELECT YOUR FIGHTER");
	this->title->setFont(*(GameManager::getInstance()->getFontManager()->getFont(TITLE_PLAYER_FONT)));
	this->title->setScale((float)TITLE_PLAYER_SCALE_X, (float)TITLE_PLAYER_SCALE_Y);
	this->title->setPosition((float)(POSITION_TITLE_PLAYER_X), (float)(POSITION_TITLE_PLAYER_Y));
    this->title->setColor(sf::Color(TITLE_PLAYER_COLOR_RED, TITLE_PLAYER_COLOR_GREEN, TITLE_PLAYER_COLOR_BLUE));

	this->spriteMenu->setTexture(*GameManager::getInstance()->getTextureManager()->getTexture(FILE_MENU_SELECTION));
}
开发者ID:bibiGN,项目名称:kick-time,代码行数:58,代码来源:CharacterSelectionMenu.cpp


示例15: LoadTexture

	void TextureUnit::LoadTexture(void)
        {   
                TextureManager* texMgr = TextureManager::getSingleton();
                if(texMgr)
                {
                        texMgr->LoadTexture(this->mPicName);
                }

        } 
开发者ID:Neilfy,项目名称:OgreSimple,代码行数:9,代码来源:TextureUnit.cpp


示例16: GetManager

void CheckBox::AlignSizeToContent()
{
	TextureManager *dc = GetManager()->GetTextureManager();
	float th = dc->GetFrameHeight(_fontTexture, 0);
	float tw = dc->GetFrameWidth(_fontTexture, 0);
	float bh = dc->GetFrameHeight(_boxTexture, GetFrame());
	float bw = dc->GetFrameWidth(_boxTexture, GetFrame());
	Resize(bw + (tw - 1) * (float) GetText().length(), std::max(th + 1, bh));
}
开发者ID:Asqwel,项目名称:TZOD-Modified,代码行数:9,代码来源:Button.cpp


示例17:

    DepthRenderer::~DepthRenderer()
    {
        TextureManager* texMgr = TextureManager::getSingletonPtr();

        // Destroy render texture.
        if (!mDepthRenderTexture.isNull ()) {
            texMgr->remove (mDepthRenderTexture->getHandle ());
            mDepthRenderTexture.setNull ();
        }
    }
开发者ID:Chimangoo,项目名称:ember,代码行数:10,代码来源:DepthComposer.cpp


示例18: Entity

Aircraft::Aircraft(Type type, const TextureManager& textures, const FontManager& fonts)
: Entity(Table[type].hitpoints)
, mType(type)
, mSprite(textures.getResource(Table[type].texture), Table[type].textureRect)
, mExplosion(textures.getResource(Textures::Id::Explosion))
, mFireCommand()
, mMissileCommand()
, mFireCountdown(sf::Time::Zero)
, bFiring(false)
, bLaunchingMissile(false)
, bShowExplosion(true)
, bSpawnedPickup(false)
, bPlayedExplosionSound(false)
// , bMarkedForRemoval(false)
, mFireRateLevel(1)
, mSpreadLevel(1)
, mMissileAmmo(24)
, mDropPickupCommand()
, mTravelledDistance(0.f)
, mDirectionIndex(0)
// , mHealthDisplay(nullptr)
, mMissileDisplay(nullptr)
{
  // sf::FloatRect bounds = mSprite.getLocalBounds();

  mExplosion.setFrameSize(sf::Vector2i(256, 256));
  mExplosion.setFrameCount(16);
  mExplosion.setDuration(sf::seconds(1));

  mSprite.setOrigin(mSprite.getLocalBounds().width / 2.f, mSprite.getLocalBounds().height / 2.f);
  mExplosion.setOrigin(mExplosion.getLocalBounds().width / 2.f, mExplosion.getLocalBounds().height / 2.f);

  mFireCommand.category = Category::SceneAirLayer;
  mFireCommand.action = [this, &textures] (SceneNode& node, sf::Time) { createBullets(node, textures); };

  mMissileCommand.category = Category::SceneAirLayer;
  mMissileCommand.action = [this, &textures] (SceneNode& node, sf::Time) // FIX
    { createProjectile(node, Projectile::Missile, 0.f, 0.5f, textures); };

  mDropPickupCommand.category = Category::SceneAirLayer;
  mDropPickupCommand.action = [this, &textures] (SceneNode& node, sf::Time) { createPickup(node, textures); };

  std::unique_ptr<TextNode> healthDisplay(new TextNode("", fonts));
  mHealthDisplay = healthDisplay.get();
  attachChild(std::move(healthDisplay));

  if (getCategory() == Category::PlayerAircraft) {
    std::unique_ptr<TextNode> missileDisplay(new TextNode("", fonts));
    missileDisplay->setPosition(0, 70);
    mMissileDisplay = missileDisplay.get();
    attachChild(std::move(missileDisplay));
  }

  updateTexts();
}
开发者ID:shan-wyse,项目名称:SFML-Game-Dev,代码行数:55,代码来源:Aircraft.cpp


示例19: W_CheckNumForName

//
// TextureManager::readAnimatedLump
//
// Reads animation definitions from the ANIMATED lump.
//
// Load the table of animation definitions, checking for existence of
// the start and end of each frame. If the start doesn't exist the sequence
// is skipped, if the last doesn't exist, BOOM exits.
//
// Wall/Flat animation sequences, defined by name of first and last frame,
// The full animation sequence is given using all lumps between the start
// and end entry, in the order found in the WAD file.
//
// This routine modified to read its data from a predefined lump or
// PWAD lump called ANIMATED rather than a static table in this module to
// allow wad designers to insert or modify animation sequences.
//
// Lump format is an array of byte packed animdef_t structures, terminated
// by a structure with istexture == -1. The lump can be generated from a
// text source file using SWANTBLS.EXE, distributed with the BOOM utils.
// The standard list of switches and animations is contained in the example
// source text file DEFSWANI.DAT also in the BOOM util distribution.
//
// [RH] Rewritten to support BOOM ANIMATED lump but also make absolutely
// no assumptions about how the compiler packs the animdefs array.
//
void TextureManager::readAnimatedLump()
{
	int lumpnum = W_CheckNumForName("ANIMATED");
	if (lumpnum == -1)
		return;

	size_t lumplen = W_LumpLength(lumpnum);
	if (lumplen == 0)
		return;

	byte* lumpdata = new byte[lumplen];
	W_ReadLump(lumpnum, lumpdata);

	for (byte* ptr = lumpdata; *ptr != 255; ptr += 23)
	{
		anim_t anim;

		Texture::TextureSourceType texture_type = *(ptr + 0) == 1 ?
					Texture::TEX_WALLTEXTURE : Texture::TEX_FLAT;

		const char* startname = (const char*)(ptr + 10);
		const char* endname = (const char*)(ptr + 1);

		texhandle_t start_texhandle =
				texturemanager.getHandle(startname, texture_type);
		texhandle_t end_texhandle =
				texturemanager.getHandle(endname, texture_type);

		if (start_texhandle == TextureManager::NOT_FOUND_TEXTURE_HANDLE ||
			start_texhandle == TextureManager::NO_TEXTURE_HANDLE ||
			end_texhandle == TextureManager::NOT_FOUND_TEXTURE_HANDLE ||
			end_texhandle == TextureManager::NO_TEXTURE_HANDLE)
			continue;

		anim.basepic = start_texhandle;
		anim.numframes = end_texhandle - start_texhandle + 1;

		if (anim.numframes <= 0)
			continue;
		anim.curframe = 0;
			
		int speed = LELONG(*(int*)(ptr + 19));
		anim.countdown = speed - 1;

		for (int i = 0; i < anim.numframes; i++)
		{
			anim.framepic[i] = anim.basepic + i;
			anim.speedmin[i] = anim.speedmax[i] = speed;
		}

		mAnimDefs.push_back(anim);
	}

	delete [] lumpdata;
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:81,代码来源:r_texture.cpp


示例20: ApplyBgStyle

void GUI_Element::ApplyBgStyle(){
	TextureManager* textures = m_owner->GetManager()->GetContext()->m_textureManager;
	const GUI_Style& CurrentStyle = m_style[m_state];
	if (CurrentStyle.m_backgroundImage != ""){
		m_visual.m_backgroundImage.setTexture(*textures->GetResource(CurrentStyle.m_backgroundImage));
		m_visual.m_backgroundImage.setColor(CurrentStyle.m_backgroundImageColor);
	}
	m_visual.m_backgroundImage.setPosition(m_position);
	m_visual.m_backgroundSolid.setSize(sf::Vector2f(CurrentStyle.m_size));
	m_visual.m_backgroundSolid.setFillColor(CurrentStyle.m_backgroundColor);
	m_visual.m_backgroundSolid.setPosition(m_position);
}
开发者ID:RyanSwann1,项目名称:SFML-Project---Example-from-book,代码行数:12,代码来源:GUI_Element.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TextureMapperLayer类代码示例发布时间:2022-05-31
下一篇:
C++ TextureLoader类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap