Browse Source

Merge branch 'dev'

dm 7 years ago
parent
commit
6c6aca6bd4
36 changed files with 602 additions and 353 deletions
  1. 1 1
      examples/Demo/src/example.cpp
  2. 0 0
      examples/Demo/src/test.cpp
  3. 4 4
      examples/Demo/src/test.h
  4. 20 0
      oxygine/src/oxygine/AnimationFrame.cpp
  5. 5 0
      oxygine/src/oxygine/AnimationFrame.h
  6. 52 3
      oxygine/src/oxygine/Clock.cpp
  7. 22 8
      oxygine/src/oxygine/Clock.h
  8. 1 1
      oxygine/src/oxygine/Event.h
  9. 1 1
      oxygine/src/oxygine/Material.h
  10. 40 5
      oxygine/src/oxygine/PostProcess.cpp
  11. 5 1
      oxygine/src/oxygine/PostProcess.h
  12. 42 19
      oxygine/src/oxygine/STDRenderer.cpp
  13. 6 3
      oxygine/src/oxygine/STDRenderer.h
  14. 5 4
      oxygine/src/oxygine/Serialize.h
  15. 1 1
      oxygine/src/oxygine/TouchEvent.h
  16. 9 3
      oxygine/src/oxygine/UpdateState.h
  17. 6 4
      oxygine/src/oxygine/actor/Actor.cpp
  18. 2 2
      oxygine/src/oxygine/actor/Box9Sprite.cpp
  19. 0 8
      oxygine/src/oxygine/actor/Stage.cpp
  20. 12 2
      oxygine/src/oxygine/actor/TextField.cpp
  21. 1 1
      oxygine/src/oxygine/core/Object.cpp
  22. 2 0
      oxygine/src/oxygine/core/UberShaderProgram.cpp
  23. 2 2
      oxygine/src/oxygine/core/ZipFileSystem.cpp
  24. 216 215
      oxygine/src/oxygine/core/Zips.cpp
  25. 40 40
      oxygine/src/oxygine/core/Zips.h
  26. 4 3
      oxygine/src/oxygine/core/oxygine.cpp
  27. 0 1
      oxygine/src/oxygine/core/system_data.cpp
  28. 0 1
      oxygine/src/oxygine/dev_tools/TreeInspectorPreview.h
  29. 0 2
      oxygine/src/oxygine/oxygine-forwards.h
  30. 31 10
      oxygine/src/oxygine/tween/Tween.cpp
  31. 10 4
      oxygine/src/oxygine/tween/Tween.h
  32. 2 2
      oxygine/src/oxygine/tween/TweenAlphaFade.cpp
  33. 1 1
      oxygine/src/oxygine/tween/TweenOutline.cpp
  34. 2 1
      oxygine/src/oxygine/tween/TweenQueue.cpp
  35. 44 0
      oxygine/system_data/original/system/pp_rast_fs2.glsl
  36. 13 0
      oxygine/system_data/original/system/shader.glsl

+ 1 - 1
examples/Demo/src/example.cpp

@@ -169,7 +169,7 @@ void example_init()
 
     //Load resources in xml file
     resources.loadXML("xmls/res.xml");
-    
+
 
     Test::instance = new TestActor;
     Test::instance->attachTo(getStage());

File diff suppressed because it is too large
+ 0 - 0
examples/Demo/src/test.cpp


+ 4 - 4
examples/Demo/src/test.h

@@ -36,8 +36,8 @@ public:
     void updateText(string id, string txt);
     virtual void clicked(string id) {}
     virtual void toggleClicked(string id, const toggle* data) {}
-    
-        
+
+
     void notify(string text, int time = 400);
 
 protected:
@@ -53,8 +53,8 @@ protected:
     spActor _ui;
 
     float _x;
-    float _y;    
-    
+    float _y;
+
     enum {MAX_NOTIFIES = 8};
     int _notifies[MAX_NOTIFIES];
 };

+ 20 - 0
oxygine/src/oxygine/AnimationFrame.cpp

@@ -64,6 +64,26 @@ namespace oxygine
         return f;
     }
 
+    spNativeTexture AnimationFrame::getBaseTexture() const
+    {
+        return _diffuse.base;
+    }
+
+    spNativeTexture AnimationFrame::getAlphaTexture() const
+    {
+        return _diffuse.alpha;
+    }
+
+    void AnimationFrame::setBaseTexture(spNativeTexture t)
+    {
+        _diffuse.base = t;
+    }
+
+    void AnimationFrame::setAlphaTexture(spNativeTexture t)
+    {
+        _diffuse.alpha = t;
+    }
+
     void AnimationFrame::flipX()
     {
         _srcRect.setX(_srcRect.getRight());

+ 5 - 0
oxygine/src/oxygine/AnimationFrame.h

@@ -53,10 +53,15 @@ namespace oxygine
         const Diffuse&  getDiffuse() const {return _diffuse;}
         const HitTestData& getHitTestData()const { return _hittest; }
 
+        spNativeTexture getBaseTexture() const;
+        spNativeTexture getAlphaTexture() const;
+
         void            setSrcRect(const RectF& r) {_srcRect = r;}
         void            setDestRect(const RectF& r) {_destRect = r;}
         void            setResAnim(ResAnim* rs) {_resAnim = rs;}
         void            setDiffuse(const Diffuse& d) { _diffuse = d; }
+        void            setBaseTexture(spNativeTexture t);
+        void            setAlphaTexture(spNativeTexture t);
         void            setSize(const Vector2& size) {_frameSize = size;}
         void            setSize(float w, float h) { setSize(Vector2(w, h)); }
         void            setHitTestData(const HitTestData& ad) { _hittest = ad; }

+ 52 - 3
oxygine/src/oxygine/Clock.cpp

@@ -41,14 +41,29 @@ namespace oxygine
         return (int)_fixedStep;
     }
 
+    float   Clock::getFixedStepF() const
+    {
+        return _fixedStep / 1000.0f;
+    }
+
+    float   Clock::getLastDTF() const
+    {
+        return (float)(_lastDT / 1000.0f);
+    }
+
     int Clock::getLastDT() const
     {
-        return _lastDT;
+        return (int)_lastDT;
     }
 
     timeMS  Clock::getLastUpdateTime() const
     {
-        return _lastUpdateTime;
+        return (timeMS)_lastUpdateTime;
+    }
+
+    float   Clock::getLastUpdateTimeF() const
+    {
+        return (float)(_lastUpdateTime / 1000.0f);
     }
 
     void Clock::setMultiplier(float m)
@@ -61,6 +76,11 @@ namespace oxygine
         _fixedStep = step;
     }
 
+    void Clock::setFixedStepF(float step)
+    {
+        _fixedStep = step * 1000.0f;
+    }
+
     void Clock::pause()
     {
         _counter += 1;
@@ -102,7 +122,7 @@ namespace oxygine
         _destTime += dt;
 
         _lastUpdateTime = time;
-        _lastDT = static_cast<int>(dt);
+        _lastDT = dt;
 
         //if (_fixedStep > 0)
         //  printf("ticks: %d\n", int((_destTime - _srcTime)/_fixedStep));
@@ -128,16 +148,45 @@ namespace oxygine
         return (timeMS)_fixedStep;
     }
 
