internal void Render(CustomSpriteBatch sb) { System.Drawing.Bitmap bmp = Resources.Light; if (Variation == 1) { bmp = Resources.Light2; } sb.Draw(ContentRegister.BitmapToTexture(bmp, "Resource_Light" + Variation), new RotRect(Position + Offset, new Vector2(Falloff)) { anchorInCenter = true }, Color); if (Dynamic) { if (DynamicDebug) { } } }
public Vector2 Render(GameTime gameTime, Vector2 vPos, Vector2 vSize, AnimationState state, float fRotation, float fOverX, float fOverY, Color color, float fDepth) { Animation pAnim = this; if (ani_pAliasOwner != null) { pAnim = ani_pAliasOwner; } CustomSpriteBatch rend = pAnim.ani_pSheet.ans_pSpriteBatch; Texture2D tex = pAnim.ani_pSheet.ans_pTexture; if (state.iCurrentFrame >= pAnim.ani_saFrames.Count) { state.Reset(); } AnimationFrame frame = pAnim.ani_saFrames[state.iCurrentFrame]; RotRect rectDest = new RotRect(); rectDest.width = vSize.X; rectDest.height = vSize.Y; float fOffsetX = pAnim.ani_rectOffset.X; float fOffsetY = pAnim.ani_rectOffset.Y; float fWidth = pAnim.ani_rectOffset.Width; if (fWidth == 0) { fWidth = vSize.X; } if (ani_bFlipH) { fOffsetX -= ((fOffsetX - rectDest.width / 2) * 2) + fWidth; } float fHeight = pAnim.ani_rectOffset.Height; if (fHeight == 0) { fHeight = vSize.Y; } if (ani_bFlipV) { fOffsetY -= ((fOffsetY - rectDest.height / 2) * 2) + fHeight; } rectDest.x = vPos.X - fOffsetX; rectDest.y = vPos.Y - fOffsetY; Rectangle rectSrc = new Rectangle(); rectSrc.X = (int)frame.anf_vOffset.X; rectSrc.Y = (int)frame.anf_vOffset.Y; rectSrc.Width = (int)pAnim.ani_vSize.X; rectSrc.Height = (int)pAnim.ani_vSize.Y; if (fOverX != 0) { rectDest.width = fOverX; } if (fOverY != 0) { rectDest.height = fOverY; } rend.CurrentDepth = fDepth; rend.Draw(tex, rectSrc, rectDest, color, ani_bFlipH, ani_bFlipV, false); if (!frame.anf_bPause) { state.fCurrentFrameCounter += gameTime.ElapsedGameTime.TotalMilliseconds; if (state.fCurrentFrameCounter++ >= frame.anf_fTime) { AdvanceFrame(state); } } // hmm.. if (fOverX != 0) { fWidth = fOverX; } if (fOverY != 0) { fHeight = fOverY; } return(new Vector2((int)fWidth, (int)fHeight)); }