Beispiel #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));
        }
Beispiel #2
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);
                }
            }