Monday, September 6, 2010

XNA to SDL Conversion Progress

I'm in the midst of a massive conversion. XNA is getting the boot. Compatibility will rise significantly. I made a test SDL-using program and even some old junk computers I have around were able to run it, when they couldn't with XNA, even after I thought I'd updated all XNA requirements. That's the easy part for all the players. But for me... well, let's just say that it took me a full day just to figure out how to get a sprite on the screen.

Most SDL tutorials are written for C or C++. Which while on the surface is quite similar, has a big difference. Pointers. Ye gods, the pointers. C# doesn't like having the programmer have to use them. If they are used, they have to be marked as unsafe and you have to do your own garbage handling on that. Eventually, I found a way of wrangling the pointers into something I can use outside of unsafe code with IntPtr and something called Marshal.

But, once I got past that, it got much easier. SDL does plenty of things even better than XNA. That problem with cropping images? SDL can do that. Keyboard input? SDL can tell you if a button's just been pressed. Text drawing? Well, you need another part of the SDL library, but SDL can do that. So it should be better when I get this done.

And as you can see from the above image, I'm not done yet. A lot of things to fix. Right now, it's at a state where I've put all the things that were in XNA Adventurer over to SDL Adventurer. Even organized it better as well. Now I have to translate anything and everything I was doing with XNA into its SDL equivalent. And since I'm learning SDL on the fly, that could take a little while. But not much. I already know the basics of sprite drawing, as well as input. Now I've got to get text drawing and sprite transparency and color.

But overall, it's going well after the initial rough start. Steadily making progress. And again, many more people should be able to play it when I'm done.

No comments:

Post a Comment