private void GetFrames(DMIState state, FreeImageBitmap img) { for (int i = 0; i < state.Frames; i++) { int[] dirs = { Directions.SOUTH, Directions.NORTH, Directions.EAST, Directions.WEST, Directions.SOUTHEAST, Directions.SOUTHWEST, Directions.NORTHEAST, Directions.NORTHWEST }; var frame = new DMIFrame(state.GetDelay(i)); for (int j = 0; j < state.Dir; j++) { int dir = dirs[j]; if (_pixelX >= img.Width) { _pixelX = 0; _pixelY += StateHeight; } Bitmap frameBitmap; #if (ASEPRITE_LOAD) // string getString = "./in/FromAse/NabFinalParts/r_nabber" + state.colourStr + " (" + state.Name + ") " + Directions.DirToAse(dir) + ".png"; string getString = "./in/FromAse/NabFinalParts/r_nabber" + state.colourStr + " (" + state.Name + ") " + Directions.DirToAse(dir) + ".png"; FreeImageBitmap inImage = new FreeImageBitmap(getString); frameBitmap = inImage.ToBitmap(); #else frameBitmap = img.Copy(new Rectangle(_pixelX, _pixelY, StateWidth, StateHeight)).ToBitmap(); #endif frame.Add(new DMIImageData(frameBitmap, dir)); _pixelX += StateWidth; } state.Add(frame); } }
private void GetFrames(DMIState state, FreeImageBitmap img) { for (int i = 0; i < state.Frames; i++) { int[] dirs = { Directions.SOUTH, Directions.NORTH, Directions.EAST, Directions.WEST, Directions.SOUTHEAST, Directions.SOUTHWEST, Directions.NORTHEAST, Directions.NORTHWEST }; var frame = new DMIFrame(state.GetDelay(i)); for (int j = 0; j < state.Dir; j++) { int dir = dirs[j]; if (_pixelX >= img.Width) { _pixelX = 0; _pixelY += StateHeight; } Bitmap frameBitmap; frameBitmap = img.Copy(new Rectangle(_pixelX, _pixelY, StateWidth, StateHeight)).ToBitmap(); frame.Add(new DMIImageData(frameBitmap, dir)); _pixelX += StateWidth; } state.Add(frame); } }