예제 #1
0
파일: gxtCircle.cs 프로젝트: Loko/GXT
        public virtual void Draw(gxtSpriteBatch spriteBatch, Vector2 position, float rotation, Vector2 scale, SpriteEffects spriteEffects, Color colorOverlay, float renderDepth)
        {
            gxtDebug.Assert(gxtPrimitiveManager.SingletonIsInitialized);

            //float radiusOverDefault = radius / gxtPrimitiveManager.Singleton.CircleTextureRadius;
            scale = new Vector2(scale.X * radiusOverTextureRadius, scale.Y * radiusOverTextureRadius);

            spriteBatch.DrawSprite(gxtPrimitiveManager.Singleton.CircleTexture, position, colorOverlay, rotation, new Vector2(gxtPrimitiveManager.Singleton.CircleTextureRadius),
                scale, SpriteEffects.None, renderDepth);
        }
예제 #2
0
파일: gxtLine.cs 프로젝트: Loko/GXT
        public void Draw(gxtSpriteBatch spriteBatch, Vector2 position, float rotation, Vector2 scale, SpriteEffects spriteEffects, Color colorOverlay, float renderDepth)
        {
            gxtDebug.Assert(gxtPrimitiveManager.SingletonIsInitialized);

            Matrix rotMat = Matrix.CreateRotationZ(rotation);
            Vector2 tStart = Vector2.Transform(Vector2.Multiply(start, scale), rotMat) + position;

            spriteBatch.DrawSprite(gxtPrimitiveManager.Singleton.PixelTexture, tStart, colorOverlay, angle + rotation, ORIGIN,
                Vector2.Multiply(scale, lineScale), spriteEffects, renderDepth);
        }
예제 #3
0
파일: gxtSprite.cs 프로젝트: Loko/GXT
 public void Draw(gxtSpriteBatch spriteBatch, Vector2 position, float rotation, Vector2 scale, SpriteEffects spriteEffects, Color colorOverlay, float renderDepth)
 {
     if (texture != null)
         spriteBatch.DrawSprite(Texture, position, colorOverlay, rotation, origin, scale, spriteEffects, renderDepth);
     else
     {
         gxtLog.WriteLineV(gxtVerbosityLevel.CRITICAL, "Drawable Sprite Does Not Have A Texture (Position: " + position.ToString() + " )");
         if (gxtDebugDrawer.SingletonIsInitialized)
         {
             //if (!gxtDebugDrawer.Singleton.IsSet(true))
             //    gxtLog.WriteLineV(gxtVerbosityLevel.WARNING, "The Debug Drawer Is Not Set: A \"NO TEXTURE\" string will not be drawn");
             gxtDebugDrawer.Singleton.AddString("NO TEXTURE", position, Color.Magenta, 0.0f);
         }
     }
 }
예제 #4
0
파일: gxtLineBatch.cs 프로젝트: Loko/GXT
        public void Draw(gxtSpriteBatch spriteBatch, Vector2 position, float rotation, Vector2 scale, SpriteEffects spriteEffects, Color colorOverlay, float renderDepth)
        {
            gxtDebug.Assert(gxtPrimitiveManager.SingletonIsInitialized);

            Matrix rotMat = Matrix.CreateRotationZ(rotation);
            for (int i = 0; i < vertices.Count; i += 2)
            {
                Vector2 tStart = Vector2.Transform(Vector2.Multiply(vertices[i], scale), rotMat) + position;

                int halfIndex = i / 2;

                spriteBatch.DrawSprite(gxtPrimitiveManager.Singleton.PixelTexture, tStart, colorOverlay, cachedValues[halfIndex].Y + rotation, gxtLine.ORIGIN,
                    Vector2.Multiply(new Vector2(cachedValues[halfIndex].X, lineThickness), scale), spriteEffects, renderDepth);
            }
        }
예제 #5
0
파일: gxtLineLoop.cs 프로젝트: Loko/GXT
        public void Draw(gxtSpriteBatch spriteBatch, Vector2 position, float rotation, Vector2 scale, SpriteEffects spriteEffects, Color colorOverlay, float renderDepth)
        {
            gxtDebug.Assert(gxtPrimitiveManager.SingletonIsInitialized);

            Matrix rotMat = Matrix.CreateRotationZ(rotation);
            for (int j = vertices.Count - 1, i = 0; i < vertices.Count; j = i, i++)
            {
                Vector2 tStart = Vector2.Transform(Vector2.Multiply(vertices[j], scale), rotMat) + position;
                //Vector2 tEnd = Vector2.Transform(Vector2.Multiply(vertices[i], scale), rotMat) + position;
                //Vector2 tD = tEnd - tStart;
                //float ang = gxtMath.Atan2(tD.Y, tD.X);
                //float dist = tD.Length() + 1.0f;

                //gxtLog.WriteLineV(gxtVerbosityLevel.WARNING, "New Distance: {0}", dist);
                //gxtLog.WriteLineV(gxtVerbosityLevel.CRITICAL, "Precached Distance: {0}", cachedValues[j].X);
                //gxtLog.WriteLineV(gxtVerbosityLevel.SUCCESS, "Scale: {0}", scale.ToString());

                //Vector2 xAxis, yAxis;
                //gxtMath.GetAxesVectors(rotation, out xAxis, out yAxis);

                //float absScaleX = 1.0f - gxtMath.Abs(scale.X - 1.0f);
                //if (scale.X == 1.0f)
                //    absScaleX = 1.0f;
                spriteBatch.DrawSprite(gxtPrimitiveManager.Singleton.PixelTexture, tStart, colorOverlay, cachedValues[j].Y + rotation, gxtLine.ORIGIN,
                    new Vector2((cachedValues[j].X * gxtMath.Abs(scale.X)), lineThickness), spriteEffects, renderDepth);
                /*
                gxtLog.WriteLineV(gxtVerbosityLevel.WARNING, scale.ToString());

                float finalRot = cachedValues[j].Y + rotation;
                Vector2 xAxis, yAxis;
                gxtMath.GetAxesVectors(cachedValues[j].Y, out xAxis, out yAxis);
                xAxis *= (cachedValues[j].X * scale.X);
                yAxis *= (cachedValues[j].X * scale.Y);
                float dist = (xAxis + yAxis).Length();
                spriteBatch.Draw(gxtPrimitiveManager.Singleton.PixelTexture, tStart, null, colorOverlay, finalRot, origin,
                    new Vector2(dist, lineThickness), spriteEffects, renderDepth);
                */
                //spriteBatch.Draw(gxtPrimitiveManager.Singleton.PixelTexture, tStart, null, colorOverlay, cachedValues[j].Y + rotation, origin,
                //    new Vector2(cachedValues[j].X * scale.X * scale.Y, lineThickness), spriteEffects, renderDepth);

                /* Expensive, but works */
                //spriteBatch.Draw(gxtPrimitiveManager.Singleton.PixelTexture, tStart, null, colorOverlay, ang, origin,
                //    new Vector2(dist, lineThickness), spriteEffects, renderDepth);
            }
        }
예제 #6
0
파일: gxtRectangle.cs 프로젝트: Loko/GXT
        public void Draw(gxtSpriteBatch spriteBatch, Vector2 position, float rotation, Vector2 scale, SpriteEffects spriteEffects, Color colorOverlay, float renderDepth)
        {
            gxtDebug.Assert(gxtPrimitiveManager.SingletonIsInitialized);

            spriteBatch.DrawSprite(gxtPrimitiveManager.Singleton.PixelTexture, position, colorOverlay, rotation, ORIGIN, Vector2.Multiply(size, scale), spriteEffects, renderDepth);
        }