WorkspaceControl::WorkspaceControl(MyGUI::Widget* _parent) : TextureToolControl(_parent), mAreaSelectorControl(nullptr), mGridStep(0), mCurrentWidget(nullptr), mMoveableWidget(false), mPositionSelectorCreatorControl(nullptr), mFreeChildMode(false) { SettingsSector* sector = SettingsManager::getInstance().getSector("Workspace"); MyGUI::IntSize size = sector->getPropertyValue<MyGUI::IntSize>("TextureSize"); setTextureName(sector->getPropertyValue("TextureName")); setTextureRegion(MyGUI::IntCoord(0, 0, size.width, size.height)); addSelectorControl(mAreaSelectorControl); mAreaSelectorControl->eventChangePosition += MyGUI::newDelegate(this, &WorkspaceControl::notifyChangePosition); addSelectorControl(mPositionSelectorCreatorControl); mPositionSelectorCreatorControl->setEnabled(false); mPositionSelectorCreatorControl->setVisible(false); mGridStep = SettingsManager::getInstance().getSector("Settings")->getPropertyValue<int>("Grid"); SettingsManager::getInstance().eventSettingsChanged += MyGUI::newDelegate(this, &WorkspaceControl::notifySettingsChanged); WidgetSelectorManager::getInstance().eventChangeSelectedWidget += MyGUI::newDelegate(this, &WorkspaceControl::notifyChangeSelectedWidget); notifyChangeSelectedWidget(nullptr); EditorWidgets::getInstance().eventChangeWidgetCoord += MyGUI::newDelegate(this, &WorkspaceControl::notifyPropertyChangeCoord); CommandManager::getInstance().registerCommand("Command_MoveLeft", MyGUI::newDelegate(this, &WorkspaceControl::Command_MoveLeft)); CommandManager::getInstance().registerCommand("Command_MoveRight", MyGUI::newDelegate(this, &WorkspaceControl::Command_MoveRight)); CommandManager::getInstance().registerCommand("Command_MoveTop", MyGUI::newDelegate(this, &WorkspaceControl::Command_MoveTop)); CommandManager::getInstance().registerCommand("Command_MoveBottom", MyGUI::newDelegate(this, &WorkspaceControl::Command_MoveBottom)); CommandManager::getInstance().registerCommand("Command_SizeLeft", MyGUI::newDelegate(this, &WorkspaceControl::Command_SizeLeft)); CommandManager::getInstance().registerCommand("Command_SizeRight", MyGUI::newDelegate(this, &WorkspaceControl::Command_SizeRight)); CommandManager::getInstance().registerCommand("Command_SizeTop", MyGUI::newDelegate(this, &WorkspaceControl::Command_SizeTop)); CommandManager::getInstance().registerCommand("Command_SizeBottom", MyGUI::newDelegate(this, &WorkspaceControl::Command_SizeBottom)); CommandManager::getInstance().registerCommand("Command_GridMoveLeft", MyGUI::newDelegate(this, &WorkspaceControl::Command_GridMoveLeft)); CommandManager::getInstance().registerCommand("Command_GridMoveRight", MyGUI::newDelegate(this, &WorkspaceControl::Command_GridMoveRight)); CommandManager::getInstance().registerCommand("Command_GridMoveTop", MyGUI::newDelegate(this, &WorkspaceControl::Command_GridMoveTop)); CommandManager::getInstance().registerCommand("Command_GridMoveBottom", MyGUI::newDelegate(this, &WorkspaceControl::Command_GridMoveBottom)); CommandManager::getInstance().registerCommand("Command_GridSizeLeft", MyGUI::newDelegate(this, &WorkspaceControl::Command_GridSizeLeft)); CommandManager::getInstance().registerCommand("Command_GridSizeRight", MyGUI::newDelegate(this, &WorkspaceControl::Command_GridSizeRight)); CommandManager::getInstance().registerCommand("Command_GridSizeTop", MyGUI::newDelegate(this, &WorkspaceControl::Command_GridSizeTop)); CommandManager::getInstance().registerCommand("Command_GridSizeBottom", MyGUI::newDelegate(this, &WorkspaceControl::Command_GridSizeBottom)); CommandManager::getInstance().registerCommand("Command_Delete", MyGUI::newDelegate(this, &WorkspaceControl::Command_Delete)); CommandManager::getInstance().registerCommand("Command_NextItem", MyGUI::newDelegate(this, &WorkspaceControl::Command_NextItem)); CommandManager::getInstance().registerCommand("Command_FreeChildMode", MyGUI::newDelegate(this, &WorkspaceControl::Command_FreeChildMode)); WidgetCreatorManager::getInstance().eventChangeCreatorMode += MyGUI::newDelegate(this, &WorkspaceControl::notifyChangeCreatorMode); WidgetCreatorManager::getInstance().eventChangeSelector += MyGUI::newDelegate(this, &WorkspaceControl::notifyChangeSelectorCreator); updateCaption(); MyGUI::Gui::getInstance().eventFrameStart += MyGUI::newDelegate(this, &WorkspaceControl::notifyFrameStart); }
void StateTextureControl::updateTexture() { MyGUI::UString texture; if (getCurrentSkin() != nullptr) texture = getCurrentSkin()->getPropertySet()->getPropertyValue("Texture"); setTextureName(texture); }
//----------------------------------------------------------------------------- // SpriteTexture implementation //----------------------------------------------------------------------------- SpriteTexture::SpriteTexture(const sf::String& aTextureName, const sf::Texture& aTexture, const sf::IntRect* aTextureRects, int numRects) : m_texture(&aTexture) { int newSize = numRects + (int)m_textureRects.size(); setTextureName(aTextureName); m_textureRects.reserve(newSize); for (int i = 0; i < numRects; ++i) m_textureRects.push_back(aTextureRects[i]); }
void RegionTextureControl::updateTextureControl() { if (mTextureVisible && !mTextureName.empty() && getCurrentSkin() != nullptr && getCurrentState() != nullptr) { setTextureName(mTextureName); setTextureRegion(mTextureRegion); } else { setTextureRegion(MyGUI::IntCoord()); } }
void RTTLayer::deserialization(xml::ElementPtr _node, Version _version) { Base::deserialization(_node, _version); MyGUI::xml::ElementEnumerator propert = _node->getElementEnumerator(); while (propert.next("Property")) { const std::string& key = propert->findAttribute("key"); const std::string& value = propert->findAttribute("value"); if (key == "TextureSize") setTextureSize(utility::parseValue<IntSize>(value)); if (key == "TextureName") setTextureName(value); } }
bool TextureUnitState::setPropertyOverride (const std::string& name, PropertyValuePtr& value, PropertySetGet *context) { if (name == "texture_alias") { std::string aliasName = retrieveValue<StringValue>(value, context).get(); Factory::getInstance().addTextureAliasInstance (aliasName, this); setTextureName (Factory::getInstance().retrieveTextureAlias (aliasName)); return true; } else return false; }
//===================================================== GlPolygon::GlPolygon(const vector<Coord> &points, const vector<Color> &fcolors, const vector<Color> &ocolors, const bool filled, const bool outlined, const string &textureName, const float outlineSize) { setPoints(points); setFillColors(fcolors); setOutlineColors(ocolors); setFillMode(filled); setOutlineMode(outlined); setTextureName(textureName); setOutlineSize(outlineSize); }
//----------------------------------------------------------------------- TextureUnitState::TextureUnitState( Pass* parent, const String& texName, unsigned int texCoordSet) : mCurrentFrame(0) , mAnimDuration(0) , mCubic(false) , mTextureType(TEX_TYPE_2D) , mDesiredFormat(PF_UNKNOWN) , mTextureSrcMipmaps(MIP_DEFAULT) , mTextureCoordSetIndex(0) , mBorderColour(ColourValue::Black) , mTextureLoadFailed(false) , mIsAlpha(false) , mHwGamma(false) , mRecalcTexMatrix(false) , mUMod(0) , mVMod(0) , mUScale(1) , mVScale(1) , mRotate(0) , mTexModMatrix(Matrix4::IDENTITY) , mMinFilter(FO_LINEAR) , mMagFilter(FO_LINEAR) , mMipFilter(FO_POINT) , mMaxAniso(MaterialManager::getSingleton().getDefaultAnisotropy()) , mMipmapBias(0) , mIsDefaultAniso(true) , mIsDefaultFiltering(true) , mBindingType(BT_FRAGMENT) , mContentType(CONTENT_NAMED) , mParent(parent) , mAnimController(0) { mColourBlendMode.blendType = LBT_COLOUR; mAlphaBlendMode.operation = LBX_MODULATE; mAlphaBlendMode.blendType = LBT_ALPHA; mAlphaBlendMode.source1 = LBS_TEXTURE; mAlphaBlendMode.source2 = LBS_CURRENT; setColourOperation(LBO_MODULATE); setTextureAddressingMode(TAM_WRAP); setTextureName(texName); setTextureCoordSet(texCoordSet); if( Pass::getHashFunction() == Pass::getBuiltinHashFunction( Pass::MIN_TEXTURE_CHANGE ) ) { mParent->_dirtyHash(); } }
void RTTLayer::setTextureSize(const IntSize& _size) { if (mTextureSize == _size) return; mTextureSize = _size; if (mTexture) { MyGUI::RenderManager::getInstance().destroyTexture(mTexture); mTexture = nullptr; } MYGUI_ASSERT(mTextureSize.width * mTextureSize.height, "RTTLayer texture size must have non-zero width and height"); std::string name = MyGUI::utility::toString((size_t)this, getClassTypeName()); mTexture = MyGUI::RenderManager::getInstance().createTexture(name); mTexture->createManual(mTextureSize.width, mTextureSize.height, MyGUI::TextureUsage::RenderTarget, MyGUI::PixelFormat::R8G8B8A8); #ifdef MYGUI_OGRE_PLATFORM setTextureName(mTexture->getName()); #endif }
//===================================================== GlPolygon::GlPolygon(const unsigned int nbPoints, const unsigned int nbFillColors, const unsigned int nbOutlineColors, const bool filled, const bool outlined, const string &textureName, const float outlineSize) { vector<Coord> points; points.resize(nbPoints); setPoints(points); vector<Color> fillColors; fillColors.resize(nbFillColors,Color(0,0,0,255)); setFillColors(fillColors); vector<Color> outlineColors; outlineColors.resize(nbOutlineColors); setOutlineColors(outlineColors); setFillMode(filled); setOutlineMode(outlined); setTextureName(textureName); setOutlineSize(outlineSize); }
//----------------------------------------------------------------------- bool TextureUnitState::applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply) { bool testResult = false; // if TUS has an alias see if its in the alias container if (!mTextureNameAlias.empty()) { AliasTextureNamePairList::const_iterator aliasEntry = aliasList.find(mTextureNameAlias); if (aliasEntry != aliasList.end()) { // match was found so change the texture name in mFrames testResult = true; if (apply) { // currently assumes animated frames are sequentially numbered // cubic, 1d, 2d, and 3d textures are determined from current TUS state // if cubic or 3D if (mCubic) { setCubicTextureName(aliasEntry->second, mTextureType == TEX_TYPE_CUBE_MAP); } else { // if more than one frame then assume animated frames if (mFrames.size() > 1) setAnimatedTextureName(aliasEntry->second, static_cast<unsigned int>(mFrames.size()), mAnimDuration); else setTextureName(aliasEntry->second, mTextureType); } } } } return testResult; }
//----------------------------------------------------------------------- TextureUnitState::TextureUnitState( Pass* parent, const String& texName, unsigned int texCoordSet) : mCurrentFrame(0) , mAnimDuration(0) , mCubic(false) , mTextureType(TEX_TYPE_2D) , mDesiredFormat(PF_UNKNOWN) , mTextureSrcMipmaps(MIP_DEFAULT) , mTextureCoordSetIndex(0) , mBorderColour(ColourValue::Black) , mTextureLoadFailed(false) , mIsAlpha(false) , mHwGamma(false) , mRecalcTexMatrix(false) , mUMod(0) , mVMod(0) , mUScale(1) , mVScale(1) , mRotate(0) , mTexModMatrix(Matrix4::IDENTITY) , mMinFilter(FO_LINEAR) , mMagFilter(FO_LINEAR) , mMipFilter(FO_POINT) , mMaxAniso(MaterialManager::getSingleton().getDefaultAnisotropy()) , mIsDefaultAniso(true) , mIsDefaultFiltering(true) , mBindingType(BT_FRAGMENT) , mContentType(CONTENT_NAMED) , mParent(parent) , mAnimController(0) { setTextureName(texName); setTextureCoordSet(texCoordSet); mParent->_dirtyHash(); }
GlRegularPolygon::GlRegularPolygon(const Coord &position, const Size &size, unsigned int numberOfSides, const Color &fillColor, const Color &outlineColor, bool filled, bool outlined, const string &textureName, float outlineSize): position(position), size(size), numberOfSides(numberOfSides), startAngle(float(M_PI)/2.0f) { computePolygon(); invertYTexture=false; setFillColor(fillColor); setOutlineColor(outlineColor); setFillMode(filled); setOutlineMode(outlined); setTextureName(textureName); setOutlineSize(outlineSize); }
//----------------------------------------------------------------------- TextureUnitState::TextureUnitState( Pass* parent, const String& texName, unsigned int texCoordSet) : mCurrentFrame(0) , mAnimDuration(0) , mCubic(false) , mTextureCoordSetIndex(0) , mTextureLoadFailed(false) , mGamma(1) , mRecalcTexMatrix(false) , mUMod(0) , mVMod(0) , mUScale(1) , mVScale(1) , mRotate(0) , mTexModMatrix(Matrix4::IDENTITY) , mBindingType(BT_FRAGMENT) , mContentType(CONTENT_NAMED) , mSampler(TextureManager::getSingletonPtr() ? TextureManager::getSingleton().getDefaultSampler() : DUMMY_SAMPLER) , mParent(parent) , mAnimController(0) { mColourBlendMode.blendType = LBT_COLOUR; mAlphaBlendMode.operation = LBX_MODULATE; mAlphaBlendMode.blendType = LBT_ALPHA; mAlphaBlendMode.source1 = LBS_TEXTURE; mAlphaBlendMode.source2 = LBS_CURRENT; setColourOperation(LBO_MODULATE); setTextureName(texName); setTextureCoordSet(texCoordSet); if( Pass::getHashFunction() == Pass::getBuiltinHashFunction( Pass::MIN_TEXTURE_CHANGE ) ) { mParent->_dirtyHash(); } }
//----------------------------------------------------------------------- void TextureUnitState::setBlank(void) { setTextureName(StringUtil::BLANK); }
GlPolygon::GlPolygon(const bool filled,const bool outlined,const string &textureName,const float outlineSize) { setFillMode(filled); setOutlineMode(outlined); setTextureName(textureName); setOutlineSize(outlineSize); }