Today was my first Monday without worrying about homework in a long time. Sunday will be the Chicago Indie Game Developer meeting, and I want to make sure I can say I’ve accomplished something.
One of my goals was to program 5 hours per week at the minimum. While I wasn’t able to do it consistently, I did program on my own projects much more often than I did last month. I even managed to fix up my Tic-Tac-Toe game so that it is a completed project under my belt. I’ve been learning, but now that school is no longer a worry I can accomplish much more in the coming month.
Another goal was to learn how to use Kyra. I haven’t touched it since I got the demo running on my machine. The demo was quite impressive and showed the power of the Sprite Engine. So I set to work, but I had some issues.
I created a directory in my Projects directory called KyraTest. I setup a Subversion repository and setup my documentation, source, and resource directories. Kyra comes with a tutorial, so I started there. The tutorial involves using a few images together. I wanted to start simply, so I cropped a photo of my head and shrunk it. I figured I could later add a cartoon body to it and have a bunch of characters running around on a screen. For the moment though, I just had this head.
I was able to create the .dat and .xml files from the sprite editory provided. I then copied one of the tutorial code files into my source directory and edited it to make the references to my own data. For some reason the file was written as if you wouldn’t have Kyra or SDL actually installed. It would have lines like:
All well and good, but why not use the system include instead of a local one? If you know, please let me know why the first way would be preferable.
Anyway, once I got that part squared away, and fixed the bugs I introduced when I edited the file, I got it to compile. Unfortunately it wouldn’t run because it couldn’t find libkyra.so.0. I found that it was installed on my Debian system, but there wasn’t a link created in the standard location for libraries. Once I created the link, it worked fine.
The end result: A black background with an image of my head in the middle. B-)
It was what I set out to do for today before going to bed, but it was kind of frustrating getting to that point. I sent an email to the author explaining the issues I had and how I fixed them, and I also asked for explanations on some of the code decisions.
My goal for this week: I want to make an application where a bunch of clones (with goatees, of course) are chasing after the real me (sans-goatee) before the meeting on Sunday.
And for the code collectors:
Kyra Source in .tar.gz format
Kyra Source in .zip format
NOTE: You will need Kyra v2.0.7 to use this code. Also, the comments in the code weren’t all updated to reflect the fact that I’ve changed it. It is licensed under the GPL or LGPL as specified.
One reply on “Learning Kyra”
#include “SDL.h” is apparently preferred for the sake of keeping things portable. Using
means you’re specifying a path to the header, and that ruins compiles on systems where the header isn’t in that location. You’re better off using “SDL.h” and telling your compiler where to find the header and your linker where to find the library files. In Dev-C++, its a project option. On Linux, you should use sdl-config. sdl-config will supply the correct flags for you. You’d run it like this:
g++ foo.cpp `sdl-config –cflags –libs`
HTH, and hope its correct too. 🙂