Exemple #1
0
        public Rectangle GetTextureRect(string stateName, AtomDirection direction = AtomDirection.South, int animationFrame = 0)
        {
            DMIParser.ParsedDMIState state = Description.GetState(stateName);
            DMIParser.ParsedDMIFrame frame = state.GetFrames(direction)[animationFrame];

            return(new Rectangle(frame.X, frame.Y, Description.Width, Description.Height));
        }
Exemple #2
0
            public ParsedDMIFrame[] GetFrames(AtomDirection direction = AtomDirection.South)
            {
                if (!Directions.ContainsKey(direction))
                {
                    direction = Directions.Keys.First();
                }

                return(Directions[direction]);
            }
Exemple #3
0
            public State(Texture texture, DMIParser.ParsedDMIState parsedState, int width, int height)
            {
                Frames = new Dictionary <AtomDirection, AtlasTexture[]>();

                foreach (KeyValuePair <AtomDirection, DMIParser.ParsedDMIFrame[]> pair in parsedState.Directions)
                {
                    AtomDirection dir = pair.Key;
                    DMIParser.ParsedDMIFrame[] parsedFrames = pair.Value;
                    AtlasTexture[]             frames       = new AtlasTexture[parsedFrames.Length];

                    for (int i = 0; i < parsedFrames.Length; i++)
                    {
                        DMIParser.ParsedDMIFrame parsedFrame = parsedFrames[i];

                        frames[i] = new AtlasTexture(texture, new UIBox2(parsedFrame.X, parsedFrame.Y, parsedFrame.X + width, parsedFrame.Y + height));
                    }

                    Frames.Add(dir, frames);
                }
            }
Exemple #4
0
 public                                            AtlasTexture[] GetFrames(AtomDirection direction)
 {
     if (!Frames.TryGetValue(direction, out AtlasTexture[] frames))