本文整理汇总了C++中setSprite函数的典型用法代码示例。如果您正苦于以下问题:C++ setSprite函数的具体用法?C++ setSprite怎么用?C++ setSprite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setSprite函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setSprite
void GameStart::showInstructions(bool show) {
LogManager &log_manager = LogManager::getInstance();
ResourceManager &resource_manager = ResourceManager::getInstance();
showInstruct = show;
if(!showInstruct) { // Hiding instructions
//Setup GameStart sprite
Sprite *p_temp_sprite = resource_manager.getSprite("gamestart");
if (!p_temp_sprite) {
log_manager.writeLog("GameStart::showInstructions(): Warning! Sprite 'gamestart' not found", "gamestart");
}
else {
log_manager.writeLog("GameStart::showInstructions(): Switching to start screen\n");
setSprite(p_temp_sprite);
setSpriteSlowdown(15);
}
} else { // Showing instructions
//Setup GameStart sprite
Sprite *p_temp_sprite = resource_manager.getSprite("instructions");
if (!p_temp_sprite) {
log_manager.writeLog("GameStart::showInstructions(): Warning! Sprite 'gamestart' not found", "instructions");
}
else {
log_manager.writeLog("GameStart::showInstructions(): Switching to instructions screen\n");
log_manager.writeLog("Frame: %s\n", p_temp_sprite->getFrame(0).getString().c_str());
setSprite(p_temp_sprite);
setSpriteSlowdown(0);
}
}
}
开发者ID:jbmorse,项目名称:Dragonfly,代码行数:34,代码来源:GameStart.cpp
示例2: playSound
void SsScene3010DeadBoltButton::update() {
if (_countdown1 != 0 && (--_countdown1 == 0)) {
playSound(0);
setVisible(false);
setSprite(kScene3010DeadBoltButtonFileHashes1[_buttonIndex]);
}
if (_countdown2 != 0 && (--_countdown2 == 0)) {
setVisible(true);
setSprite(kScene3010DeadBoltButtonFileHashes2[_buttonIndex]);
}
}
开发者ID:SinSiXX,项目名称:scummvm,代码行数:14,代码来源:module3000_sprites.cpp
示例3: setSprite
NixonPowerCell::NixonPowerCell(df::Position p) {
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
df::LogManager &log_manager = df::LogManager::getInstance();
// Link to "largerock" sprite
df::Sprite *p_temp_sprite;
p_temp_sprite = resource_manager.getSprite("nixonpowercell");
if (!p_temp_sprite) {
log_manager.writeLog("NixonPowerCell::NixonPowerCell(): Warning! Sprite '%s' not found", "nixonpowercell");
}
else {
setSprite(p_temp_sprite);
setSpriteSlowdown(0);
}
setType("NixonPowerCell");
setSolidness(df::Solidness::HARD);
//Set starting position
setPosition(p);
health = 10;
hit_slowdown = 5;
hit_countdown = hit_slowdown;
was_hit = false;
has_flashed = false;
}
开发者ID:johnn134,项目名称:TheTankHeardAroundTheWorld,代码行数:28,代码来源:NixonPowerCell.cpp
示例4: FixedObject
FixedSprite::FixedSprite(const sf::Vector2f& pos, const std::string& imagePath, bool addToFixedObjectList) : FixedObject(addToFixedObjectList)
{
//ctor
if (imagePath != "")
setSprite(imagePath);
setPosition(pos);
}
开发者ID:Bobombe,项目名称:LudumDare30,代码行数:7,代码来源:fixedsprite.cpp
示例5: setSprite
Saucer::Saucer() {
df::LogManager &log_manager = df::LogManager::getInstance();
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
df::WorldManager &world_manager = df::WorldManager::getInstance();
// Setup "saucer" sprite.
df::Sprite *p_temp_sprite = resource_manager.getSprite("saucer");
if (!p_temp_sprite) {
log_manager.writeLog("Saucer::Saucer(): Warning! Sprite '%s' not found",
"saucer");
} else {
setSprite(p_temp_sprite);
setSpriteSlowdown(4);
}
// Set object type.
setType("Saucer");
// Set speed in horizontal direction.
setXVelocity(-0.25); // 1 space left every 4 frames
// Move Saucer to start location.
moveToStart();
// Register interest in "nuke" event.
registerInterest(NUKE_EVENT);
Role &role = Role::getInstance();
if(role.isHost()) {
Role &role = Role::getInstance();
role.registerSyncObj(this);
}
}
开发者ID:Rdbaker,项目名称:wings,代码行数:31,代码来源:Saucer.cpp
示例6: getBlock
Entity Block::getBlock()
{
// set position
auto pos = new CPosition;
pos->setX(32);
pos->setY(32);
E.addComponent(std::type_index(typeid(CPosition)), pos);
// set sprite from a spritesheet
auto spr = new CSprite;
spr->setSize(32);
spr->setSprite(this->getSprite(0, 0)); // coordinates in spritesheet
E.addComponent(std::type_index(typeid(CSprite)), spr);
// set state (0 = moveable)
auto sta = new CState;
sta->setS(0);
E.addComponent(std::type_index(typeid(CState)), sta);
// set velocity
auto vel = new CVelocity;
vel->setVelX(32);
vel->setVelY(32);
E.addComponent(std::type_index(typeid(CVelocity)), vel);
return E;
}
开发者ID:akrokan,项目名称:Core,代码行数:27,代码来源:block.cpp
示例7: setName
void Being::setSubtype(Uint16 subtype)
{
if (subtype == mSubType)
return;
mSubType = subtype;
if (getType() == MONSTER)
{
mInfo = MonsterDB::get(mSubType);
setName(mInfo->getName());
setupSpriteDisplay(mInfo->getDisplay());
}
else if (getType() == NPC)
{
mInfo = NPCDB::get(mSubType);
setupSpriteDisplay(mInfo->getDisplay(), false);
}
else if (getType() == PLAYER)
{
int id = -100 - subtype;
// Prevent showing errors when sprite doesn't exist
if (!itemDb->exists(id))
id = -100;
setSprite(Net::getCharHandler()->baseSprite(), id);
}
}
开发者ID:Ablu,项目名称:mana,代码行数:29,代码来源:being.cpp
示例8: setSprite
Poder::Poder(const int t) {
tipo = t;
setSprite(RUTA_OBJETOS_GFX);
size.x = size.y = 32;
active = -1;
clock.restart();
}
开发者ID:rubenmv,项目名称:herus-elementa,代码行数:7,代码来源:Poder.cpp
示例9: setType
GameStart::GameStart(){
setType("GameStart");
//dragonfly managers needed for this
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
//setup GameOversprite
df::Sprite *p_temp_sprite = resource_manager.getSprite("gamestart");
if (!p_temp_sprite){
df::LogManager &log_manager = df::LogManager::getInstance();
log_manager.writeLog("GameStart::GameStart(): Warning! Sprite '%s' not found", "gamestart");
}
else{
setSprite(p_temp_sprite);
setSpriteSlowdown(30);
setTransparency('#');
}
//put in center of window
setLocation(df::CENTER_CENTER);
//register interest
registerInterest(df::KEYBOARD_EVENT);
//play start music
p_music = df::ResourceManager::getInstance().getMusic("start music");
playMusic();
df::WorldManager &world_manager = df::WorldManager::getInstance();
world_manager.setBoundary(df::Box(df::Position(), 250, 250));
}
开发者ID:Jonas777,项目名称:Haunted-Space-Blast-Off,代码行数:31,代码来源:GameStart.cpp
示例10: setType
StaticObject::StaticObject(int objType, sf::Vector2i position)
{
setType(objType);
setPosition(position);
setSprite();
setBounds();
}
开发者ID:JustPowell,项目名称:SFML_Game,代码行数:7,代码来源:StaticObject.cpp
示例11: registerInterest
Trap::Trap(int x, int y)
{
LogManager &log_manager = LogManager::getInstance();
#ifdef REGISTER
// Need to update fire rate control each step.
registerInterest(DF_STEP_EVENT);
#endif
// Set object type.
setType("Trap");
auto& resMgr = ResourceManager::getInstance();
setSprite(resMgr.getSprite("trap"));
setSpriteSlowdown(4);
setAltitude(1);
// Set starting location.
WorldManager &world_manager = WorldManager::getInstance();
Position pos(7, world_manager.getBoundary().getVertical() / 2);
setPosition(Position(x, y));
setBox(Box(Position(0, 0), getSprite()->getWidth(), getSprite()->getHeight()));
//setYVelocity(0.25);
// Set firing variables.
}
开发者ID:piaoasd123,项目名称:IMGD3000PROJ2,代码行数:26,代码来源:Trap.cpp
示例12: setSprite
_border::_border()
{
// Get instances of necessary managers.
LogManager &log_manager = LogManager::getInstance();
ResourceManager &resource_manager = ResourceManager::getInstance();
WorldManager &world_manager = WorldManager::getInstance();
// Set up border sprite.
Sprite *p_temp_sprite = resource_manager.getSprite("border");
if (!p_temp_sprite)
{
log_manager.writeLog("_border::_border(): Warning! Sprite '%s' not found", "border");
}
else
{
// If sprite is found, set sprite for this object.
setSprite(p_temp_sprite);
}
// Set type of border.
setType("_border");
// Make sure it collides with others so game objects don't pass through message box.
setSolidness(HARD);
setAltitude(2);
// Set position to middle center of the terminal.
Position pos(world_manager.getBoundary().getCorner().getX() + world_manager.getBoundary().getHorizontal()/2,
( world_manager.getBoundary().getCorner().getY() + world_manager.getBoundary().getVertical()/2) + 6);
setPosition(pos);
};
开发者ID:MaxwellP,项目名称:IMGD3000,代码行数:31,代码来源:_border.cpp
示例13: setType
Explosion::Explosion(df::Position *p){
setType(Type::EXPLOSION);
setSolidness(df::SPECTRAL);
df::LogManager &log_manager = df::LogManager::getInstance();
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
df::Sprite *sprite;
sprite = resource_manager.getSprite("explosion");
if(!sprite){
log_manager.writeLog("Explosion::Explosion() could not load explosion sprite");
} else {
time_to_live = sprite->getFrameCount(); //set time as # of frames
log_manager.writeLog("Explosion::Explosion() frameCount %d", time_to_live);
setSprite(sprite);
}
if(p)
setPosition(*p);
registerInterest(df::STEP_EVENT);
if(Role::isServer()){
NetSyncing::create(this);
}
}
开发者ID:chickenbellyfinn,项目名称:CS4513,代码行数:27,代码来源:Explosion.cpp
示例14: setSprite
MediumRock::MediumRock(df::Position p) {
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
df::LogManager &log_manager = df::LogManager::getInstance();
// Link to "mediumrock" sprite
df::Sprite *p_temp_sprite;
p_temp_sprite = resource_manager.getSprite("mediumrock");
if (!p_temp_sprite) {
log_manager.writeLog("MediumRock::MediumRock(): Warning! Sprite '%s' not found", "mediumrock");
}
else {
setSprite(p_temp_sprite);
setSpriteSlowdown(0);
}
setType("MediumRock");
setSolidness(df::Solidness::SOFT);
//Set starting position
setPosition(p);
health = 15;
hit_slowdown = 5;
hit_countdown = hit_slowdown;
was_hit = false;
has_flashed = false;
}
开发者ID:johnn134,项目名称:TheTankHeardAroundTheWorld,代码行数:28,代码来源:MediumRock.cpp
示例15: setSprite
Mortar::Mortar(df::Position p, df::Object *new_player) {
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
df::LogManager &log_manager = df::LogManager::getInstance();
// Link to "mortar" sprite
df::Sprite *p_temp_sprite;
p_temp_sprite = resource_manager.getSprite("mortar");
if (!p_temp_sprite) {
log_manager.writeLog("Mortar::Mortar(): Warning! Sprite '%s' not found", "mortar");
}
else {
setSprite(p_temp_sprite);
setSpriteSlowdown(0);
}
setType("Mortar");
setSolidness(df::Solidness::SOFT);
//Set starting position
setPosition(p);
player = new_player;
fire_slowdown = 60;
fire_countdown = fire_slowdown;
firing_anim_slowdown = 5;
firing_anim_countdown = firing_anim_slowdown;
occupied = true;
firing = false;
}
开发者ID:johnn134,项目名称:TheTankHeardAroundTheWorld,代码行数:30,代码来源:Mortar.cpp
示例16: setSprite
Rejilla::Rejilla() {
// Carga el sprite con la textura
setSprite(RUTA_OBJETOS_GFX);
setSize(32, 32);
setCentro(this->getSize().x/2, this->getSize().y/2);
setFrame(2, 2, 1, 1);
}
开发者ID:rubenmv,项目名称:herus-elementa,代码行数:7,代码来源:Rejilla.cpp
示例17: setSprite
SmallBuilding::SmallBuilding(df::Position p) {
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
df::LogManager &log_manager = df::LogManager::getInstance();
// Link to "smallbuilding" sprite
df::Sprite *p_temp_sprite;
p_temp_sprite = resource_manager.getSprite("smallbuilding");
if (!p_temp_sprite) {
log_manager.writeLog("SmallBuilding::SmallBuilding(): Warning! Sprite '%s' not found", "smallbuilding");
}
else {
setSprite(p_temp_sprite);
}
setType("SmallBuilding");
setSolidness(df::Solidness::SOFT);
//Set starting position
setPosition(p);
health = 10;
hit_slowdown = 5;
hit_countdown = hit_slowdown;
was_hit = false;
has_flashed = false;
}
开发者ID:johnn134,项目名称:TheTankHeardAroundTheWorld,代码行数:27,代码来源:SmallBuilding.cpp
示例18: setSprite
Saucer::Saucer()
{
// Dragonfly managers needed for this method.
df::LogManager &log_manager = df::LogManager::getInstance();
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
df::WorldManager &world_manager = df::WorldManager::getInstance();
// Setup "saucer" sprite.
df::Sprite *p_temp_sprite = resource_manager.getSprite("saucer");
if (!p_temp_sprite) {
log_manager.writeLog("Saucer::Saucer(): Warning! Sprite '%s' not found", "saucer");
} else {
setSprite(p_temp_sprite);
setSpriteSlowdown(4);
}
// Set object type.
setType("Saucer");
// Set speed in horizontal direction.
setXVelocity(-0.25); // 1 space left every 4 frames
/*
// Set starting location in the middle of window.
int world_horiz = world_manager.getBoundary().getHorizontal();
int world_vert = world_manager.getBoundary().getVertical();
df::Position pos(world_horiz/2, world_vert/2);
setPosition(pos);*/
moveToStart();
}
开发者ID:g4vin,项目名称:Dragonfly-Wings,代码行数:31,代码来源:Saucer.cpp
示例19: setSprite
FootSoldier::FootSoldier(df::Position p, df::Object *new_player) {
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
df::LogManager &log_manager = df::LogManager::getInstance();
// Link to "player" sprite
df::Sprite *p_temp_sprite;
p_temp_sprite = resource_manager.getSprite("footsoldier");
if (!p_temp_sprite) {
log_manager.writeLog("FootSoldier::FootSoldier(): Warning! Sprite '%s' not found", "footsoldier");
}
else {
setSprite(p_temp_sprite);
setSpriteSlowdown(0);
}
setType("FootSoldier");
setSolidness(df::Solidness::SOFT);
//Register interests
registerInterest(df::STEP_EVENT);
//Set starting position
setPosition(p);
player = new_player;
fire_slowdown = 15 + rand() % 5;
fire_countdown = fire_slowdown;
}
开发者ID:johnn134,项目名称:TheTankHeardAroundTheWorld,代码行数:29,代码来源:FootSoldier.cpp
示例20: CC_BREAK_IF
bool CSpriteObject::init(CCDictionary* pObjectDict)
{
do {
CC_BREAK_IF(!CObjectBase::init(pObjectDict));
CCString* fileType = getFileTypeFromDict();
CC_BREAK_IF(NULL == fileType);
CCString* fileName = getFileNameFromDict();
CC_BREAK_IF(NULL == fileName);
if (getMaxLevelFromDict() > 0)
{
fileName = CCString::createWithFormat("%s%d", fileName->getCString(), getLevel() - 1);
}
if (fileType->compare("ccbi") == 0)
{
fileName = CCString::createWithFormat("%s.ccbi", fileName->getCString());
CC_BREAK_IF(!setSpriteFromCcbi(fileName->getCString()));
}
else
{
CC_BREAK_IF(!setSprite(fileName->getCString()));
}
return true;
} while (false);
return false;
}
开发者ID:raymondma,项目名称:EliminationPlane,代码行数:29,代码来源:CSpriteObject.cpp
注:本文中的setSprite函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论