本文整理汇总了C++中Skin类的典型用法代码示例。如果您正苦于以下问题:C++ Skin类的具体用法?C++ Skin怎么用?C++ Skin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Skin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OSD
EjectOSD::EjectOSD() :
OSD(L"3RVX-EjectDispatcher"),
_mWnd(L"3RVX-EjectOSD", L"3RVX-EjectOSD") {
Skin *skin = SkinManager::Instance()->CurrentSkin();
if (skin->HasOSD("eject") == false) {
return;
}
/* TODO: NULL check*/
_mWnd.BackgroundImage(skin->ejectBackground);
if (skin->ejectMask != NULL) {
_mWnd.EnableGlass(skin->ejectMask);
}
_mWnd.Update();
Settings *settings = Settings::Instance();
_mWnd.AlwaysOnTop(settings->AlwaysOnTop());
_mWnd.HideAnimation(settings->HideAnim(), settings->HideSpeed());
_mWnd.VisibleDuration(settings->HideDelay());
UpdateWindowPositions(ActiveMonitors());
}
示例2:
void NormalEnemy::setB2bodyPartPosition()
{
const Map<std::string, Bone*>& dic = armature->getBoneDic();
// CCArray *dickeyarr = dic->allKeys();
for(auto& element : dic)
{
//Ref *o = dickeyarr->objectAtIndex(i);
// CCString *key = dynamic_cast<CCString*>(o);
Skin *skin = (Skin*)element.second->getDisplayRenderNode();
string name = element.first;
if (skin != NULL) {
if (skin->isphysicsObject) {
if (1) {
b2Body *body = skin->body;
body->SetActive(true);
Point partpos = skin->getParentRelatePosition();
float partrotation = skin->getWorldRotation();
//printf("%f\n", partrotation);
body->SetTransform(b2Vec2(partpos.x/PTM_RATIO, partpos.y/PTM_RATIO), CC_DEGREES_TO_RADIANS(-partrotation));
}
}
}
}
}
示例3: memset
bool SkinDialog::init(const char* skinPath, char* skinName) {
// if ( screenSnapshot == NULL )
// return false;
if ( drawImage == NULL )
return false;
memset(this->skinPath, 0, 512);
memset(this->skinShortPath, 0, 512);
strncpy(this->skinPath, skinPath, 511);
strncpy(this->skinShortPath, skinPath, 511);
this->skinName = skinName;
itemCount = open_directory(this->skinPath, this->skinShortPath, 0, 0, skinFilter, &skinItems);
if ( itemCount < 2)
return false;
itemTop = itemCurrent = 1;
// makeScreenSnapshot(screenSnapshot);
mainFont = FtFontManager::getInstance()->getMainFont();
fontSize = (Config::getInstance())->getIntegerValue("config/windows/font/size",12);
itemBottom = SKIN_DIALOG_ITEM_H / ( fontSize + 2 );
Skin* skin = Skin::getInstance();
alpha = skin->getAlphaValue("skin/config_dialog/dialog/alpha", PPA_SKINDLG_ALPHA);
bgColor = skin->getColorValue("skin/config_dialog/dialog/background_color", PPA_SKINDLG_BG_COLOR);
labelColor = skin->getColorValue("skin/config_dialog/dialog/label_color", PPA_SKINDLG_LABEL_COLOR);
title = i18nGetText(I18N_MSG_SKIN_TITLE);
sprintf(help, "%s %s %s %s", circleChar, i18nGetText(I18N_MSG_OK), crossChar, i18nGetText(I18N_MSG_CANCEL));
return true;
};
示例4: switch
void Armature::draw(cocos2d::Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
if (_parentBone == nullptr && _batchNode == nullptr)
{
// CC_NODE_DRAW_SETUP();
}
for (auto& object : _children)
{
if (Bone *bone = dynamic_cast<Bone *>(object))
{
Node *node = bone->getDisplayRenderNode();
if (nullptr == node)
continue;
switch (bone->getDisplayRenderNodeType())
{
case CS_DISPLAY_SPRITE:
{
Skin *skin = static_cast<Skin *>(node);
skin->updateTransform();
BlendFunc func = bone->getBlendFunc();
if (func.src != _blendFunc.src || func.dst != _blendFunc.dst)
{
skin->setBlendFunc(bone->getBlendFunc());
}
else
{
skin->setBlendFunc(_blendFunc);
}
skin->draw(renderer, transform, flags);
}
break;
case CS_DISPLAY_ARMATURE:
{
node->draw(renderer, transform, flags);
}
break;
default:
{
node->visit(renderer, transform, flags);
// CC_NODE_DRAW_SETUP();
}
break;
}
}
else if(Node *node = dynamic_cast<Node *>(object))
{
node->visit(renderer, transform, flags);
// CC_NODE_DRAW_SETUP();
}
}
}
示例5: preDrawingComputation
/** Computation of values only if MultiColumnList's geometry was dirty
*
* This function is used to speed up the drawing. It is automatically
* called from \ref soBetaGui::drawMultiColumnList when the geometryDirty
* flag of the MultiColumnList is true before the drawing. You know the
* Widget moved or was resized recently.
*
* This function is also responsible of the scissor rectangles computation.
* By example to avoid window to override the window scissor rectangle.
*
* \param mcl The MultiColumnList that moved or resized
*
*/
void RainbruRPG::OgreGui::wdMultiColumnList::
preDrawingComputation(MultiColumnList* mcl){
mMclAbsCorners = mcl->getAbsoluteCorners();
mMclDrawnCorners = mMclAbsCorners;
// Compute right scissor if parent
Window* parent = dynamic_cast<Window*>(mcl->getParent());
if (mcl->getParent()){
int pRight = parent->getRight();
pRight -= (parent->isVerticalScrollbarVisible()) ?
parent->getVerticalScrollbar()->getWidth() : 0;
if (pRight < mMclAbsCorners.right){
mMclAbsCorners.right = pRight;
}
else{
// Makes the line drawn
mMclDrawnCorners.right--;
}
}
// Compute bottom scissor if parent
if (mcl->getParent()){
int pBottom = parent->getBottom();
pBottom -= (parent->isHorizontalScrollbarVisible()) ?
parent->getHorizontalScrollbar()->getHeight() : 0;
if (pBottom < mMclAbsCorners.bottom){
mMclAbsCorners.bottom = pBottom;
}
else{
// Makes the line drawn
mMclDrawnCorners.bottom--;
}
}
// Handle parent scrollbar values
parentVerticalScrollbarValue = parent->getVerticalScrollbar()->getValue();
parentHorizontalScrollbarValue= parent->getHorizontalScrollbar()->getValue();
mMclHeaderBottomLine = mMclAbsCorners.top+mcl->getHeaderHeight();
mColumnCaption=Ogre::Rectangle(mMclAbsCorners);
mColumnCaption.bottom=mColumnCaption.top + mcl->getHeaderHeight();
maxMclRight = mMclAbsCorners.right;
// Compute parentUnderTitleY : We use the Skin::getTitleBarHeight()
// function as the title bar height depend on the skin
parentUnderTitleY = parent->getTop();
Skin* woeSkin = SkinManager::getSingleton().getSkin(parent);
parentUnderTitleY += woeSkin->getTitleBarHeight();
// Get the parent left value
parentLeftX = parent->getLeft();
}
示例6: Skin
Skin *Skin::createWithSpriteFrameName(const char *pszSpriteFrameName)
{
Skin *skin = new Skin();
if(skin && skin->initWithSpriteFrameName(pszSpriteFrameName))
{
skin->autorelease();
return skin;
}
CC_SAFE_DELETE(skin);
return NULL;
}
示例7: Skin
Skin *Skin::createWithSpriteFrameName(const std::string& pszSpriteFrameName)
{
Skin *skin = new Skin();
if(skin && skin->initWithSpriteFrameName(pszSpriteFrameName))
{
skin->autorelease();
return skin;
}
CC_SAFE_DELETE(skin);
return nullptr;
}
示例8: while
void SkinManager::parseScript(DataStreamPtr& stream, const String& groupName)
{
try
{
String line = "";
Skin *pSkin = 0;
while(!stream->eof())
{
line = stream->getLine();
// Ignore blanks & comments
if (!line.length() || line.substr(0, 2) == "//")
{
continue;
}
if (!pSkin)
{
// No current skin
// So first valid data should be skin name
#ifdef ROR_USE_OGRE_1_9
pSkin = (Skin *)createResource(line, groupName).getPointer();
#else
pSkin = (Skin *)create(line, groupName).getPointer();
#endif
if (pSkin)
{
pSkin->_notifyOrigin(stream->getName());
stream->skipLine("{");
}
} else
{
// Already in skin
if (line == "}")
{
// Finished
//addImpl((Ogre::ResourcePtr)pSkin);
pSkin = 0;
// NB skin isn't loaded until required
} else
{
ParseSkinAttribute(line, pSkin);
}
}
}
} catch(Ogre::ItemIdentityException e)
{
// this catches duplicates -> to be ignored
// this happens since we load the full skin data off the cache, so we don't need
// to re-add it to the SkinManager
return;
}
}
示例9: new
Skin *Skin::create(const std::string& pszFileName)
{
Skin *skin = new (std::nothrow) Skin();
if(skin && skin->initWithFile(pszFileName))
{
skin->autorelease();
return skin;
}
CC_SAFE_DELETE(skin);
return nullptr;
}
示例10: switch
void Armature::draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{
if (_parentBone == nullptr && _batchNode == nullptr)
{
// CC_NODE_DRAW_SETUP();
}
for (auto& object : _children)
{
if (Bone *bone = dynamic_cast<Bone *>(object))
{
Node *node = bone->getDisplayRenderNode();
if (nullptr == node)
continue;
switch (bone->getDisplayRenderNodeType())
{
case CS_DISPLAY_SPRITE:
{
Skin *skin = static_cast<Skin *>(node);
skin->updateTransform();
bool blendDirty = bone->isBlendDirty();
if (blendDirty)
{
skin->setBlendFunc(bone->getBlendFunc());
}
skin->draw(renderer, transform, transformUpdated);
}
break;
case CS_DISPLAY_ARMATURE:
{
node->draw(renderer, transform, transformUpdated);
}
break;
default:
{
node->visit(renderer, transform, transformUpdated);
// CC_NODE_DRAW_SETUP();
}
break;
}
}
else if(Node *node = dynamic_cast<Node *>(object))
{
node->visit(renderer, transform, transformUpdated);
// CC_NODE_DRAW_SETUP();
}
}
}
示例11: CS_DISPLAY_SPRITE_CREATE
void CS_DISPLAY_SPRITE_CREATE(Bone *bone, DecorativeDisplay *decoDisplay)
{
Skin *skin = NULL;
SpriteDisplayData *displayData = (SpriteDisplayData*)decoDisplay->getDisplayData();
//! remove .xxx
std::string textureName = displayData->displayName;
size_t startPos = textureName.find_last_of(".");
if(startPos != std::string::npos)
{
textureName = textureName.erase(startPos);
}
//! create display
if(textureName.compare("") == 0)
{
skin = Skin::create();
}
else
{
skin = Skin::createWithSpriteFrameName((textureName + ".png").c_str());
}
CCTextureAtlas *atlas = SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->getTextureAtlas((textureName + ".png").c_str());
skin->setTextureAtlas(atlas);
TextureData *textureData = ArmatureDataManager::sharedArmatureDataManager()->getTextureData(textureName.c_str());
if(textureData)
{
//! Init display anchorPoint£¨ every Texture have a anchor point
skin->setAnchorPoint(ccp( textureData->pivotX, textureData->pivotY));
}
skin->setBone(bone);
skin->setSkinData(*bone->getBoneData());
decoDisplay->setDisplay(skin);
#if ENABLE_PHYSICS_DETECT
if (textureData && textureData->contourDataList.count() > 0)
{
//! create ContourSprite
ColliderDetector *colliderDetector = ColliderDetector::create(bone);
colliderDetector->addContourDataList(&textureData->contourDataList);
decoDisplay->setColliderDetector(colliderDetector);
}
#endif
}
示例12: getResourceIterator
void SkinManager::getMaterialAlternatives(Ogre::String materialName, std::vector<Skin *> &skinVector)
{
Ogre::ResourceManager::ResourceMapIterator it = getResourceIterator();
while (it.hasMoreElements())
{
Skin *skin = (Skin *)it.getNext().getPointer();
if (skin->hasReplacementForMaterial(materialName))
{
skinVector.push_back(skin);
}
}
}
示例13: skinUninstanceCB
void
skinUninstanceCB(Geometry *geo, InstanceDataHeader *header)
{
defaultUninstanceCB(geo, header);
Skin *skin = Skin::get(geo);
if(skin == nil)
return;
NativeSkin *natskin = (NativeSkin*)skin->platformData;
uint8 *data = skin->data;
float *invMats = skin->inverseMatrices;
skin->init(skin->numBones, natskin->numUsedBones, geo->numVertices);
memcpy(skin->inverseMatrices, invMats, skin->numBones*64);
rwFree(data);
for(int32 j = 0; j < skin->numUsedBones; j++)
skin->usedBones[j] = natskin->table1[j];
float *weights = skin->weights;
uint8 *indices = skin->indices;
uint8 *p = (uint8*)natskin->vertexBuffer;
int32 numVertices = header->numVertices;
float w[4];
uint8 i[4];
uint16 *ip;
while(numVertices--){
w[0] = w[1] = w[2] = w[3] = 0.0f;
i[0] = i[1] = i[2] = i[3] = 0;
for(int32 j = 0; j < skin->numWeights; j++)
w[j] = *p++/255.0f;
ip = (uint16*)p;
for(int32 j = 0; j < skin->numWeights; j++){
i[j] = natskin->table1[*ip++/3];
if(w[j] == 0.0f) i[j] = 0; // clean up a bit
}
p = (uint8*)ip;
for(int32 j = 0; j < 4; j++){
*weights++ = w[j];
*indices++ = i[j];
}
}
rwFree(natskin->vertexBuffer);
rwFree(natskin);
}
示例14: initSpriteDisplay
void DisplayFactory::createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay)
{
Skin *skin = nullptr;
SpriteDisplayData *displayData = (SpriteDisplayData *)decoDisplay->getDisplayData();
std::string textureName = displayData->displayName;
size_t startPos = textureName.find_last_of(".");
if(startPos != std::string::npos)
{
textureName = textureName.erase(startPos);
}
//! create display
if(textureName.length() == 0)
{
skin = Skin::create();
}
else
{
skin = Skin::createWithSpriteFrameName((textureName + ".png").c_str());
}
decoDisplay->setDisplay(skin);
if (skin == nullptr)
{
return;
}
skin->setBone(bone);
initSpriteDisplay(bone, decoDisplay, displayData->displayName.c_str(), skin);
Armature *armature = bone->getArmature();
if (armature)
{
if (armature->getArmatureData()->dataVersion >= VERSION_COMBINED)
{
skin->setSkinData(displayData->skinData);
}
else
{
skin->setSkinData(*bone->getBoneData());
}
}
}
示例15: init
bool DestructableObject::init(cocos2d::Layer *gameScene_, b2World *gameWorld_, Point pos, string armatureName, float scale, float density)
{
gameScene = gameScene_;
gameWorld = gameWorld_;
density_ = density;
//load the armature
armature = Armature::create(armatureName);
armature->setPosition(pos);
armature->setScale(scale);
armature->setVisible(true);
armature->setAnchorPoint(Point(0.5,0.5));
gameScene->addChild(armature,12);
//create body
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.position.Set(pos.x/PTM_RATIO,pos.y/PTM_RATIO);
body_ = gameWorld->CreateBody(&bodyDef);
b2PolygonShape dynamicBox;
dynamicBox.SetAsBox((0.5*armature->getScale()*armature->getContentSize().width/PTM_RATIO), 0.5*armature->getScale()*armature->getContentSize().height/PTM_RATIO);
b2FixtureDef fixtureDef;
fixtureDef.shape = &dynamicBox;
fixtureDef.density = density;
fixtureDef.friction = 0.3f;
fixtureDef.filter.categoryBits = ZOMBIE;
fixtureDef.filter.maskBits = BASE_GROUND | UPPER_GROUND | PLAYER;
fixtureDef.fixturetype = f_object;
body_->CreateFixture(&fixtureDef);
body_->SetUserData(&armature);
active = false;
// set the damaged part invisible
Vector<Node*> bonearr = armature->getChildren();
for(int i = 0; i< bonearr.size();i++)
{
Bone *bone = (Bone*)bonearr.at(i);
std::string boneName = bone->getName();
if (strstr(boneName.c_str(), "damaged")) {
Skin *skin = (Skin*)bone->getDisplayRenderNode();
if (skin !=NULL) {
skin->setVisible(false);
}
}
}
return true;
}