+    float   Clock::doTickF()
+    {
+        if (_counter > 0)
+            return 0;
+
+        if (_srcTime + _fixedStep > _destTime)
+            return 0;
+
+        if (_fixedStep == 0)
+        {
+            float dt = (float)(_destTime - _srcTime);
+            _srcTime = _destTime;
+            return dt / 1000.0f;
+        }
+
+        _srcTime += _fixedStep;
+        return _fixedStep / 1000.0f;
+    }
+
     timeMS Clock::getTime() const
     {
         return (timeMS)_srcTime;
     }
 
+    float Clock::getTimeF() const
+    {
+        return (float)(_srcTime / 1000.0f);
+    }
+
     int Clock::getPauseCounter() const
     {
         return _counter;
     }
 
+    bool Clock::isPaused() const
+    {
+        return _counter != 0;
+    }
+
     std::string Clock::dump() const
     {
         std::stringstream stream;

+ 22 - 8
oxygine/src/oxygine/Clock.h

@@ -11,14 +11,27 @@ namespace oxygine
         Clock();
         ~Clock();
 
-        timeMS  getTime() const;
+        timeMS  getTime() const;//deprecated, use F
+        int     getFixedStep() const;//deprecated, use F
+        void    setFixedStep(float stepMS);//deprecated, use F
+        timeMS  doTick();//deprecated, use F
+        timeMS  getLastUpdateTime() const;//deprecated, use F
+        int     getLastDT() const;//deprecated, use F
+
+        /**returns current clock time in seconds*/
+        float   getTimeF() const;
         int     getPauseCounter() const;
-        int     getFixedStep() const;
-        int     getLastDT() const;
-        timeMS  getLastUpdateTime() const;
+        bool    isPaused() const;
+
+        float   getFixedStepF() const;
+        float   getLastDTF() const;
+
+        float   getLastUpdateTimeF() const;
         float   getMultiplier() const;
 
-        void    setFixedStep(float stepMS);
+
+        /**set fixed actor update in seconds*/
+        void    setFixedStepF(float step);
         void    setMultiplier(float m);
 
         void    pause();
@@ -26,7 +39,8 @@ namespace oxygine
         void    resetPause();
 
         void    update(timeMS globalTime = -1);
-        timeMS  doTick();
+
+        float   doTickF();
 
         std::string dump() const;
 
@@ -38,7 +52,7 @@ namespace oxygine
         float   _multiplier;
         float   _fixedStep;
 
-        int    _lastDT;
-        timeMS _lastUpdateTime;
+        double _lastDT;
+        double _lastUpdateTime;
     };
 }

+ 1 - 1
oxygine/src/oxygine/Event.h

@@ -29,7 +29,7 @@ namespace oxygine
             bool   userDataBool;
             void*  userData;
         };
-        
+
         eventType type;
         Phase phase;
         bool bubbles;

+ 1 - 1
oxygine/src/oxygine/Material.h

@@ -107,5 +107,5 @@ namespace oxygine
 
         spSTDMaterial cloneDefaultShader() const;
     };
-    
+
 }

+ 40 - 5
oxygine/src/oxygine/PostProcess.cpp

@@ -14,6 +14,8 @@ namespace oxygine
 {
     ShaderProgram* PostProcess::shaderBlurV = 0;
     ShaderProgram* PostProcess::shaderBlurH = 0;
+    ShaderProgram* PostProcess::shaderBlurV2 = 0;
+    ShaderProgram* PostProcess::shaderBlurH2 = 0;
     ShaderProgram* PostProcess::shaderBlit = 0;
     bool _ppBuilt = false;
 
@@ -38,18 +40,22 @@ namespace oxygine
         file::buffer vs_h;
         file::buffer vs_v;
         file::buffer fs_blur;
+        file::buffer fs_blur2;
         zp.read("system/pp_hblur_vs.glsl", vs_h);
         zp.read("system/pp_vblur_vs.glsl", vs_v);
         zp.read("system/pp_rast_fs.glsl", fs_blur);
+        zp.read("system/pp_rast_fs2.glsl", fs_blur2);
 
         vs_h.push_back(0);
         vs_v.push_back(0);
         fs_blur.push_back(0);
+        fs_blur2.push_back(0);
 
 
         unsigned int h = ShaderProgramGL::createShader(GL_VERTEX_SHADER, (const char*)&vs_h.front());
         unsigned int v = ShaderProgramGL::createShader(GL_VERTEX_SHADER, (const char*)&vs_v.front());
         unsigned int ps = ShaderProgramGL::createShader(GL_FRAGMENT_SHADER, (const char*)&fs_blur.front());
+        unsigned int ps2 = ShaderProgramGL::createShader(GL_FRAGMENT_SHADER, (const char*)&fs_blur2.front());
 
 
         shaderBlurV = new ShaderProgramGL(ShaderProgramGL::createProgram(v, ps, decl));
@@ -61,9 +67,19 @@ namespace oxygine
         driver->setUniformInt("s_texture", 0);
 
 
+        shaderBlurV2 = new ShaderProgramGL(ShaderProgramGL::createProgram(v, ps2, decl));
+        driver->setShaderProgram(shaderBlurV2);
+        driver->setUniformInt("s_texture", 0);
+
+        shaderBlurH2 = new ShaderProgramGL(ShaderProgramGL::createProgram(h, ps2, decl));
+        driver->setShaderProgram(shaderBlurH2);
+        driver->setUniformInt("s_texture", 0);
+
+
         oxglDeleteShader(h);
         oxglDeleteShader(v);
         oxglDeleteShader(ps);
+        oxglDeleteShader(ps2);
 
         file::buffer vs_blit;
         file::buffer fs_blit;
@@ -80,6 +96,8 @@ namespace oxygine
         shaderBlit = new ShaderProgramGL(ShaderProgramGL::createProgram(vs, fs, decl, true));
         driver->setShaderProgram(shaderBlit);
         driver->setUniformInt("s_texture", 0);
+
+        rsCache().resetShader();
     }
 
     void PostProcess::freeShaders()
@@ -92,6 +110,12 @@ namespace oxygine
 
         delete shaderBlurV;
         shaderBlurV = 0;
+
+        delete shaderBlurH2;
+        shaderBlurH = 0;
+
+        delete shaderBlurV2;
+        shaderBlurV = 0;
     }
 
     const int ALIGN_SIZE = 256;
@@ -294,10 +318,17 @@ namespace oxygine
         return _renderingPP;
     }
 
