コード例 #1
0
ファイル: Atlas.cs プロジェクト: zvinch/SharpDungeon
        public Atlas(SmartTexture tx)
        {
            this.tx  = tx;
            tx.Atlas = this;

            namedFrames = new Dictionary <object, RectF>();
        }
コード例 #2
0
ファイル: TextureCache.cs プロジェクト: zvinch/SharpDungeon
 public static void Add(object key, SmartTexture tx)
 {
     if (All.ContainsKey(key))
     {
         All[key] = tx;
     }
     else
     {
         All.Add(key, tx);
     }
 }
コード例 #3
0
ファイル: TextureCache.cs プロジェクト: zvinch/SharpDungeon
        public static SmartTexture Get(object src)
        {
            if (All.ContainsKey(src))
            {
                return(All[src]);
            }

            var texture = src as SmartTexture;

            if (texture != null)
            {
                return(texture);
            }

            var tx = new SmartTexture(GetBitmap(src));

            All.Add(src, tx);
            return(tx);
        }
コード例 #4
0
ファイル: TextureCache.cs プロジェクト: zvinch/SharpDungeon
        public static SmartTexture CreateSolid(Color color)
        {
            var key = "1x1:" + color;

            if (All.ContainsKey(key))
            {
                return(All[key]);
            }

            var bmp = Bitmap.CreateBitmap(1, 1, Bitmap.Config.Argb8888);

            bmp.EraseColor(color);

            var tx = new SmartTexture(bmp);

            All.Add(key, tx);

            return(tx);
        }
コード例 #5
0
ファイル: TextureCache.cs プロジェクト: zvinch/SharpDungeon
        public static SmartTexture CreateGradient(int Width, int Height, params int[] colors)
        {
            var key = "" + Width + "x" + Height + ":" + colors;

            if (All.ContainsKey(key))
            {
                return(All[key]);
            }

            var bmp    = Bitmap.CreateBitmap(Width, Height, Bitmap.Config.Argb8888);
            var canvas = new Canvas(bmp);
            var paint  = new Paint();

            paint.SetShader(new LinearGradient(0, 0, 0, Height, colors, null, Shader.TileMode.Clamp));
            canvas.DrawPaint(paint);

            var tx = new SmartTexture(bmp);

            All.Add(key, tx);
            return(tx);
        }
コード例 #6
0
		public virtual void Reload()
		{
			Id = new SmartTexture(bitmap).Id;
			Filter(FModeMin, FModeMax);
			Wrap(WModeH, WModeV);
		}
コード例 #7
0
ファイル: Atlas.cs プロジェクト: zvinch/SharpDungeon
 public static RectF UvRect(SmartTexture tx, int left, int top, int right, int bottom)
 {
     return(new RectF((float)left / tx.Width, (float)top / tx.Height, (float)right / tx.Width, (float)bottom / tx.Height));
 }