@@ -36,16 +36,34 @@ void RenderedTarget::loadProperties()
3636 m_visible = sprite->visible ();
3737
3838 if (m_visible) {
39+ // Direction
40+ switch (sprite->rotationStyle ()) {
41+ case Sprite::RotationStyle::AllAround:
42+ m_rotation = sprite->direction () - 90 ;
43+ m_newMirrorHorizontally = false ;
44+
45+ break ;
46+
47+ case Sprite::RotationStyle::LeftRight: {
48+ m_rotation = 0 ;
49+ m_newMirrorHorizontally = (sprite->direction () < 0 );
50+
51+ break ;
52+ }
53+
54+ case Sprite::RotationStyle::DoNotRotate:
55+ m_rotation = 0 ;
56+ m_newMirrorHorizontally = false ;
57+ break ;
58+ }
59+
3960 // Coordinates
4061 double size = sprite->size () / 100 ;
41- m_x = m_engine->stageWidth () / 2 + sprite->x () - m_costume->rotationCenterX () * size / 2 ;
62+ m_x = m_engine->stageWidth () / 2 + sprite->x () - m_costume->rotationCenterX () * size / 2 * (m_newMirrorHorizontally ? - 1 : 1 ) ;
4263 m_y = m_engine->stageHeight () / 2 - sprite->y () - m_costume->rotationCenterY () * size / 2 ;
4364 m_originX = m_costume->rotationCenterX () * size / 2.0 ;
4465 m_originY = m_costume->rotationCenterY () * size / 2.0 ;
4566
46- // Direction
47- m_rotation = sprite->direction () - 90 ;
48-
4967 // Layer
5068 m_z = sprite->layerOrder ();
5169 }
@@ -102,6 +120,11 @@ void RenderedTarget::updateProperties()
102120 setRotation (m_rotation);
103121 setTransformOriginPoint (QPointF (m_originX, m_originY));
104122
123+ if (m_newMirrorHorizontally != m_mirrorHorizontally) {
124+ m_mirrorHorizontally = m_newMirrorHorizontally;
125+ emit mirrorHorizontallyChanged ();
126+ }
127+
105128 if (m_imageChanged) {
106129 update ();
107130 m_imageChanged = false ;
@@ -199,3 +222,8 @@ const QString &RenderedTarget::bitmapUniqueKey() const
199222{
200223 return m_bitmapUniqueKey;
201224}
225+
226+ bool RenderedTarget::mirrorHorizontally () const
227+ {
228+ return m_mirrorHorizontally;
229+ }
0 commit comments