+    int getNumPostProcessItem()
+    {
+        return (int)postProcessItems.size();
+    }
+
     void updatePortProcessItems()
     {
         if (!postProcessItems.empty())
         {
+            rsCache().checkTextures();
+
             _renderingPP = true;
 
             IVideoDriver* driver = IVideoDriver::instance;
@@ -307,7 +338,10 @@ namespace oxygine
 
             ShaderProgram* sp = driver->getShaderProgram();
 
-            for (size_t i = 0; i < postProcessItems.size(); ++i)
+            if (postProcessItems.size() == 2)
+                int q = 0;
+            //for (size_t i = 0; i < postProcessItems.size(); ++i)
+            for (int i = postProcessItems.size() - 1; i >= 0 ; --i)
             {
                 PPTask* p = postProcessItems[i];
                 p->renderPP();
@@ -319,6 +353,7 @@ namespace oxygine
             if (sp)
                 driver->setShaderProgram(sp);
             _renderingPP = false;
+            rsCache().reset();
         }
 
         _rtm.update();
@@ -331,17 +366,17 @@ namespace oxygine
     }
 
 
-    void pass(spNativeTexture srcTexture, const Rect& srcRect, spNativeTexture destTexture, const Rect& destRect, const Color& color)
+    void pass(spNativeTexture srcTexture, const Rect& srcRect, spNativeTexture destTexture, const Rect& destRect, const Color& color, const Color& clearColor)
     {
         IVideoDriver* driver = IVideoDriver::instance;
 
         const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(driver->getVertexDeclaration(vertexPCT2::FORMAT));
         driver->setRenderTarget(destTexture);
-        driver->clear(0);
+        driver->clear(clearColor);
 
         driver->setViewport(destRect);
 
-        driver->setTexture(0, srcTexture);
+        rsCache().setTexture(0, srcTexture);
 
 
         vertexPCT2 v[4];
@@ -355,7 +390,7 @@ namespace oxygine
 
 
         driver->draw(IVideoDriver::PT_TRIANGLE_STRIP, decl, v, sizeof(v));
-        driver->setTexture(0, 0);
+        rsCache().setTexture(0, 0);
     }
 
     PostProcess::PostProcess(const PostProcessOptions& opt) : _options(opt), _format(opt._format), _extend(2, 2)

+ 5 - 1
oxygine/src/oxygine/PostProcess.h

@@ -44,6 +44,9 @@ namespace oxygine
         static ShaderProgram* shaderBlurH;
         static ShaderProgram* shaderBlit;
 
+        static ShaderProgram* shaderBlurV2;
+        static ShaderProgram* shaderBlurH2;
+
         static void initShaders();
         static void freeShaders();
 
@@ -120,7 +123,7 @@ namespace oxygine
         free _free;
     };
 
-    void pass(spNativeTexture srcTexture, const Rect& srcRect, spNativeTexture destTexture, const Rect& destRect, const Color& color = Color::White);
+    void pass(spNativeTexture srcTexture, const Rect& srcRect, spNativeTexture destTexture, const Rect& destRect, const Color& color = Color(Color::White), const Color& clearColor = Color(0));
 
     RenderTargetsManager& getRTManager();
 
@@ -129,4 +132,5 @@ namespace oxygine
     void addPostProcessItem(PPTask*);
     void removePostProcessItem(PPTask*);
     void clearPostProcessItems();
+    int getNumPostProcessItem();
 }

+ 42 - 19
oxygine/src/oxygine/STDRenderer.cpp

@@ -50,11 +50,10 @@ namespace oxygine
     void RenderStateCache::reset()
     {
         resetTextures();
-
+        resetShader();
         _blend = blend_disabled;
         if (_driver)
             _driver->setState(IVideoDriver::STATE_BLEND, 0);
-        _program = 0;
     }
 
     void RenderStateCache::resetTextures()
@@ -63,20 +62,33 @@ namespace oxygine
             _textures[i] = 0;
     }
 
-    void RenderStateCache::setTexture(int sampler, const spNativeTexture& t)
+    void RenderStateCache::resetShader()
     {
-        OX_ASSERT(sampler < MAX_TEXTURES);
+        _program = 0;
+    }
 
+    void RenderStateCache::checkTextures()
+    {
 #ifdef OX_DEBUG
-        if (_textures[sampler] && _driver == IVideoDriver::instance)
+        for (int i = 0; i < MAX_TEXTURES; ++i)
         {
-            GLint whichID;
-            oxglActiveTexture(GL_TEXTURE0 + sampler);
-            glGetIntegerv(GL_TEXTURE_BINDING_2D, &whichID);
+            if (_textures[i] && _driver == IVideoDriver::instance)
+            {
+                GLint whichID;
+                oxglActiveTexture(GL_TEXTURE0 + i);
+                glGetIntegerv(GL_TEXTURE_BINDING_2D, &whichID);
 
-            OX_ASSERT(_textures[sampler]->getHandle() == (nativeTextureHandle)(size_t)whichID);
+                OX_ASSERT(_textures[i]->getHandle() == (nativeTextureHandle)(size_t)whichID);
+            }
         }
 #endif
+    }
+
+    void RenderStateCache::setTexture(int sampler, const spNativeTexture& t)
+    {
+        OX_ASSERT(sampler < MAX_TEXTURES);
+
+        checkTextures();
 
         if (_textures[sampler] == t)
             return;
@@ -112,11 +124,22 @@ namespace oxygine
 
     bool RenderStateCache::setShader(ShaderProgram* prog)
     {
+#ifdef OX_DEBUG
+        if (_program && _driver == IVideoDriver::instance)
+        {
+            GLint whichID;
+            glGetIntegerv(GL_CURRENT_PROGRAM, &whichID);
+
+            OX_ASSERT((size_t)_program->getID() == (size_t)whichID);
+        }
+#endif
+
         if (_program == prog)
             return false;
 
         _program = prog;
-        _driver->setShaderProgram(prog);
+        if (prog)
+            _driver->setShaderProgram(prog);
         return true;
     }
 
@@ -289,7 +312,7 @@ namespace oxygine
 
     void STDRenderer::setShader(ShaderProgram* prog)
     {
-        if (rsCache().setShader(prog))
+        if (rsCache().setShader(prog)) {}
         {
             //_driver->setUniform("mat", _vp);
             shaderProgramChanged();
@@ -398,9 +421,9 @@ namespace oxygine
         checkDrawBatch();
     }
 
-    void STDRenderer::addIndices(const unsigned short *data, unsigned int bufSize)
+    void STDRenderer::addIndices(const unsigned short* data, unsigned int bufSize)
     {
-        const unsigned char *end = (const unsigned char*)data + bufSize;
+        const unsigned char* end = (const unsigned char*)data + bufSize;
         _indicesData.insert(_indicesData.end(), (const unsigned short*)data, (const unsigned short*)end);
     }
 
@@ -529,7 +552,7 @@ namespace oxygine
     }
 
 
-    void STDRenderer::swapIndicesData(std::vector<unsigned short> &data)
+    void STDRenderer::swapIndicesData(std::vector<unsigned short>& data)
     {
         std::swap(data, _indicesData);
     }
@@ -610,8 +633,8 @@ namespace oxygine
                 return;
 
             _driver->draw(IVideoDriver::PT_TRIANGLES, _vdecl,
-                &_verticesData.front(), (unsigned int)_verticesData.size(),
-                &_indicesData.front(), (unsigned int)_indicesData.size());
+                          &_verticesData.front(), (unsigned int)_verticesData.size(),
+                          &_indicesData.front(), (unsigned int)_indicesData.size());
 
             _verticesData.clear();
             _indicesData.clear();
@@ -623,11 +646,11 @@ namespace oxygine
                 return;
 
             _driver->draw(IVideoDriver::PT_TRIANGLES, _vdecl,
-                &_verticesData.front(), (unsigned int)_verticesData.size(),
-                &STDRenderer::indices16.front(), (unsigned int)indices);
+                          &_verticesData.front(), (unsigned int)_verticesData.size(),
+                          &STDRenderer::indices16.front(), (unsigned int)indices);
 
             _verticesData.clear();
-        }        
+        }
     }
 
 

+ 6 - 3
oxygine/src/oxygine/STDRenderer.h

@@ -21,11 +21,14 @@ namespace oxygine
 
         void reset();
         void resetTextures();
+        void resetShader();
+
+        void checkTextures();
 
         void changeDriver(IVideoDriver* d);//used for DebugActor
 
     protected:
-        enum { MAX_TEXTURES = 8 };
+        enum { MAX_TEXTURES = 5 };
 
         spNativeTexture _textures[MAX_TEXTURES];
         ShaderProgram*  _program;
@@ -109,7 +112,7 @@ namespace oxygine
         void flush();
 
         virtual void addVertices(const void* data, unsigned int bufSize);
