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


C++ SetSprite函数代码示例

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


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

示例1: SetSprite

void Drawable2D::SetSpriteAttr(ResourceRef value)
{
    // Delay applying material update
    materialUpdatePending_ = true;

    ResourceCache* cache = GetSubsystem<ResourceCache>();

    if (value.type_ == Sprite2D::GetTypeStatic())
    {
        SetSprite(cache->GetResource<Sprite2D>(value.name_));
        return;
    }

    if (value.type_ == SpriteSheet2D::GetTypeStatic())
    {
        // value.name_ include sprite speet name and sprite name.
        Vector<String> names = value.name_.Split('@');
        if (names.Size() != 2)
            return;

        const String& spriteSheetName = names[0];
        const String& spriteName = names[1];

        SpriteSheet2D* spriteSheet = cache->GetResource<SpriteSheet2D>(spriteSheetName);
        if (!spriteSheet)
            return;

        SetSprite(spriteSheet->GetSprite(spriteName));
    }
}
开发者ID:reattiva,项目名称:Urho3D,代码行数:30,代码来源:Drawable2D.cpp

示例2: SetSprite

void ContainerItemButton::setItem(Item* item)
{
	edit_item = item;
	if(edit_item)
		SetSprite(edit_item->getClientID());
	else
		SetSprite(0);
}
开发者ID:Arydia,项目名称:rme,代码行数:8,代码来源:container_properties_window.cpp

示例3: DrawMetaSprite

void DrawMetaSprite(int16_t x, int16_t y, uint8_t f){

	uint8_t foff = f*4;
	SetSprite(x+0,y+0,pgm_read_byte(&sprite_frame_table[foff]),pgm_read_byte(&sprite_mirror_table[foff++]));
	SetSprite(x+8,y+0,pgm_read_byte(&sprite_frame_table[foff]),pgm_read_byte(&sprite_mirror_table[foff++]));
	SetSprite(x+0,y+8,pgm_read_byte(&sprite_frame_table[foff]),pgm_read_byte(&sprite_mirror_table[foff++]));
	SetSprite(x+8,y+8,pgm_read_byte(&sprite_frame_table[foff]),pgm_read_byte(&sprite_mirror_table[foff]));
}
开发者ID:weber21w,项目名称:uzebox-weber,代码行数:8,代码来源:BlockBoy.c

示例4: SetSprite

// Animates movement //
void Player::Animate() 
{
	if(state == 3)
		SetSprite(shipMove[1]);
	else if(state == 4)
		SetSprite(shipMove[2]);
	else
		SetSprite(shipMove[0]);
}
开发者ID:gillstudio,项目名称:AIEProjects,代码行数:10,代码来源:Player.cpp

示例5: ClearSpriteInfo

void ButtonActor::setPressed(bool pressed){
	ClearSpriteInfo();
	if(pressed)
	{
		SetSprite(m_path +"on.png");
		m_countup=0;
	}
	else
		SetSprite(m_path +"off.png");
	m_pressed=pressed;
	
}
开发者ID:MaliusArth,项目名称:PixelArth,代码行数:12,代码来源:ButtonActor.cpp

示例6: SetSprite

void TextGameObject::PrepareSprite()
{
    if(textBlock->IsSpriteReady())
    {
        if(GetSprite() != textBlock->GetSprite()) 
        {
            SetSprite(textBlock->GetSprite());
        }
    }
    else 
    {
        SetSprite(NULL);
    }
}
开发者ID:dheerendra1,项目名称:dava.framework,代码行数:14,代码来源:TextGameObject.cpp

示例7: SetSprite

void DoorActor::setLocked(const bool locked)
{
    if((locked) && (m_collFlags.damage==0))
	{
		SetSprite(m_spritePath +"off.png");
        m_mask=m_closed;
	}
	if(!locked)
	{
		SetSprite(m_spritePath +"on.png");
        m_mask=m_open;
	}
	m_locked=locked;
}
开发者ID:MaliusArth,项目名称:PixelArth,代码行数:14,代码来源:DoorActor.cpp

示例8: m_grid

Snake::Snake(Grid* grid) :
    m_grid(grid),
    m_direction(DirectionUp),
    m_inputBufferMaxSize(3),
    m_movespeed(10.f),
    m_numConsumed(0),
    m_isStopped(false),
    m_pointMultiplicator(1),
    m_isInvulnerable(false)
{
    const float kVerticesPerPixelX = theCamera.GetWorldMaxVertex().X * 2 / theCamera.GetWindowWidth();
    const float kVerticesPerPixelY = theCamera.GetWorldMaxVertex().Y * 2 / theCamera.GetWindowHeight();
    
    SetSize(Vector2(32 * kVerticesPerPixelX, 32 * kVerticesPerPixelY));
    SetPosition(0, 0);
    SetSprite(getSnakeHeadPath(false));
    
    Vector2 offset(0, -m_grid->GetUnitSize().Y);
    Actor* t = addTailPiece(offset*3.f);
    t = addTailPiece(offset*2.f);
    t = addTailPiece(offset);
    
	theSwitchboard.SubscribeTo(this, "GridCollision");
    theSwitchboard.SubscribeTo(this, "FoodConsumed");
    theSwitchboard.SubscribeTo(this, "MoveUp");
    theSwitchboard.SubscribeTo(this, "MoveDown");
    theSwitchboard.SubscribeTo(this, "MoveLeft");
    theSwitchboard.SubscribeTo(this, "MoveRight");
}
开发者ID:d909b,项目名称:GADEL-Snake,代码行数:29,代码来源:Snake.cpp

示例9: SetSprite

