dmuratshin 9 лет назад
Родитель
Сommit
de9dde3a30

+ 2 - 0
oxygine/src/Actor.h

@@ -215,6 +215,8 @@ namespace oxygine
         void setTouchEnabled(bool enabled) { _flags &= ~flag_touchEnabled; if (enabled) _flags |= flag_touchEnabled; }
         /**Enables/Disables Touch events for children of Actor.*/
         void setTouchChildrenEnabled(bool enabled) { _flags &= ~flag_touchChildrenEnabled; if (enabled) _flags |= flag_touchChildrenEnabled; }
+        /**setTouchEnabled + setTouchChildrenEnabled*/
+        void setTouchEnabled(bool enabled, bool childrenEnabled) { setTouchEnabled(enabled); setTouchChildrenEnabled(childrenEnabled); }
 
         /**Sets callback which would be called each Actor::update cycle before doUpdate. Use it if you don't want inherit from Actor and overload Actor::doUpdate.*/
         void setCallbackDoUpdate(UpdateCallback cb) {_cbDoUpdate = cb;}

+ 5 - 0
oxygine/src/PostProcess.cpp

@@ -234,6 +234,11 @@ namespace oxygine
 
     void RenderTargetsManager::reset()
     {
+        for (size_t i = 0; i < _rts.size(); ++i)
+        {
+            _rts[i]->release();
+        }
+
         _free.clear();
         _rts.clear();
     }

+ 19 - 0
oxygine/src/STDRenderer.cpp

@@ -27,6 +27,8 @@ namespace oxygine
 
 
     spNativeTexture STDRenderer::white;
+    spNativeTexture STDRenderer::invisible;
+
     std::vector<unsigned char> STDRenderer::indices8;
     std::vector<unsigned short> STDRenderer::indices16;
     size_t STDRenderer::maxVertices = 0;
@@ -148,6 +150,11 @@ namespace oxygine
         if (white)
             white->release();
         white = 0;
+
+        if (invisible)
+            invisible->release();
+        invisible = 0;
+
         delete instance;
         instance = 0;
     }
@@ -158,6 +165,11 @@ namespace oxygine
         if (white)
             white->release();
         white = 0;
+
+        if (invisible)
+            invisible->release();
+        invisible = 0;
+
         uberShader.release();
     }
 
@@ -180,6 +192,13 @@ namespace oxygine
         white->init(im, false);
         white->setLinearFilter(false);
 
+
+        memwhite.fill_zero();
+        invisible = IVideoDriver::instance->createTexture();
+        invisible->setName("!renderer. invisible");
+        invisible->init(im, false);
+        invisible->setLinearFilter(false);
+
         setDefaultSettings();
         _restored = true;
     }

+ 2 - 0
oxygine/src/STDRenderer.h

@@ -26,6 +26,8 @@ namespace oxygine
 
         /**White 4x4 Texture*/
         static spNativeTexture white;
+        static spNativeTexture invisible;
+
         static UberShaderProgram uberShader;
         static std::vector<unsigned char> uberShaderBody;
 

+ 4 - 0
oxygine/src/TextField.cpp

@@ -145,6 +145,7 @@ namespace oxygine
     {
         TextStyle::HorizontalAlign halign = _style.hAlign;
         TextStyle::VerticalAlign valign = _style.vAlign;
+        int size = _style.fontSize;
         _style = st;
 
         if (st.hAlign == TextStyle::HALIGN_DEFAULT)
@@ -153,6 +154,9 @@ namespace oxygine
         if (st.vAlign == TextStyle::VALIGN_DEFAULT)
             _style.vAlign = valign;
 
+        if (st.fontSize == 0)
+            _style.fontSize = size;
+
         needRebuild();
     }
 

+ 26 - 0
oxygine/src/TextStyle.h

@@ -62,6 +62,32 @@ namespace oxygine
         float outline;//works only with SD fonts, disabled by default = 0.0f, 0.5 - max outline
         Color outlineColor;//works only with SD fonts
         float weight;//works only with SD fonts, font weight, default = 0.5f,  0.0 - bold, 1.0 - thin
+
+
+
+        TextStyle withFont(const Font* f) const { TextStyle st = *this; st.font = f; return st; }
+
+        TextStyle alignTop() const { TextStyle st = *this; st.vAlign = VALIGN_TOP; return st; }
+        TextStyle alignBottom() const { TextStyle st = *this; st.vAlign = VALIGN_BOTTOM; return st; }
+        TextStyle alignBaseline() const { TextStyle st = *this; st.vAlign = VALIGN_BASELINE; return st; }
+        TextStyle alignMiddleV() const { TextStyle st = *this; st.vAlign = VALIGN_MIDDLE; return st; }
+
+        TextStyle alignLeft() const { TextStyle st = *this; st.hAlign = HALIGN_LEFT; return st; }
+        TextStyle alignRight() const { TextStyle st = *this; st.hAlign = HALIGN_RIGHT; return st; }
+        TextStyle alignMiddleH() const { TextStyle st = *this; st.hAlign = HALIGN_MIDDLE; return st; }
+
+        TextStyle alignMiddle() const { TextStyle st = *this; st.vAlign = VALIGN_MIDDLE; st.hAlign = HALIGN_MIDDLE; return st; }
+
+        TextStyle withHOffset(int offset) const { TextStyle st = *this; st.linesOffset = offset; return st; }
+        TextStyle withKerning(int kerning) const { TextStyle st = *this; st.kerning = kerning; return st; }
+        TextStyle withMultiline(bool multiline = true) const { TextStyle st = *this; st.multiline = multiline; return st; }
+        TextStyle withColor(const Color& color) const { TextStyle st = *this; st.color = color; return st; }
+
+        TextStyle withFontSize(int size) const { TextStyle st = *this; st.fontSize = size; return st; }
+
+        TextStyle withOutline(float outline) const { TextStyle st = *this; st.outline = outline; return st; }
+        TextStyle withOutlineColor(const Color& color) const { TextStyle st = *this; st.outlineColor = color; return st; }
+        TextStyle withWeight(float weight) const { TextStyle st = *this; st.weight = weight; return st; }
     };
 
     std::string dumpStyle(const TextStyle& s, bool onlydiff);