void CCheckBox::setNormalImage(const char* pFile) { if( pFile && strlen(pFile) ) { CCTexture2D* pTexture = CCTextureCache::sharedTextureCache()->addImage(pFile); setNormalTexture(pTexture); } }
void CButton::setNormalImage(const char* pFile) { if( pFile && strlen(pFile) ) { Texture2D* pTexture = Director::getInstance()->getTextureCache()->addImage(pFile); setNormalTexture(pTexture); } }
// constructor MGuiImage::MGuiImage(const char * filename, const MVector2 & position, const MVector2 & scale, const MVector4 & color) { setNormalTexture(filename); setParentWindow(NULL); setPosition(position); setScale(scale); setNormalColor(color); }
void CollectionView::addTile(std::string imgPath, sf::Vector2f textureOffset, sf::Vector2f textureSize) { auto tile = std::make_shared<GUI::Button>(); tile->setText(""); tile->drawRect(true); tile->drawSprite(true); sf::Texture* texture = new sf::Texture(); if (textureSize.x != -1){ texture->loadFromFile(imgPath,sf::IntRect((int) textureOffset.x, (int) textureOffset.y,(int)textureSize.x, (int)textureSize.y)); } else texture->loadFromFile(imgPath); tile->setNormalTexture(texture); tile->setPressedColor(sf::Color(75,131,204)); tile->setToggle(true); mTiles.push_back(tile); updateGraphics(); }
void UIButton::setScale9Enable(bool able) { if (m_bScale9Enable == able) { return; } m_nPrevPressstate = WidgetStateNone; m_nCurPressState = WidgetStateNone; m_bScale9Enable = able; m_pRender->removeChild(m_pButtonNormal, true); m_pRender->removeChild(m_pButtonClicked, true); m_pRender->removeChild(m_pButtonDisable, true); m_pButtonNormal = NULL; m_pButtonClicked = NULL; m_pButtonDisable = NULL; if (m_bScale9Enable) { m_pButtonNormal = CCScale9Sprite::create(); m_pButtonClicked = CCScale9Sprite::create(); m_pButtonDisable = CCScale9Sprite::create(); } else { m_pButtonNormal = CCSprite::create(); m_pButtonClicked = CCSprite::create(); m_pButtonDisable = CCSprite::create(); } // setTextures(m_strNormalFileName.c_str(), m_strClickedFileName.c_str(), m_strDisabledFileName.c_str(),getUseMergedTexture()); setNormalTexture(m_strNormalFileName.c_str(), m_eNormalTexType); setPressedTexture(m_strClickedFileName.c_str(), m_ePressedTexType); setDisabledTexture(m_strDisabledFileName.c_str(), m_eDisabledTexType); m_pRender->addChild(m_pButtonNormal,-1); m_pRender->addChild(m_pButtonClicked,-1); m_pRender->addChild(m_pButtonDisable,-1); initPressState(WidgetStateNormal); setCapInsets(m_capInsets); setScale9Size(m_scale9Size); }
void UIButton::setTextures(const char* normal,const char* selected,const char* disabled,TextureResType texType) { setNormalTexture(normal,texType); setPressedTexture(selected,texType); setDisabledTexture(disabled,texType); }