-        void addIndices(const unsigned short *data, unsigned int bufSize);
+        void addIndices(const unsigned short* data, unsigned int bufSize);
 
         //debug utils
 #ifdef OXYGINE_DEBUG_T2P
@@ -119,7 +122,7 @@ namespace oxygine
         void swapVerticesData(std::vector<unsigned char>& data);
         void swapVerticesData(STDRenderer& r);
 
-        void swapIndicesData(std::vector<unsigned short> &data);
+        void swapIndicesData(std::vector<unsigned short>& data);
 
         OXYGINE_DEPRECATED
         void setViewProjTransform(const Matrix& viewProj);

+ 5 - 4
oxygine/src/oxygine/Serialize.h

@@ -12,10 +12,11 @@ namespace oxygine
     {
     public:
         virtual spActor     create(const char* type) const;
-        virtual Resource*   getResource(const char* id) const {return 0;}
-        virtual ResAnim*    getResAnim(const char* id) const {return safeCast<ResAnim*>(getResource(id));}
-        virtual AnimationFrame getFrame(const char* id, int col, int row) const {ResAnim* rs = getResAnim(id);  if (rs) return rs->getFrame(col, row); return AnimationFrame();}
-        virtual ResFont*    getResFont(const char* id) const {return safeCast<ResFont*>(getResource(id));}
+        virtual const Resource*   getResource(const char* id) const {return 0;}
+        virtual const ResAnim*    getResAnim(const char* id) const {return safeCast<const ResAnim*>(getResource(id));}
+        virtual AnimationFrame getFrame(const char* id, int col, int row) const { const ResAnim* rs = getResAnim(id);  if (rs) return rs->getFrame(col, row); return AnimationFrame();}
+        virtual const ResFont*    getResFont(const char* id) const {return safeCast<const ResFont*>(getResource(id));}
+        virtual bool              getString(const char* id, std::string& result) const { return false; }
     };
 
     struct serializedata

+ 1 - 1
oxygine/src/oxygine/TouchEvent.h

@@ -26,7 +26,7 @@ namespace oxygine
 
         TouchEvent(eventType type, bool Bubbles = true, const Vector2& locPosition = Vector2(0, 0)) : Event(type, Bubbles), localPosition(locPosition), position(locPosition), mouseButton(MouseButton_Touch), pressure(1.0f), index(1), __clickDispatched(false), wheelDirection(0, 0), __localScale(1.0f) {}
 
-        /**position in local space for Event::currentTarget Actor*/
+        /**position in local space for Event::currentTarget Actor (in space for actor with added EventCallback)*/
         Vector2 localPosition;
         /**position in local space for Event::target actor*/
         Vector2 position;

+ 9 - 3
oxygine/src/oxygine/UpdateState.h

@@ -6,14 +6,20 @@ namespace oxygine
     class UpdateState
     {
     public:
-        UpdateState(): time(0), dt(0), iteration(0) {}
+        UpdateState(): time(0), dt(0), iteration(0), dtf(0) {}
 
-        /**local time*/
+        /**local time in  milliseconds*/
         timeMS time;
 
-        /**delta time since last update*/
+        /**local time in  seconds*/
+        float timef;
+
+        /**delta time since last update in milliseconds*/
         timeMS dt;
 
+        /*delta time since last update in seconds*/
+        float dtf;
+
         /**current iteration, used with fixed Clock update */
         int iteration;
     };

+ 6 - 4
oxygine/src/oxygine/actor/Actor.cpp

@@ -1076,15 +1076,17 @@ namespace oxygine
             us.iteration = 0;
             _clock->update();
 
-            timeMS dt = _clock->doTick();
-            while (dt > 0)
+            float dt = _clock->doTickF();
+            while (dt > 0.0f)
             {
-                us.dt = dt;
+                us.dt = (timeMS)(dt * 1000);
+                us.dtf = dt;
                 us.time = _clock->getTime();
+                us.timef = _clock->getTimeF();
 
                 internalUpdate(us);
 
-                dt = _clock->doTick();
+                dt = _clock->doTickF();
                 us.iteration += 1;
             }
         }

+ 2 - 2
oxygine/src/oxygine/actor/Box9Sprite.cpp

@@ -53,14 +53,14 @@ namespace oxygine
 
         RectF rect;
         rect.pos = Vector2(_guideX[0], _guideY[0]);
-        
+
         Vector2 rb;
         rb.x = getWidth() - (_frame.getWidth() - _guideX[1]);
         rb.y = getHeight() - (_frame.getHeight() - _guideY[1]);
 
         rect.setSize(rb - rect.pos);
 
-        return rect;                             
+        return rect;
     }
 
     void Box9Sprite::setVerticalMode(StretchMode m)

+ 0 - 8
oxygine/src/oxygine/actor/Stage.cpp

@@ -127,14 +127,6 @@ namespace oxygine
         return RectF(-getPosition(), s);
     }
 
-    /*
-    bool Stage::handleEvent(const EventState &es)
-    {
-        bool handled = Actor::handleEvent(es);
-        return handled;
-    }
-    */
-
     void Stage::render(const Color* clearColor, const Rect& viewport, const Matrix& view, const Matrix& proj)
     {
 

+ 12 - 2
oxygine/src/oxygine/actor/TextField.cpp

@@ -466,12 +466,22 @@ namespace oxygine
         const char* fnt = node.attribute("font").as_string(0);
         if (fnt && *fnt)
         {
-            ResFont* font = data->factory->getResFont(fnt);
+            const ResFont* font = data->factory->getResFont(fnt);
             if (font)
                 _style.font = font;
         }
 
         needRebuild();
-        setText(node.attribute("text").as_string());
+
+        std::string txt;
+        const char* str = node.attribute("text").as_string();
+        if (data->factory->getString(str, txt))
+        {
+            setHtmlText(txt);
+        }
+        else
+        {
+            setText(str);
+        }
     }
 }

+ 1 - 1
oxygine/src/oxygine/core/Object.cpp

@@ -254,7 +254,7 @@ namespace oxygine
         int cbs = 0;
         if (o && o->_ref_counter)
         {
-            const EventDispatcher *ed = dynamic_cast<const EventDispatcher*>(o);
+            const EventDispatcher* ed = dynamic_cast<const EventDispatcher*>(o);
             if (ed)
                 cbs = ed->getListenersCount();
         }

+ 2 - 0
oxygine/src/oxygine/core/UberShaderProgram.cpp

@@ -3,6 +3,7 @@
 #include "vertex.h"
 #include "gl/ShaderProgramGL.h"
 #include "gl/VideoDriverGLES20.h"
+#include "../STDRenderer.h"
 
 namespace oxygine
 {
@@ -99,6 +100,7 @@ namespace oxygine
 
             s.program = pgl;
 
+            rsCache().resetShader();
 
             CHECKGL();
         }

+ 2 - 2
oxygine/src/oxygine/core/ZipFileSystem.cpp

