Răsfoiți Sursa

- added EVENT_EXIT dispatched when oxygine releasing
- fixed blend mode serealization

dmuratshin 9 ani în urmă
părinte
comite
0d27c42fa3

+ 0 - 2
oxygine/src/Sprite.cpp

@@ -288,7 +288,5 @@ namespace oxygine
         }
         }
 
 
         setFlipped(node.attribute("flipX").as_bool(false), node.attribute("flipY").as_bool(false));
         setFlipped(node.attribute("flipX").as_bool(false), node.attribute("flipY").as_bool(false));
-
-        setBlendMode(blend_premultiplied_alpha);
     }
     }
 }
 }

+ 3 - 2
oxygine/src/VisualStyle.cpp

@@ -55,8 +55,8 @@ namespace oxygine
         _Actor::serialize(data);
         _Actor::serialize(data);
         if (_vstyle.getColor() != Color(0xffffffff))
         if (_vstyle.getColor() != Color(0xffffffff))
             data->node.append_attribute("color").set_value(color2hex(_vstyle.getColor()).c_str());
             data->node.append_attribute("color").set_value(color2hex(_vstyle.getColor()).c_str());
-        //if (_vstyle.getBlendMode() != )
-        //data->node.append_attribute("blend").set_value(color2hex(_vstyle.getColor()).c_str());
+        if (_vstyle.getBlendMode() != blend_premultiplied_alpha)
+            data->node.append_attribute("blend").set_value(_vstyle.getBlendMode());
 
 
         data->node.set_name("VStyleActor");
         data->node.set_name("VStyleActor");
     }
     }
@@ -65,6 +65,7 @@ namespace oxygine
     {
     {
         _Actor::deserialize(data);
         _Actor::deserialize(data);
         setColor(hex2color(data->node.attribute("color").as_string("ffffffff")));
         setColor(hex2color(data->node.attribute("color").as_string("ffffffff")));
+        setBlendMode((blend_mode)(data->node.attribute("blend").as_int(blend_premultiplied_alpha)));
     }
     }
 
 
     const Color& VStyleActor::getColor() const
     const Color& VStyleActor::getColor() const

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

@@ -756,6 +756,9 @@ namespace oxygine
 
 
         void release()
         void release()
         {
         {
+            Event ev(EVENT_EXIT);
+            _dispatcher->dispatchEvent(&ev);
+
             Material::setCurrent(0);
             Material::setCurrent(0);
             STDRenderer::release();
             STDRenderer::release();
             delete STDMaterial::instance;
             delete STDMaterial::instance;

+ 1 - 0
oxygine/src/core/oxygine.h

@@ -118,6 +118,7 @@ namespace oxygine
         {
         {
             EVENT_SYSTEM = sysEventID('c', 'S', 'y'), //events from SDL
             EVENT_SYSTEM = sysEventID('c', 'S', 'y'), //events from SDL
             EVENT_PRECREATEWINDOW = sysEventID('c', 'P', 'W'),//dispatched before creating window/context
             EVENT_PRECREATEWINDOW = sysEventID('c', 'P', 'W'),//dispatched before creating window/context
+            EVENT_EXIT = sysEventID('c', 'E', 'x'), //dispatched from core::release
         };
         };
 
 
         spEventDispatcher getDispatcher();
         spEventDispatcher getDispatcher();