Exemplo n.º 1
0
 public EntityAnimation(Entity entity, Content.ContentPool content)
 {
     Content             = content;
     Entity              = entity;
     FrameCustomValues   = new Dictionary <string, Matrix>();
     FrameTransformation = new Dictionary <CustomFrame, Matrix>();
     InitializeAnimation();
 }
 public static void Init(Content.ContentPool content)
 {
     SpatialRelation.content = content;
     if (!inited)
     {
         inited = true;
         Common.SpatialRelation.AddRelator<Software.Triangle, Plane>(Relation);
         Common.SpatialRelation.AddRelator<BoundingBox, MetaBoundingBox>(Relation);
         Common.SpatialRelation.AddRelator<RectangleF, MetaBoundingBox>(Relation);
     }
 }
Exemplo n.º 3
0
        public static void Init(Content.ContentPool content)
        {
            Boundings.content = content;
            if (!inited)
            {
                inited = true;
                Common.Boundings.AddTransformer<BoundingMetaMesh>(Transform);
                Common.Boundings.AddTransformer<MetaBoundingBox>(Transform);
                Common.Boundings.AddTransformer<MetaBoundingImageGraphic>(Transform);

                Common.Boundings.AddTranslater<BoundingMetaMesh>(Translation);
                Common.Boundings.AddTranslater<MetaBoundingBox>(Translation);

                Common.Boundings.AddBoundingToBox<BoundingMetaMesh>(BoundingToBox);
                Common.Boundings.AddBoundingToBox<MetaBoundingBox>(BoundingToBox);

                Common.Boundings.AddRadius<MetaBoundingBox>(Radius);
            }
        }
Exemplo n.º 4
0
        public Vector2 AutoSize(AutoSizeMode autoSize, Content.ContentPool content, Vector2 size, Vector2 maxSize, System.Windows.Forms.Padding padding)
        {
            if (autoSize == AutoSizeMode.Full)
            {
                var fi = content.Peek <FontImplementation>(Font);
                var ts = fi.TextSize(Text);
                return(ts + new Vector2(padding.Horizontal, padding.Vertical));
            }
            else
            {
                int   textHeight;
                var   f = BuildGlyphs(content.Peek <FontImplementation>(Font), Orientation.TopLeft, maxSize, Text, out textHeight);
                float w = 0, h = 0;
                if (f != null)
                {
                    foreach (var g in f)
                    {
                        h = Math.Max(h, g.Position.Y + g.Size.Y);
                        w = Math.Max(w, g.Position.X + g.Size.X);
                    }
                }

                if (autoSize == AutoSizeMode.Vertical)
                {
                    return(new Vector2(size.X, h + padding.Vertical));
                }
                else if (autoSize == AutoSizeMode.Horizontal)
                {
                    return(new Vector2(w + padding.Horizontal, size.Y));
                }
                else if (autoSize == AutoSizeMode.RestrictedFull)
                {
                    return(new Vector2(w, h) + new Vector2(padding.Horizontal, padding.Vertical));
                }
                else
                {
                    throw new ArgumentException();
                }
            }
        }
 public override void Release(Content.ContentPool content)
 {
 }
Exemplo n.º 6
0
        void InitializeGraphics()
        {
            isInited = true;
            if (!DesignMode)
            {
                if (Direct3DVersion == Direct3DVersion.Direct3D9)
                {
                    GraphicsDevice.Direct3DVersion = Direct3DVersion;
                    GraphicsDevice.View = this;
                    GraphicsDevice.FullscreenForm = Application.MainWindow;
                    GraphicsDevice.Create();
                    GraphicsDevice.LostDevice += new Action(OnLostDevice);
                    GraphicsDevice.ResetDevice += new Action(OnResetDevice);

                    LineDrawer = new Line(Device9);

                    Content = new Content.ContentPool(Device9);
                }
                else
                {
                    GraphicsDevice.Direct3DVersion = Direct3DVersion;
                    GraphicsDevice.View = this;
                    GraphicsDevice.FullscreenForm = Application.MainWindow;
                    GraphicsDevice.Create(Handle);
                    GraphicsDevice.LostDevice += new Action(OnLostDevice);
                    GraphicsDevice.ResetDevice += new Action(OnResetDevice);

                    //lineDrawer = new Line(Device10);

                    Content = new Content.ContentPool(Device10);
                }
                Intersection.Init(Content);
                Boundings.Init(Content);
                SpatialRelation.Init(Content);
            }
            Init();
            if (InitEvent != null) InitEvent(this, null);
        }
Exemplo n.º 7
0
 public virtual void OnLostDevice(Content.ContentPool content)
 {
     Release(content);
 }
Exemplo n.º 8
0
 public virtual void Release(Content.ContentPool content)
 {
 }