@@ -11,8 +11,8 @@ namespace oxygine
 {
     namespace file
     {
-       
-        ZipFileSystem::ZipFileSystem() : FileSystem(true) 
+
+        ZipFileSystem::ZipFileSystem() : FileSystem(true)
         {
             _zips = new Zips();
         }

+ 216 - 215
oxygine/src/oxygine/core/Zips.cpp

@@ -10,287 +10,288 @@ namespace oxygine
 {
     namespace file
     {
-    bool sortFiles(const file_entry& ob1, const file_entry& ob2)
-    {
-        return strcmp_cns(ob1.name, ob2.name) < 0;
-    }
+        bool sortFiles(const file_entry& ob1, const file_entry& ob2)
+        {
+            return strcmp_cns(ob1.name, ob2.name) < 0;
+        }
 
-    bool readEntry(const file_entry* entry, file::buffer& bf)
-    {
-        bf.data.clear();
-        int r = unzGoToFilePos(entry->zp, const_cast<unz_file_pos*>(&entry->pos));
-        OX_ASSERT(r == UNZ_OK);
+        bool readEntry(const file_entry* entry, file::buffer& bf)
+        {
+            bf.data.clear();
+            int r = unzGoToFilePos(entry->zp, const_cast<unz_file_pos*>(&entry->pos));
+            OX_ASSERT(r == UNZ_OK);
 
-        unz_file_info file_info;
-        r = unzGetCurrentFileInfo(entry->zp, &file_info, 0, 0, 0, 0, 0, 0);
-        OX_ASSERT(r == UNZ_OK);
+            unz_file_info file_info;
+            r = unzGetCurrentFileInfo(entry->zp, &file_info, 0, 0, 0, 0, 0, 0);
+            OX_ASSERT(r == UNZ_OK);
 
-        unzOpenCurrentFile(entry->zp);
+            unzOpenCurrentFile(entry->zp);
 
-        bf.data.resize(file_info.uncompressed_size);
-        r = unzReadCurrentFile(entry->zp, &bf.data.front(), (int)bf.data.size());
-        OX_ASSERT(r == (int)file_info.uncompressed_size);
+            bf.data.resize(file_info.uncompressed_size);
+            r = unzReadCurrentFile(entry->zp, &bf.data.front(), (int)bf.data.size());
+            OX_ASSERT(r == (int)file_info.uncompressed_size);
 
-        unzCloseCurrentFile(entry->zp);
-        return true;
-    }
-
-    Zips::Zips() : _lock(true)
-    {
+            unzCloseCurrentFile(entry->zp);
+            return true;
+        }
 
-    }
+        Zips::Zips() : _lock(true)
+        {
 
-    Zips::~Zips()
-    {
-        reset();
-    }
+        }
 
-    void Zips::read(unzFile zp)
-    {
-        //MutexAutoLock al(_lock);
+        Zips::~Zips()
+        {
+            reset();
+        }
 
-        do
+        void Zips::read(unzFile zp)
         {
-            unz_file_pos pos;
-            unzGetFilePos(zp, &pos);
+            //MutexAutoLock al(_lock);
 
-            file_entry entry;
-            unzGetCurrentFileInfo(zp, 0, entry.name, sizeof(entry.name) - 1, 0, 0, 0, 0);
-            entry.refs = 0;
-            entry.pos = pos;
-            entry.zp = zp;
+            do
+            {
+                unz_file_pos pos;
+                unzGetFilePos(zp, &pos);
 
-            char* str = entry.name;
-            for (int i = 0; str[i]; i++)
-                str[i] = tolower(str[i]);
+                file_entry entry;
+                unzGetCurrentFileInfo(zp, 0, entry.name, sizeof(entry.name) - 1, 0, 0, 0, 0);
+                entry.refs = 0;
+                entry.pos = pos;
+                entry.zp = zp;
 
+                char* str = entry.name;
+                for (int i = 0; str[i]; i++)
+                    str[i] = tolower(str[i]);
 
-            OX_ASSERT(_files.find(entry.name) == _files.end());
 
-            _files[entry.name] = entry;
+                OX_ASSERT(_files.find(entry.name) == _files.end());
 
-        } while (unzGoToNextFile(zp) != UNZ_END_OF_LIST_OF_FILE);
+                _files[entry.name] = entry;
 
-    }
+            }
+            while (unzGoToNextFile(zp) != UNZ_END_OF_LIST_OF_FILE);
 
-    void Zips::add(const unsigned char* data, unsigned int size)
-    {
-        MutexAutoLock al(_lock);
+        }
 
-        zlib_filefunc_def ff;
-        fill_memory_filefunc(&ff);
+        void Zips::add(const unsigned char* data, unsigned int size)
+        {
+            MutexAutoLock al(_lock);
 
-        zmemdata dta;
-        dta.data = (char*)data;
-        dta.size = size;
+            zlib_filefunc_def ff;
+            fill_memory_filefunc(&ff);
 
-        unzFile zp = unzOpen2((const char*)&dta, &ff);
-        OX_ASSERT(zp);
-        if (!zp)
-            return;
+            zmemdata dta;
+            dta.data = (char*)data;
+            dta.size = size;
 
+            unzFile zp = unzOpen2((const char*)&dta, &ff);
+            OX_ASSERT(zp);
+            if (!zp)
+                return;
 
-        zpitem item;
-        item.handle = zp;
-        _zps.push_back(item);
 
-        read(zp);
-    }
+            zpitem item;
+            item.handle = zp;
+            _zps.push_back(item);
 
-    void Zips::add(std::vector<char>& data)
-    {
-        MutexAutoLock al(_lock);
+            read(zp);
+        }
 
-        zlib_filefunc_def ff;
-        fill_memory_filefunc(&ff);
+        void Zips::add(std::vector<char>& data)
+        {
+            MutexAutoLock al(_lock);
 
-        zmemdata dta;
-        dta.data = (char*)&data.front();
-        dta.size = data.size();
+            zlib_filefunc_def ff;
+            fill_memory_filefunc(&ff);
 
-        unzFile zp = unzOpen2((const char*)&dta, &ff);
-        OX_ASSERT(zp);
-        if (!zp)
-            return;
+            zmemdata dta;
+            dta.data = (char*)&data.front();
+            dta.size = data.size();
 
-        _zps.push_back(zpitem());
-        zpitem& item = _zps.back();
-        item.handle = zp;
-        std::swap(item.data, data);
+            unzFile zp = unzOpen2((const char*)&dta, &ff);
+            OX_ASSERT(zp);
+            if (!zp)
+                return;
 
-        read(zp);
-    }
+            _zps.push_back(zpitem());
+            zpitem& item = _zps.back();
+            item.handle = zp;
+            std::swap(item.data, data);
 
-    voidpf ZCALLBACK ox_fopen(voidpf opaque, const char* filename, int mode)
-    {
-        return file::open(filename, "rb");
-    }
+            read(zp);
+        }
 
-    uLong ZCALLBACK ox_fread(voidpf opaque, voidpf stream, void* buf, uLong size)
-    {
-        return file::read((handle)stream, buf, (unsigned int)size);
-    }
+        voidpf ZCALLBACK ox_fopen(voidpf opaque, const char* filename, int mode)
+        {
+            return file::open(filename, "rb");
+        }
 
-    /*
-    uLong ZCALLBACK ox_fwriteOF(voidpf opaque, voidpf stream, const void* buf, uLong size)
-    {
+        uLong ZCALLBACK ox_fread(voidpf opaque, voidpf stream, void* buf, uLong size)
+        {
+            return file::read((handle)stream, buf, (unsigned int)size);
+        }
 
-    }
-    */
+        /*
+        uLong ZCALLBACK ox_fwriteOF(voidpf opaque, voidpf stream, const void* buf, uLong size)
+        {
 
-    long ZCALLBACK ox_ftell(voidpf opaque, voidpf stream)
-    {
-        return file::tell((handle)stream);
-    }
+        }
+        */
 
-    long ZCALLBACK ox_fseek(voidpf opaque, voidpf stream, uLong offset, int origin)
-    {
-        file::seek((handle)stream, (unsigned int)offset, origin);
-        return 0;
-    }
+        long ZCALLBACK ox_ftell(voidpf opaque, voidpf stream)
+        {
+            return file::tell((handle)stream);
+        }
 
-    int ZCALLBACK ox_fclose(voidpf opaque, voidpf stream)
-    {
-        file::close((handle)stream);
-        return 0;
-    }
+        long ZCALLBACK ox_fseek(voidpf opaque, voidpf stream, uLong offset, int origin)
+        {
+            file::seek((handle)stream, (unsigned int)offset, origin);
+            return 0;
+        }
 
-    int ZCALLBACK ox_ferror(voidpf opaque, voidpf stream)
-    {
-        return 0;
-    }
+        int ZCALLBACK ox_fclose(voidpf opaque, voidpf stream)
+        {
+            file::close((handle)stream);
+            return 0;
+        }
 
-    void Zips::remove(const char* name)
-    {
-        MutexAutoLock al(_lock);
+        int ZCALLBACK ox_ferror(voidpf opaque, voidpf stream)
+        {
+            return 0;
+        }
 
-        for (size_t i = 0; i < _zps.size(); ++i)
+        void Zips::remove(const char* name)
         {
-            zpitem& item = _zps[i];
-            if (!strcmp(item.name, name))
+            MutexAutoLock al(_lock);
+
+            for (size_t i = 0; i < _zps.size(); ++i)
             {
-                for (files::iterator it = _files.begin(); it != _files.end();)
+                zpitem& item = _zps[i];
+                if (!strcmp(item.name, name))
                 {
-                    file_entry& entry = it->second;
-                    if (entry.zp == item.handle)
+                    for (files::iterator it = _files.begin(); it != _files.end();)
                     {
-                        OX_ASSERT(entry.refs == 0);
-                        it = _files.erase(it);
+                        file_entry& entry = it->second;
+                        if (entry.zp == item.handle)
+                        {
+                            OX_ASSERT(entry.refs == 0);
+                            it = _files.erase(it);
+                        }
+                        else
+                            ++it;
                     }
-                    else
-                        ++it;
-                }
 
-                unzClose(item.handle);
+                    unzClose(item.handle);
 
-                _zps.erase(_zps.begin() + i);
-                break;
+                    _zps.erase(_zps.begin() + i);
+                    break;
+                }
             }
         }
-    }
-
-    void Zips::add(const char* name)
-    {
-        MutexAutoLock al(_lock);
-
-        zlib_filefunc_def zpfs;
-        memset(&zpfs, 0, sizeof(zpfs));
-
-        zpfs.zopen_file = ox_fopen;
-        zpfs.zread_file = ox_fread;
-        zpfs.zwrite_file = 0;
-        zpfs.ztell_file = ox_ftell;
-        zpfs.zseek_file = ox_fseek;
-        zpfs.zclose_file = ox_fclose;
-        zpfs.zerror_file = ox_ferror;
-        zpfs.opaque = (void*)_zps.size();
-        //zpfs.opaque = name;
-
-        unzFile zp = unzOpen2(name, &zpfs);//todo, optimize search in zip
-        OX_ASSERT(zp);
-        if (!zp)
-            return;
-
-        zpitem item;
-        item.handle = zp;
-        strcpy(item.name, name);
-        _zps.push_back(item);
-
-        read(zp);
-    }
 
-    bool Zips::isExists(const char* name)
-    {
-        MutexAutoLock al(_lock);
-        return getEntryByName(name) != 0;
-    }
+        void Zips::add(const char* name)
+        {
+            MutexAutoLock al(_lock);
+
+            zlib_filefunc_def zpfs;
+            memset(&zpfs, 0, sizeof(zpfs));
+
+            zpfs.zopen_file = ox_fopen;
+            zpfs.zread_file = ox_fread;
+            zpfs.zwrite_file = 0;
+            zpfs.ztell_file = ox_ftell;
+            zpfs.zseek_file = ox_fseek;
+            zpfs.zclose_file = ox_fclose;
+            zpfs.zerror_file = ox_ferror;
+            zpfs.opaque = (void*)_zps.size();
+            //zpfs.opaque = name;
+
+            unzFile zp = unzOpen2(name, &zpfs);//todo, optimize search in zip
+            OX_ASSERT(zp);
+            if (!zp)
+                return;
+
+            zpitem item;
+            item.handle = zp;
+            strcpy(item.name, name);
+            _zps.push_back(item);
+
+            read(zp);
+        }
 
-    bool Zips::read(const char* name, file::buffer& bf)
-    {
-        MutexAutoLock al(_lock);
+        bool Zips::isExists(const char* name)
+        {
+            MutexAutoLock al(_lock);
+            return getEntryByName(name) != 0;
+        }
 
-        const file_entry* entry = getEntryByName(name);
-        if (!entry)
-            return false;
-        return readEntry(entry, bf);
-    }
+        bool Zips::read(const char* name, file::buffer& bf)
+        {
+            MutexAutoLock al(_lock);
 
-    bool Zips::read(const file_entry* entry, file::buffer& bf)
-    {
-        MutexAutoLock al(_lock);
-        return readEntry(entry, bf);
-    }
+            const file_entry* entry = getEntryByName(name);
+            if (!entry)
+                return false;
+            return readEntry(entry, bf);
+        }
 
-    void Zips::reset()
-    {
-        MutexAutoLock al(_lock);
-        for (zips::iterator i = _zps.begin(); i != _zps.end(); ++i)
+        bool Zips::read(const file_entry* entry, file::buffer& bf)
         {
-            zpitem& f = *i;
-            unzClose(f.handle);
+            MutexAutoLock al(_lock);
+            return readEntry(entry, bf);
         }
 
+        void Zips::reset()
+        {
+            MutexAutoLock al(_lock);
+            for (zips::iterator i = _zps.begin(); i != _zps.end(); ++i)
+            {
+                zpitem& f = *i;
+                unzClose(f.handle);
+            }
+
 
 #ifdef OX_DEBUG
-        for (files::iterator i = _files.begin(); i != _files.end(); ++i)
-        {
-            OX_ASSERT(i->second.refs == 0);
-        }
+            for (files::iterator i = _files.begin(); i != _files.end(); ++i)
+            {
+                OX_ASSERT(i->second.refs == 0);
+            }
 
 #endif
-        _zps.clear();
-        _files.clear();
-    }
+            _zps.clear();
+            _files.clear();
+        }
 
-    file_entry* Zips::getEntryByName(const char* name)
-    {
-        char str[255];
-        char* p = str;
-        while (*name)
+        file_entry* Zips::getEntryByName(const char* name)
         {
-            *p = tolower(*name);
-            name++;
-            ++p;
-        }
-        *p = 0;
+            char str[255];
+            char* p = str;
+            while (*name)
+            {
+                *p = tolower(*name);
+                name++;
+                ++p;
+            }
+            *p = 0;
 
-        files::iterator it = _files.find(str);
-        if (it != _files.end())
-            return &it->second;
+            files::iterator it = _files.find(str);
+            if (it != _files.end())
+                return &it->second;
 
-        return 0;
-    }
+            return 0;
+        }
 
-    /*
-    const file_entry* Zips::getEntry(int index)
-    {
-    return &_files[index];
-    }
+        /*
+        const file_entry* Zips::getEntry(int index)
+        {
+        return &_files[index];
+        }
 
-    size_t Zips::getNumEntries() const
-    {
-    return _files.size();
+        size_t Zips::getNumEntries() const
+        {
+        return _files.size();
+        }
+        */
     }
