• Editor
  • Feedback on the [awesome] xna runtime

Related Discussions
...

Firstly - Wow, fantastic! 🙂
I wasn't expecting there to be an xna/monogame runtime. I was expecting to have to expand on the generic c# runtime and then maintain it myself, however this is much better. I can use it straight out the box! Thank you!

I've had an initial play and found two problems. One problem I've fixed and sent you a pull request (The skeletonJson.cs has a small bug when parsing the animation/slots json). However the second issue is not immediately clear to me....

I am running in the iOS simulator and it is fine except if I rotate the screen then the animation is slightly stretched - it doesn't seem to take into account the new resolution. I'm not sure what might be causing this. Does this happen to you when running in XNA? It only happens if you rotate when you have already started the app. I am running full screen. (I didn't have this problem with the runtime I converted from your original libgdx and corona runtimes so I'm assuming it is something in the c#/xna runtime as opposed to the monogame or my code.)

FYI: I am running this using Xamarin Studio on the mac. The only thing I had to do to get this working was to make replacement project files (spine-csharp-xamarin-ios and spine-xna-xamarin-ios) because I couldn't open the visual studio projects. Other than that I am using the same source files. So, I'm quite happy that I will be able to handle any updates to the run-times as and when you publish them. 🙂

Great to hear that it pretty much works for MonoGame out of the box! I did an XNA runtime just to validate spine-csharp. It was easier than implementing a Unity runtime.

XNA has sprite batching only for rects, not quads, so I have to do my own batching and view setup. If you update I believe your issue is fixed.

I can confirm the issue is fixed. Many thanks.
And many thanks for doing the xna/monogame runtime. I believe a lot of people will be very happy with that!

Hi Nate,

Up until now I've only been running this on the iOS simulator. Today I tried to run it on an actual device and I had an error. I've fixed it locally - it is due to the way the iPad handles permissions etc I believe. The change I made was to the spine-xna/src/atlas.cs file. Instead of the following code at the top of the loadTexture method...

		using (Stream fileStream = new FileStream(path, FileMode.Open)) {
			file = Texture2D.FromStream(device, fileStream);
		}

..I have replaced it with the following code...

		using (StreamReader reader = new StreamReader(path))
		{
			file = Texture2D.FromStream(device, reader.BaseStream);
		}

...which does exactly the same thing but works fine.

Would it be ok for you to put this in your official XNA runtime? No worries if not as I have my own fork. However I just thought it might be helpful for iOS MonoGame developers, and I believe it would have no impact on XNA / other platform MonoGame developers.

If it were doing the same thing, it would also not work. 😉 Can you update and try again? I've been refactoring things to be a bit nicer.

😉

OK - I've got the latest code and can confirm no problems with file permissions. There is one issue of interest though....

I note that your goblins.atlas file has a blank line at the top of the file whereas my atlas file did not - My atlas file was created with TexturePacker so I'm guessing you created yours with something else which put a blank line at the top?

If I add a blank line to the top of my atlas file then all is good, however if I do not then I get a null reference exception...
In the atlas.cs file (line 65) you have the following code (presumably to specifically skip this blank line)..

		// Skip to first page entry.
		while (true) {
			String line = reader.ReadLine();
			if (line.Trim().Length == 0)
				break;
		}
		reader.ReadLine(); // Skip first page name.

Because I do not have a blank line this simply reads all the file and eventually 'line' is null so 'line.Trim()' causes a null reference.

For now I added a blank line to the top of my atlas file and all is fine. I haven't tried to fix it as I figured this might be something you'd prefer to have a look at yourself?

Let me know if/when you make a change and I'll test again.
Cheers 🙂

Fixed, thanks!

Confirmed working. Many thanks.