示例#1
0
        protected virtual void SFMLRender(Drawable drawable, float x = 0, float y = 0)
        {
            RenderStates renderStates;

            if (Texture != null)
            {
                renderStates = new RenderStates(Texture.SFMLTexture);
            }
            else
            {
                renderStates = RenderStates.Default;
            }
            renderStates.BlendMode = SFMLBlendMode(Blend);
            if (Shader != null)
            {
                renderStates.Shader = Shader.SFMLShader;
            }

            // This is really bad x_x lol
            renderStates.Transform.Translate(x - OriginX, y - OriginY);
            foreach (var t in Transforms)
            {
                if (t != Transform)
                {
                    renderStates.Transform.Translate(t.X, t.Y);
                }
                renderStates.Transform.Rotate(-t.Angle, t.OriginX, t.OriginY);
                renderStates.Transform.Scale(t.ScaleX, t.ScaleY, t.OriginX, t.OriginY);
            }

            if (Batchable)
            {
                Draw.Batchable((VertexArray)drawable, renderStates);
                return;
            }
            Draw.Drawable(drawable, renderStates);
        }