-    */
-     }
 }

+ 40 - 40
oxygine/src/oxygine/core/Zips.h

@@ -12,56 +12,56 @@ namespace oxygine
 {
     namespace file
     {
-    struct file_entry
-    {
-        unzFile zp;
-        char name[128];
-        unz_file_pos pos;
-        int refs;
-    };
+        struct file_entry
+        {
+            unzFile zp;
+            char name[128];
+            unz_file_pos pos;
+            int refs;
+        };
 
-    class Zips
-    {
-    public:
-        Zips();
-        ~Zips();
+        class Zips
+        {
+        public:
+            Zips();
+            ~Zips();
 
-        void reset();
+            void reset();
 
-        void add(const char* name);
-        void add(const unsigned char* data, unsigned int size);
-        void add(std::vector<char>& data);
-        void remove(const char* name);
+            void add(const char* name);
+            void add(const unsigned char* data, unsigned int size);
+            void add(std::vector<char>& data);
+            void remove(const char* name);
 
-        bool read(const char* name, file::buffer& bf);
-        bool read(const file_entry* entry, file::buffer& bf);
-        bool isExists(const char* name);
+            bool read(const char* name, file::buffer& bf);
+            bool read(const file_entry* entry, file::buffer& bf);
+            bool isExists(const char* name);
 
-        file_entry*         getEntryByName(const char* name);
-        const char*         getZipFileName(int i) const { return _zps[i].name; }
-        Mutex&              getMutex() { return _lock; }
+            file_entry*         getEntryByName(const char* name);
+            const char*         getZipFileName(int i) const { return _zps[i].name; }
+            Mutex&              getMutex() { return _lock; }
 
-    private:
-        friend class ZipFileSystem;
-        void read(unzFile zp);
+        private:
+            friend class ZipFileSystem;
+            void read(unzFile zp);
 
-        typedef std::unordered_map<std::string, file_entry> files;
-        files _files;
+            typedef std::unordered_map<std::string, file_entry> files;
+            files _files;
 
-        struct zpitem
-        {
-            unzFile handle;
-            std::vector<char> data;
-            char name[255];
+            struct zpitem
+            {
+                unzFile handle;
+                std::vector<char> data;
+                char name[255];
 
-            zpitem() : handle(0) { name[0] = 0; }
-        };
-        typedef std::vector<zpitem> zips;
-        zips _zps;
+                zpitem() : handle(0) { name[0] = 0; }
+            };
+            typedef std::vector<zpitem> zips;
+            zips _zps;
 
-        Mutex _lock;
-    };
+            Mutex _lock;
+        };
 
-    bool read(file_entry* entry, file::buffer& bf);
+        bool read(file_entry* entry, file::buffer& bf);
     }
 }

