Example #1
0
        public void AddFrame(CozyTexture texture)
        {
            var frame = CozyAnimationFrame.Create(texture, 1.0f);

            Frames.Add(frame);
            TotalDelayUnits++;
        }
 public void Modify(uint id, CozyTexture texture)
 {
     if(TextureDictionary.ContainsKey(id))
     {
         TextureDictionary[id] = texture;
     }
 }
Example #3
0
        public static CozyAnimationFrame Create(CozyTexture texture, float delayUnits)
        {
            var animate = new CozyAnimationFrame();

            animate.InitWithTexture(texture, delayUnits);
            return(animate);
        }
Example #4
0
 public virtual bool InitWithTexture(CozyTexture texture)
 {
     if (texture == null)
     {
         return(false);
     }
     Texture = texture;
     return(true);
 }
Example #5
0
 public TileButton(CozyTexture texture, Rectangle SourceRect)
 {
     PreferredHeight     = 32;
     PreferredWidth      = 32;
     Margin              = new Starbound.UI.Thickness(3, 3, 0, 0);
     Content             = new XNAImageResource(texture.Get());
     SourcePosition      = new Starbound.UI.Vector2(SourceRect.X, SourceRect.Y);
     SourceSize          = new Starbound.UI.Vector2(SourceRect.Width, SourceRect.Height);
 }
Example #6
0
 public static new CozyTileSprite Create(CozyTexture texture)
 {
     var sp = new CozyTileSprite();
     if(!sp.InitWithTexture(texture))
     {
         return null;
     }
     return sp;
 }
Example #7
0
        public static CozySprite Create(CozyTexture texture)
        {
            var sp = new CozySprite();

            if (!sp.InitWithTexture(texture))
            {
                return(null);
            }
            return(sp);
        }
Example #8
0
 public CozyTexture AddImage(string path)
 {
     CozyTexture result = null;
     if(Textures.ContainsKey(path))
     {
         result = Textures[path];
     }
     else
     {
         result = new CozyTexture(path);
         Textures[path] = result;
     }
     return result;
 }
Example #9
0
        public CozyTexture AddImage(string path)
        {
            CozyTexture result = null;

            if (Textures.ContainsKey(path))
            {
                result = Textures[path];
            }
            else
            {
                result         = new CozyTexture(path);
                Textures[path] = result;
            }
            return(result);
        }
Example #10
0
        public override void Update(float dt)
        {
            if (dt < 1.0f)
            {
                dt *= Animaction.Loops;

                uint LoopNum = (uint)dt;
                if (LoopNum > ExecutedLoops)
                {
                    NextFrame = 0;
                    ExecutedLoops++;
                }

                dt = dt % 1.0f;
            }

            var         frames         = Animaction.Frames;
            int         numberOfFrames = frames.Count;
            CozyTexture frameToDisplay = null;

            for (int i = NextFrame; i < numberOfFrames; ++i)
            {
                float splitTime = SplitTimes[i];

                if (splitTime <= dt)
                {
                    CozyAnimationFrame frame = frames[i];
                    frameToDisplay = frame.Texture;
                    (Target as CozySprite).Texture = frameToDisplay;
                    NextFrame = i + 1;
                }
                else
                {
                    break;
                }
            }
        }
Example #11
0
 public override bool InitWithTexture(CozyTexture texture)
 {
     if(!base.InitWithTexture(texture))
     {
         return false;
     }
     return true;
 }
Example #12
0
        public object Clone()
        {
            var text = new CozyTexture(this._Texutre);

            return(text);
        }
Example #13
0
 public virtual bool InitWithTexture(CozyTexture texture, float delayUnits)
 {
     Texture = texture;
     DelayUnits = delayUnits;
     return true;
 }
Example #14
0
 public static CozyAnimationFrame Create(CozyTexture texture, float delayUnits)
 {
     var animate = new CozyAnimationFrame();
     animate.InitWithTexture(texture, delayUnits);
     return animate;
 }
Example #15
0
 private Tuple<uint, CozyTiledNode> CreateTiledNodeTuple(uint id, CozyTexture texture, Rectangle rect)
 {
     return Tuple.Create<uint, CozyTiledNode>(id, CozySpriteTiled.Create(texture, rect));
 }
 public void Add(uint id, CozyTexture texture)
 {
     TextureDictionary[id] = texture;
 }
Example #17
0
 public void AddFrame(CozyTexture texture)
 {
     var frame = CozyAnimationFrame.Create(texture, 1.0f);
     Frames.Add(frame);
     TotalDelayUnits ++;
 }
Example #18
0
 public object Clone()
 {
     var text = new CozyTexture(this._Texutre);
     return text; 
 }
Example #19
0
 public virtual bool InitWithTexture(CozyTexture texture, float delayUnits)
 {
     Texture    = texture;
     DelayUnits = delayUnits;
     return(true);
 }
Example #20
0
 public virtual bool InitWithTexture(CozyTexture texture)
 {
     if (texture == null) return false;
     Texture = texture;
     return true;
 }