public override void OnViewportSizeChanged() { base.OnViewportSizeChanged(); m_CurViewOffset = ParentViewport.GetRateLocation(false, m_BaseTrans.RateLocation); m_CurScaledImageSize = ParentViewport.GetRateSize(false, m_BaseTrans.RateSize); Scale(m_CurScaleProportion.X, m_CurScaleProportion.Y, m_fZoomScale); }
public override void LoadFromXmlElement(System.Xml.XmlElement node) { base.LoadFromXmlElement(node); float fZoomScale; if (!float.TryParse(node.GetAttribute("ZoomScale"), out fZoomScale)) { fZoomScale = 1; } m_CurViewOffset = ParentViewport.GetRateLocation(false, m_BaseTrans.RateLocation); m_CurScaledImageSize = ParentViewport.GetRateSize(false, m_BaseTrans.RateSize); CurZoomScale = fZoomScale; }
public override void Update(float elapsedTime, ref float curViewportTime) { base.Update(elapsedTime, ref curViewportTime); elapsedTime *= SpeedRate; Color clr = new Color(BlendColor.R, BlendColor.G, BlendColor.B, (byte)(m_BlendedTransInfo.Alpha * 255.0F)); var pos = ParentViewport.GetRateLocation(IsBasedOnBackImageElement, m_BlendedTransInfo.RateLocation); var size = ParentViewport.GetRateSize(IsBasedOnBackImageElement, m_BlendedTransInfo.RateSize); pos.X -= size.Width * Barycenter.X; pos.Y -= size.Height * Barycenter.Y; m_Vectors[0].Color = clr; m_Vectors[0].Position = new Vector3(pos.X, pos.Y, 0); m_Vectors[1].Color = clr; m_Vectors[1].Position = new Vector3(pos.X + size.Width, pos.Y, 0); m_Vectors[2].Color = clr; m_Vectors[2].Position = new Vector3(pos.X + size.Width, pos.Y + size.Height, 0); m_Vectors[3].Color = clr; m_Vectors[3].Position = new Vector3(pos.X, pos.Y + size.Height, 0); m_Vectors[0].TextureCoordinate = new Vector2(0, 0); m_Vectors[1].TextureCoordinate = new Vector2(1, 0); m_Vectors[2].TextureCoordinate = new Vector2(1, 1); m_Vectors[3].TextureCoordinate = new Vector2(0, 1); UpdateTextureCoordinates(); if (m_BlendedTransInfo.Angle != 0) { float angle = m_BlendedTransInfo.Angle / 180.0F * (float)Math.PI; for (int i = 0; i < 4; ++i) { var bbl = BlendedBaryLocation; var cen = new Vector3(bbl.X, bbl.Y, 0); var mat = Matrix.CreateTranslation(cen * -1) * Matrix.CreateRotationZ(angle) * Matrix.CreateTranslation(cen); m_Vectors[i].Position = Vector3.Transform(m_Vectors[i].Position, mat); } } if (Resource != null) { if (DsVideo == null) { DsVideo = new DSVideoPlayer(Resource.FullFilePath, ProjectDoc.Instance.HostGame.GraphicsDevice); } if (DsVideo.CurrentState == VideoState.Stopped) { DsVideo.Play(); } DsVideo.Update(); } }
public override void Update(float elapsedTime, ref float curViewportTime) { base.Update(elapsedTime, ref curViewportTime); elapsedTime *= SpeedRate; Color clr = new Color(BlendColor.R, BlendColor.G, BlendColor.B, (byte)(m_BlendedTransInfo.Alpha * 255.0F)); var pos = ParentViewport.GetRateLocation(IsBasedOnBackImageElement, m_BlendedTransInfo.RateLocation); var size = ParentViewport.GetRateSize(IsBasedOnBackImageElement, m_BlendedTransInfo.RateSize); pos.X -= size.Width * Barycenter.X; pos.Y -= size.Height * Barycenter.Y; m_Vectors[0].Color = clr; m_Vectors[0].Position = new Vector3(pos.X, pos.Y, 0); m_Vectors[1].Color = clr; m_Vectors[1].Position = new Vector3(pos.X + size.Width, pos.Y, 0); m_Vectors[2].Color = clr; m_Vectors[2].Position = new Vector3(pos.X + size.Width, pos.Y + size.Height, 0); m_Vectors[3].Color = clr; m_Vectors[3].Position = new Vector3(pos.X, pos.Y + size.Height, 0); m_Vectors[0].TextureCoordinate = new Vector2(0, 0); m_Vectors[1].TextureCoordinate = new Vector2(1, 0); m_Vectors[2].TextureCoordinate = new Vector2(1, 1); m_Vectors[3].TextureCoordinate = new Vector2(0, 1); UpdateTextureCoordinates(); if (m_BlendedTransInfo.Angle != 0) { float angle = m_BlendedTransInfo.Angle / 180.0F * (float)Math.PI; for (int i = 0; i < 4; ++i) { var bbl = BlendedBaryLocation; var cen = new Vector3(bbl.X, bbl.Y, 0); var mat = Matrix.CreateTranslation(cen * -1) * Matrix.CreateRotationZ(angle) * Matrix.CreateTranslation(cen); m_Vectors[i].Position = Vector3.Transform(m_Vectors[i].Position, mat); } } }