+ 4 - 3
oxygine/src/oxygine/core/oxygine.cpp

@@ -435,7 +435,8 @@ namespace oxygine
             Resources::registerResourceType(ResStarlingAtlas::create, "starling");
 
             STDRenderer::instance = new STDRenderer;
-            STDRenderDelegate::instance = new STDRenderDelegate;
+            if (!STDRenderDelegate::instance)
+                STDRenderDelegate::instance = new STDRenderDelegate;
             Material::null       = new NullMaterialX;
             Material::current = Material::null;
 
@@ -752,7 +753,7 @@ namespace oxygine
 #ifndef OXYGINE_EDITOR
             key::update();
 #endif
-            
+
             Point ds = getDisplaySize();
             //logs::messageln("SDL_GL_GetDrawableSize: %d %d", ds.x, ds.y);
 
@@ -914,7 +915,7 @@ namespace oxygine
         {
             case ep_show_error:
                 logs::error_va(format, args);
-                 OX_ASSERT_NL(!"handleErrorPolicy error.");
+                OX_ASSERT_NL(!"handleErrorPolicy error.");
                 break;
             case ep_show_warning:
                 logs::warning_va(format, args);

File diff suppressed because it is too large
+ 0 - 1
oxygine/src/oxygine/core/system_data.cpp


+ 0 - 1
oxygine/src/oxygine/dev_tools/TreeInspectorPreview.h

@@ -116,7 +116,6 @@ namespace oxygine
     private:
         void doUpdate(const UpdateState& us) override;
         friend class TreeInspector;
-        //bool _onEvent(const EventState &es);
 
         Vector2 render2cache(spActor item, const Vector2& size,  bool child);
 

+ 0 - 2
oxygine/src/oxygine/oxygine-forwards.h

@@ -82,7 +82,6 @@ namespace oxygine
     DECLARE_SMART(Object, spObject);
     DECLARE_SMART(Polygon, spPolygon);
     DECLARE_SMART(ProgressBar, spProgressBar);
-    DECLARE_SMART(RenderTexture, spRenderTexture);
     DECLARE_SMART(ResAnim, spResAnim);
     DECLARE_SMART(ResBuffer, spResBuffer);
     DECLARE_SMART(ResFont, spResFont);
@@ -107,7 +106,6 @@ namespace oxygine
     class CreateResourceContext;
     class DebugActor;
     class Event;
-    class EventState;
     class Font;
     class IVideoDriver;
     class Image;

+ 31 - 10
oxygine/src/oxygine/tween/Tween.cpp

@@ -30,10 +30,13 @@ namespace oxygine
     void Tween::init(timeMS duration, int loops, bool twoSides, timeMS delay, EASE ease)
     {
         _duration = duration;
+        _durationF = duration / 1000.0f;
+        _delay  = delay;
+        _delayF = delay / 1000.0f;
+
         _ease = ease;
         _loops = loops;
         _twoSides = twoSides;
-        _delay = delay;
 
         if (_duration <= 0)
         {
@@ -45,10 +48,13 @@ namespace oxygine
 	void Tween::init2(const TweenOptions& opt)
 	{
 		_duration = opt._duration;
+        _durationF = opt._duration / 1000.0f;
+        _delay = opt._delay;
+        _delayF = opt._delay / 1000.0f;
+
 		_ease = opt._ease;
 		_loops = opt._loops;
-		_twoSides = opt._twoSides;
-		_delay = opt._delay;
+		_twoSides = opt._twoSides;		
 		_detach = opt._detach;
 		_globalEase = opt._globalEase;
 		_cbDone = opt._callback;
@@ -72,6 +78,18 @@ namespace oxygine
 
 
 
+    void Tween::setDelay(timeMS delay)
+    {
+        _delay = delay;
+        _delayF = delay / 1000.0f;
+    }
+
+    void Tween::setDuration(timeMS duration)
+    {
+        _duration = duration;
+        _durationF = duration / 1000.0f;
+    }
+
     float Tween::_calcEase(float v)
     {
         if (_twoSides)
@@ -119,6 +137,9 @@ namespace oxygine
         {
             UpdateState us;
             us.dt = deltaTime;
+            us.dtf = deltaTime / 1000.0f;
+            us.time = deltaTime;
+            us.timef = deltaTime / 1000.0f;
 
             update(*_client, us);
         }
@@ -141,12 +162,12 @@ namespace oxygine
 
     void Tween::update(Actor& actor, const UpdateState& us)
     {
-        _elapsed += us.dt;
+        _elapsed += us.dtf;
         switch (_status)
         {
             case status_delayed:
             {
-                if (_elapsed >= _delay)
+                if (_elapsed >= _delayF)
                 {
                     _status = status_started;
                     _start(*_client);
@@ -157,17 +178,17 @@ namespace oxygine
             {
                 if (_duration)
                 {
-                    timeMS localElapsed = _elapsed - _delay;
+                    float localElapsed = _elapsed - _delayF;
 					
 					if (_globalEase != ease_linear)
 					{
-						float p = localElapsed / float(_duration * _loops);						
-						timeMS nv = static_cast<timeMS>(calcEase(_globalEase, std::min(p, 1.0f)) * _duration * _loops);
+						float p = localElapsed / (float(_durationF * _loops));
+						float nv = calcEase(_globalEase, std::min(p, 1.0f)) * _durationF * _loops;
 						localElapsed = nv;
 					}
 
-					int loopsDone = localElapsed / _duration;					
-					_percent = _calcEase(((float)(localElapsed - loopsDone * _duration)) / _duration);
+					int loopsDone = (int)(localElapsed / _durationF);
+					_percent = _calcEase(((float)(localElapsed - loopsDone * _durationF)) / _durationF);
 
 					while(_loopsDone < loopsDone)
 					{

+ 10 - 4
oxygine/src/oxygine/tween/Tween.h

@@ -100,7 +100,8 @@ namespace oxygine
 
         int                     getLoops() const { return _loops; }
         timeMS                  getDuration() const { return _duration; }
-        timeMS                  getElapsed() const { return _elapsed; }
+        timeMS                  getElapsed() const { return timeMS(_elapsed * 1000); }
+        float                   getElapsedF() const { return _elapsed; }
         EASE                    getEase() const { return _ease; }
         EASE                    getGlobalEase() const { return _globalEase; }
         timeMS                  getDelay() const { return _delay; }
@@ -124,11 +125,11 @@ namespace oxygine
         /**set Global Easing function */
         void setGlobalEase(EASE ease) { _globalEase = ease; }
         /**set Delay before starting tween*/
-        void setDelay(timeMS delay) { _delay = delay; }
+        void setDelay(timeMS delay);
         /** loops = -1 means infinity repeat cycles*/
         void setLoops(int loops) { _loops = loops; }
         /*set Duration of tween**/
-        void setDuration(timeMS duration) { _duration = duration; }
+        void setDuration(timeMS duration);
         void setClient(Actor* client) { _client = client; }
         void setTwoSides(bool ts) { _twoSides = ts; }
 
@@ -173,10 +174,15 @@ namespace oxygine
             status_remove,
         };
         status _status;
-        timeMS _elapsed;
+        float _elapsed;
 
         timeMS _duration;
         timeMS _delay;
+
+        float _durationF;
+        float _delayF;
+
+
         int _loops;
         int _loopsDone;
         EASE _ease;

+ 2 - 2
oxygine/src/oxygine/tween/TweenAlphaFade.cpp

@@ -34,8 +34,8 @@ namespace oxygine
             renderer->setTransform(tr);
 
 
-            Color color = Color(Color::White).withAlpha(_a).premultiplied();
-            renderer->addQuad(color.rgba(), src, dest);
+            Color color = Color(Color::White).withAlpha(_a);
+            renderer->addQuad(color, src, dest);
         }
 
         bool _fadeIn;

+ 1 - 1
oxygine/src/oxygine/tween/TweenOutline.cpp

@@ -43,7 +43,7 @@ namespace oxygine
 
 
             Color color = Color(Color::White).withAlpha(255).premultiplied();
-            renderer->addQuad(color.rgba(), src, dest);
+            renderer->addQuad(color, src, dest);
 
 
             RenderState r = rs;

+ 2 - 1
oxygine/src/oxygine/tween/TweenQueue.cpp

@@ -71,6 +71,7 @@ namespace oxygine
 
         UpdateState us;
         us.dt = deltaTime;
+        us.dtf = deltaTime / 1000.0f;
         while (_status != status_done)
         {
             update(*_client, us);
@@ -91,7 +92,7 @@ namespace oxygine
 
     void TweenQueue::_update(Actor& actor, const UpdateState& us)
     {
-        _elapsed += us.dt;
+        _elapsed += us.dtf;
 
         if (_current)
         {

+ 44 - 0
oxygine/system_data/original/system/pp_rast_fs2.glsl

@@ -0,0 +1,44 @@
+/* BlurFragmentShader.glsl */
+//precision mediump float;
+ 
+uniform lowp sampler2D s_texture;
+ 
+varying mediump vec4 v_color;
+varying mediump vec2 v_texCoord;
+varying mediump vec2 v_blurTexCoords0;
+varying mediump vec2 v_blurTexCoords1;
+varying mediump vec2 v_blurTexCoords2;
+varying mediump vec2 v_blurTexCoords3;
+varying mediump vec2 v_blurTexCoords4;
+varying mediump vec2 v_blurTexCoords5;
+varying mediump vec2 v_blurTexCoords6;
+varying mediump vec2 v_blurTexCoords7;
+varying mediump vec2 v_blurTexCoords8;
+varying mediump vec2 v_blurTexCoords9;
+varying mediump vec2 v_blurTexCoords10;
+varying mediump vec2 v_blurTexCoords11;
+varying mediump vec2 v_blurTexCoords12;
+varying mediump vec2 v_blurTexCoords13;
+ 
+ 
+ 
+void main()
+{
+    const mediump float M = 1.0;
+    gl_FragColor = vec4(0.0);
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords0)*0.0044299121055113265 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords1)*0.00895781211794 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords2)*0.0215963866053 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords3)*0.0443683338718 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords4)*0.0776744219933 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords5)*0.115876621105 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords6)*0.147308056121 * M;
+    gl_FragColor += texture2D(s_texture, v_texCoord      )*0.159576912161 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords7)*0.147308056121 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords8)*0.115876621105 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords9)*0.0776744219933 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords10)*0.0443683338718 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords11)*0.0215963866053 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords12)*0.00895781211794 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords13)*0.0044299121055113265 * M;
+}

