Android上的MonoGame在切割Spritesheet时崩溃了

时间:2016-10-13 13:42:51

标签: c# android mono xna monogame

当我在Android上运行以下代码时,应用程序会与显示

的设备崩溃
  

$ AppName已停止工作。

虽然IDE没有说除

之外的任何内容
10-13 16:30:21.729 D/Mono    (27656): DllImport searching in: 'libGLESv2.dll' ('./libGLESv2.so').
10-13 16:30:21.730 D/Mono    (27656): Searching for 'glGenFramebuffers'.
10-13 16:30:21.730 D/Mono    (27656): DllImport searching in: 'libGLESv2.dll' ('./libGLESv2.so').
10-13 16:30:21.730 D/Mono    (27656): Searching for 'glFramebufferTexture2D'.
10-13 16:30:21.732 D/Mono    (27656): DllImport searching in: 'libGLESv2.dll' ('./libGLESv2.so').
10-13 16:30:21.732 D/Mono    (27656): Searching for 'glReadPixels'.
10-13 16:30:21.737 D/Mono    (27656): DllImport searching in: 'libGLESv2.dll' ('./libGLESv2.so').
10-13 16:30:21.737 D/Mono    (27656): Searching for 'glDeleteFramebuffers'.
Thread finished: <Thread Pool> #4
10-13 16:30:28.944 D/Mono    (27656): [0xf415cc00] worker finishing
The thread 'Unknown' (0x4) has exited with code 0 (0x0).
10-13 16:30:36.618 D/Mono    (27656): Image addref System.Runtime.Serialization[0xdbe39100] -> System.Runtime.Serialization.dll[0xdbe25600]: 1
10-13 16:30:36.618 D/Mono    (27656): Assembly System.Runtime.Serialization[0xdbe39100] added to domain RootDomain, ref_count=1
10-13 16:30:36.621 D/Mono    (27656): AOT module 'System.Runtime.Serialization.dll.so' not found: dlopen failed: library "/data/app/AndroidBuild.AndroidBuild-1/lib/x86/libaot-System.Runtime.Serialization.dll.so" not found
10-13 16:30:36.624 D/Mono    (27656): AOT module '/Users/builder/data/lanes/3819/96c7ba6c/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/System.Runtime.Serialization.dll.so' not found: dlopen failed: library "/data/app/AndroidBuild.AndroidBuild-1/lib/x86/libaot-System.Runtime.Serialization.dll.so" not found
10-13 16:30:36.626 D/Mono    (27656): Config attempting to parse: 'System.Runtime.Serialization.dll.config'.
10-13 16:30:36.626 D/Mono    (27656): Config attempting to parse: '/Users/builder/data/lanes/3819/96c7ba6c/source/monodroid/builds/install/mono-x86/etc/mono/assemblies/System.Runtime.Serialization/System.Runtime.Serialization.config'.
10-13 16:30:36.626 D/Mono    (27656): Assembly Ref addref MonoGame.Framework[0xea6083a0] -> System.Runtime.Serialization[0xdbe39100]: 2
10-13 16:30:36.627 D/Mono    (27656): Assembly Ref addref System.Runtime.Serialization[0xdbe39100] -> mscorlib[0xea608280]: 17
10-13 16:30:36.695 F/        (27656): * Assertion at /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mono/sgen/sgen-alloc.c:384, condition `*p == NULL' not met
10-13 16:30:36.696 F/libc    (27656): Fatal signal 6 (SIGABRT), code -6 in tid 27656

我正在使用的代码是

 public void SplitSheet()
        {
            for (int i = 0; i < FramesCountTotal; i++)
            {
                //Calculate the location of the current sprite within the image.
                int Row = (int)(i / (float)fColumns);  
                int Column = i % fColumns;

                //Transform into a rectangle.
                Rectangle FrameRect = new Rectangle(fWidth * Column, fHeight * Row, fWidth, fHeight);

                //Create a new texture object with the dimensions of the sprite.
                Texture2D curFrame = new Texture2D(Core.graphics.GraphicsDevice, FrameRect.Width, FrameRect.Height);
                //Create a color array to hold the color data of the sprite.
                Color[] FrameData = new Color[FrameRect.Width * FrameRect.Height];
                //Get the color data from the spritesheet.
                textureAtlas.Image.GetData(0, FrameRect, FrameData, 0, FrameData.Length);
                //Set the colors we extracted to the texture object.
                curFrame.SetData<Color>(FrameData);
                //Add the texture to the array.
                frames.Add(curFrame);
            }
        }

据我所知,它崩溃的行是curFrame.SetData<Color>(FrameData);

有关如何获取更具体的调试信息的任何想法,或者为什么这在Windows上有效但在Android上无效?

0 个答案:

没有答案