Exemple #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;
     }
 }
Exemple #3
0
        public static CozyAnimationFrame Create(CozyTexture texture, float delayUnits)
        {
            var animate = new CozyAnimationFrame();

            animate.InitWithTexture(texture, delayUnits);
            return(animate);
        }
Exemple #4
0
 public virtual bool InitWithTexture(CozyTexture texture)
 {
     if (texture == null)
     {
         return(false);
     }
     Texture = texture;
     return(true);
 }
Exemple #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);
 }
Exemple #6
0
 public static new CozyTileSprite Create(CozyTexture texture)
 {
     var sp = new CozyTileSprite();
     if(!sp.InitWithTexture(texture))
     {
         return null;
     }
     return sp;
 }
Exemple #7
0
        public static CozySprite Create(CozyTexture texture)
        {
            var sp = new CozySprite();

            if (!sp.InitWithTexture(texture))
            {
                return(null);
            }
            return(sp);
        }
Exemple #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;
 }
Exemple #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);
        }
Exemple #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;
                }
            }
        }
Exemple #11
0
 public override bool InitWithTexture(CozyTexture texture)
 {
     if(!base.InitWithTexture(texture))
     {
         return false;
     }
     return true;
 }
Exemple #12
0
        public object Clone()
        {
            var text = new CozyTexture(this._Texutre);

            return(text);
        }
Exemple #13
0
 public virtual bool InitWithTexture(CozyTexture texture, float delayUnits)
 {
     Texture = texture;
     DelayUnits = delayUnits;
     return true;
 }
Exemple #14
0
 public static CozyAnimationFrame Create(CozyTexture texture, float delayUnits)
 {
     var animate = new CozyAnimationFrame();
     animate.InitWithTexture(texture, delayUnits);
     return animate;
 }
 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;
 }
Exemple #17
0
 public void AddFrame(CozyTexture texture)
 {
     var frame = CozyAnimationFrame.Create(texture, 1.0f);
     Frames.Add(frame);
     TotalDelayUnits ++;
 }
Exemple #18
0
 public object Clone()
 {
     var text = new CozyTexture(this._Texutre);
     return text; 
 }
Exemple #19
0
 public virtual bool InitWithTexture(CozyTexture texture, float delayUnits)
 {
     Texture    = texture;
     DelayUnits = delayUnits;
     return(true);
 }
Exemple #20
0
 public virtual bool InitWithTexture(CozyTexture texture)
 {
     if (texture == null) return false;
     Texture = texture;
     return true;
 }