+ 13 - 0
oxygine/system_data/original/system/shader.glsl

@@ -3,13 +3,17 @@ varying lowp vec4 result_color;
 varying mediump vec2 result_uv;
 varying mediump vec2 result_uv2;
 
+
 #ifdef VS
 uniform highp mat4 mat;
 uniform mediump vec3 msk[4];
 attribute vec3 position;
 attribute vec4 color;
 attribute vec2 uv;
+
+#ifdef SAMPLER_UV2
 attribute vec2 uv2;
+#endif
 
 void program_main_vs()
 {
@@ -17,6 +21,7 @@ void program_main_vs()
 
 	result_color = color;
 	result_uv = uv;
+
 #ifdef MASK
 	mediump float a = dot(msk[0], vec3(1.0, position.x, position.y));
 	mediump float b = dot(msk[1], vec3(1.0, position.x, position.y));
@@ -24,6 +29,10 @@ void program_main_vs()
 	result_uv2.x = dot(msk[2], vec3(1.0, a, b));
 	result_uv2.y = dot(msk[3], vec3(1.0, a, b));
 #endif
+
+#ifdef SAMPLER_UV2
+	 result_uv2 = uv2;
+#endif
 }
 
 #endif
@@ -50,6 +59,10 @@ lowp vec4 get_base()
 	base.a = texture2D(alpha_texture, result_uv).r;	
 #endif
 
+#ifdef SEPARATE_ALPHA_UV2
+	base.a = base.a * texture2D(alpha_texture, result_uv2).a;	
+#endif
+
 #ifdef MODIFY_BASE_PRE
 	//define MODIFY_BASE_PRE and declare your own function modify_base_pre	
 	base = modify_base_pre(base);

Some files were not shown because too many files changed in this diff