Example #1
0
        public void DrawImage(Image image, WWUtils.Math.Vector2 <float> position, WWUtils.Math.Vector2 <float> Handle, float rotation, WWUtils.Math.Vector2 <float> scale)
        {
            ImageImpl img = image as ImageImpl;

            DrawImage(image, new Rect <float> (position.X, position.Y, img.subimage.size.X * scale.X,
                                               img.subimage.size.Y * scale.Y),
                      Handle, rotation);
        }
Example #2
0
        public Image GetSubImage(WWUtils.Math.Rect <float> subImageSpace)
        {
            ImageImpl sub = new ImageImpl();

            sub.JSImage  = JSImage;
            sub.subimage = new Rect <float> (subimage.position.X + subImageSpace.position.X,
                                             subimage.position.Y + subImageSpace.position.Y,
                                             subImageSpace.size.X, subImageSpace.size.Y);
            sub.Loaded = true;
            return(sub);
        }
Example #3
0
        public void DrawImage(Image image, WWUtils.Math.Rect <float> destinationRect, WWUtils.Math.Vector2 <float> Handle, float rotation)
        {
            mgr.PushState();
            mgr.Translate((int)-Handle.X, (int)-Handle.Y);
            mgr.Rotate(rotation);
            ImageImpl img = image as ImageImpl;

            mgr.DrawImage(img.JSImage, (int)img.subimage.position.X, (int)img.subimage.position.Y,
                          (int)Math.Round(img.subimage.size.X), (int)Math.Round(img.subimage.size.Y),
                          (int)destinationRect.position.X, (int)destinationRect.position.Y,
                          (int)Math.Round(destinationRect.size.X), (int)Math.Round(destinationRect.size.Y));
            mgr.PopState();
        }
Example #4
0
        public Image GetImage(string filename, Rect <float> source, Action <Image> loadedCB = null)
        {
            ImageImpl img = new ImageImpl();

            mgr.LoadImage("Content/" + filename, delegate(object jsImage) {
                img.JSImage  = jsImage;
                img.subimage = (Rect <float>)source;
                img.Loaded   = true;
                if (loadedCB != null)
                {
                    loadedCB(img);
                }
            });
            return(img);
        }
Example #5
0
        //public event Action<long> TickListeners;

        //methods

        public Image GetImage(string filename, Action <Image> loadedCB = null)
        {
            ImageImpl img = new ImageImpl();

            mgr.LoadImage("Content/" + filename, delegate(object jsImage) {
                img.JSImage        = jsImage;
                Vector2 <float> sz = mgr.GetImageSize(jsImage);
                img.subimage       = new Rect <float>(0, 0, sz.X, sz.Y);
                img.Loaded         = true;
                if (loadedCB != null)
                {
                    loadedCB(img);
                }
            });
            return(img);
        }