void
Snake::Consume(Consumable* consumable)
{
    m_biteTimer = 0;
    SetSprite(getSnakeHeadPath(true));
    consumable->performConsumption(this);
}
开发者ID:d909b,项目名称:GADEL-Snake,代码行数:7,代码来源:Snake.cpp

示例10: GameObject

Asteroid::Asteroid(int x, int y, SDL_Surface *sprite, Player *p) {
	GameObject();

	m_posX = x;
	m_posY = y;

	m_velX = 1;
	m_velY = 0;

	m_dirX = -1;
	m_dirY = 0;

	m_boundX = 35;
	m_boundY = 35;

	m_curFrame = 0;
	m_frameWidth = 64;
	m_frameHeight = 64;

	m_frameCount = 0;
	m_frameDelay = 3;

	m_maxFrame = 64;
	m_animationColumns = 8;
	m_animationRow = 0;
	m_animationDirection = 1;

	SetSprite(sprite);
	SetID(ENEMY);
	Asteroid::p=p;
}
开发者ID:thomaseitler,项目名称:Spaceshooter,代码行数:31,代码来源:Asteroid.cpp

示例11: SetSprite

ProjectileNinjaStar::ProjectileNinjaStar(bool bDirection, int xPos, int yPos)
{
	/* Set Sprite Number */
	SetSprite(1, CR::AssetList::ninja_star);


	/* Set Sprite Direction */
	SetDirection(bDirection);

	/* Set Weapon Bounding Box */
	SetWeaponBounds(16,16);

	/* Set Activate & Delay Timer */
	SetActiveTime(4);
	SetDelayTime(.25);

	/* Set Velocity Direction */
	if(bDirection) SetVelocityVector(80, 0);
	else SetVelocityVector(-80, 0);

	/* Set Start Position */
	SetPosition(xPos, yPos);

	/* Set Damage Value */
	SetWeaponDamage(2);	
	
	/* Initialize Sprite */
	SetAnimation(0, 0, true, false, 30, true);
	projectile_spr->EnableFrameSkip(false);
}
开发者ID:duhone,项目名称:BladeofBetrayal2,代码行数:30,代码来源:ProjectileNinjaStar.cpp

示例12: SetSprite

ProjectilePrisonerRock::ProjectilePrisonerRock(bool bDirection, int xPos, int yPos)
{
	/* Set Sprite Number */
	SetSprite(1, CR::AssetList::prisoner_rock);

	/* Set Sprite Direction */
	SetDirection(bDirection);

	/* Set Weapon Bounding Box */
	SetWeaponBounds(12,12);

	/* Set Activate & Delay Timer */
	SetActiveTime(3);
	SetDelayTime(.25);

	/* Set Velocity Direction */	
	if(bDirection) SetVelocityVector((float)(rand()%50+75), 0);
	else SetVelocityVector((float)(-(rand()%50+75)), 0);

	/* Set Acceleration Vector */
	SetAccelerationVector(0, (float)(rand()%75 + 65));
	
	/* Set Start Position */
	SetPosition(xPos, yPos);

	/* Set Damage Value */
	SetWeaponDamage(5);

	proj_flags.S_NON_PROJECTILE = true;

	/* Initialize Sprite */
	SetAnimation(0, 0, true, false, 10, true);
}
开发者ID:duhone,项目名称:BladeofBetrayal2,代码行数:33,代码来源:ProjectilePrisonerRock.cpp

示例13: SpriteInit

static void SpriteInit(bool EnabledBlend,u16 alpha)
{
  if(EnabledBlend==false) alpha=15;
  
  initSprites();
  updateOAM(12);
  
  s32 spx[12],spy[12];
  
  spx[ 0]=0; spy[ 0]=0;
  spx[ 1]=1; spy[ 1]=0;
  spx[ 2]=2; spy[ 2]=0;
  spx[ 3]=3; spy[ 3]=0;
  spx[ 4]=0; spy[ 4]=1;
  spx[ 5]=1; spy[ 5]=1;
  spx[ 6]=2; spy[ 6]=1;
  spx[ 7]=3; spy[ 7]=1;
  spx[ 8]=0; spy[ 8]=2;
  spx[ 9]=1; spy[ 9]=2;
  spx[10]=2; spy[10]=2;
  spx[11]=3; spy[11]=2;
  
  for(u32 idx=0;idx<12;idx++){
    SetSprite(idx,1,(8*8)+(8*spx[idx])+((8*8*4)*spy[idx]),alpha);
    
    s32 px=spx[idx]*64;
    s32 py=spy[idx]*64;
    
    SetPosSprite(idx,(s32)px,(s32)py,EnabledBlend);
  }
  
  updateOAM(12);
}
开发者ID:Mbmax,项目名称:ismart-kernel,代码行数:33,代码来源:cglscreenoverlay.cpp

示例14: Item

AtmosTool::AtmosTool(size_t id) : Item(id)
{
    SetSprite("icons/device.dmi");
    SetState("atmos");
    //SetState("cutters");
    name = "Atmos tool";
}
开发者ID:hellaguy130,项目名称:karya-valya,代码行数:7,代码来源:ElectricTools.cpp

示例15: GameObject

EffectEnemyDead01::EffectEnemyDead01() : GameObject(TEXTURE_EFF_00)
{
	m_maxLifeTime   = 10;
	RECT srcRect;
	SetRect(&srcRect,0, 0, 32, 32);
	SetSprite(srcRect, 1,0, 32, 32, false);
}
开发者ID:frosttear,项目名称:Th06Imitation,代码行数:7,代码来源:Effect.cpp


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