Compiling SDL_gfx (2.0.17) on Visual Studio 2008 (VS9)

July 12th, 2008

Sadly there are no officially provided binaries for SDL_gfx (unlike most other SDL_* libraries), and so I had to compile it myself. SDL_gfx, however has just about no documentation telling you how to do this - and the methods provided doesn’t even work.

Since it took me a while to get this working, so I thought I’d write it down for future reference.

1. Download and unpack the source package.
2. Rename *.c to *.cpp. This is to solve what seems to be this bug, that supposedly was fixed in VS6.
3. Extract sdlgfx.vcproj from ‘Other Builds\VisualC7.zip’ into the source directory and open it, and go through the Conversion Wizard.
4. Remove the source files from the project, and then add the *.cpp files and the *.h files to the project. This is needed because the paths in the original project file are incorrect.
5. Change target to Release.
6. Add SDL.lib to Linker -> Input -> Additional Dependencies in the project properties.
7. Add BUILD_DLL to C/C++ -> Preprocessor -> Preprocessor Definitions.
8. In SDL_gfxPrimitives, replace

#ifdef WIN32

__inline long int
lrint (double ftl)
{
int intgr;
_asm
{
fld flt
fistp intgr
};
return intgr;
}

#endif

with

#define lrint(x) (floor(x+(x>0) ? 0.5 : -0.5))

(As per this site)
9. Compile, and save the solution somewhere when asked to.
10. There should be 4 compilation errors, all of which can be solved by using static_cast<>():
SDL_rotozoom.cpp (Line 501) becomes:
pc = static_cast<tColorRGBA*>(dst->pixels);
SDL_rotozoom.cpp (Line 657) becomes:
pc = static_cast<tColorY*>(dst->pixels);
SDL_gfxPrimitives.cpp (Line 3105) becomes:
sab = sqrt(static_cast<double>(a2 + b2));
SDL_gfxPrimitives.cpp (Line 4289) becomes:
currentFontdata = static_cast<const unsigned char*>(fontdata);
11. Compile. The project should now compile correctly, and you will find sdlgfx.dll and sdlgfx.lib in the Release sub-folder of your source directory.

Now, this is all good, but I would really prefer either official binaries, *or* fixes to the code problems, and instructions that are actually up to date.

Flash cycler

June 15th, 2008

Since I had a some time on my hands I decided to make a web page that cycles through a collection of flash movies and shows each one for a specified amount of time.

It should work in most modern browsers - I’ve verified with Opera and Firefox (Internet Explorer doesn’t work).

You can find the source of the page here, and a sample of it in use here.

Super smash bros: Brawl (USA) on PAL Wii

April 17th, 2008

I finally got SSBB working, and here’s how. But let’s start with what does NOT work.

First, my setup:
PAL Wii with latest firmware (Bought on the release date)
WiiKey (Firmware 1.9s)

Try 1 (No go):
Enabling update blocker on the WiiKey:
Doesn’t work, from reading a litte on the net I found out that you have to enable dev mode as well.

Try 2 (A bit better):
Enabled dev mode as well as the update blocker on the WiiKey. The disc loads correctly, but when you try to start it you just get a black screen.

Try 3 (Almost there):
Got a tip to try it in 50hz mode. Did that, and… it works. However the game runs awfully slow, and you get audio artefacts from some sounds which means it’s not really playable.

Try 4 (Success!):
Decided to try FreeLoader for Wii. I disabled update blocker and dev mode on the WiiKey, and changed back to 60hz.
First I went to the disc screen and inserted the FreeLoader disc and waited for it to load (you may see some graphic artefacts during this time). Then I ejected the FreeLoader disc and inserted my SMBB disc and started it. And it worked fine.

If you get a white screen saying the disc can’t be read after the “Loading…” message you’re propably suffering from a bad burn.

Self Injury

March 5th, 2008

Posting this since it’s relevant to past experiences, and because I think it’s important to know about it. I strongly encourage you to read it.

Ruby’s GNU readline module

February 25th, 2008

One thing I really don’t like is libraries that lacks documentation. Which, incidentally, is exactly what ruby’s readline module does.

Happily, however, I found this post which explains at least the basic usage - thank you, Adam!

Bits and pieces

February 7th, 2008

These are some interesting links I’ve picked up during the past months. Some of them are quite old, so don’t be surprised if you’ve already seen some of them.

Let’s begin with how robots could be looking at humans.

And then a pair of personality related articles: a few things you should know about introverts (that’s me). And also a comparison, if you will, of the Wide/Deep personality types.

I found 10 Attributes of Really Lazy People quite entertaining.

And some reasons as to why I will never get an facebook account. Another, less serious, but still valid view on the same topic.

If you feel like you have too much time on your hans you could always do what this guy did: write a ray-tracing renderer from scratch.

Here’s some interesting views on today’s CS education, though I’ve not personally seen all those changes where I’m studying. It also presents a few things that are important for CS students to learn (more specifically in the programming area).

And at last, a nice explanation as to why writing general applications isn’t always the right choice.

Blog challenge: Hovie clip

February 3rd, 2008

So, I’ve been challenged by Linnea with finding a clip from a movie whose name starts with the letter ‘H’, so here you go.

Now I challenge ozamosi, and YOU to find a clip from a movie that starts with the next letter in the alphabet, namely ‘I’. The ones you challenge will have to find clips from movies that start with the letter after that (’J'), and so on.

Music and… music

December 14th, 2007

Lunar released his album Wall of Sound just a few days ago - have a listen if you haven’t already. Personally I think this album is even better than Hybrid Awakening, his first album. And as of now both albums are available as free downloads too :)

Also on the music front: thesixtyone, a radio service you can use to find new music to listen to. I think this works much better than last.fm - it plays music I like more oftenly, but this could just as well be because of my music preferences. A big difference from last.fm however is that you can choose what tracks you want to listen to - and do it as many times as you like.

So check both out :)

ryara.net v3

December 2nd, 2007

I’ve yet again remade my website (second time this year), and I think it looks better than the older two.
New for this version is a new PHP backend for the portfolio part, which I’m quite happy with. Eventually I’ll probably release the source for it, too.

I’d also like to thank Andreas Viklund for the template I used, and friends of mine for help with a few design decisions.

Boredom yields creativity

October 15th, 2007

Well, sometimes at least. A couple of days ago when I was bored I entertained myself with “enhancing” a crossword from a newspaper, and here’s the result:
“Enhanced” crossword
I think it looks quite interesting, but I think I’ll try to use a bigger crossword next time (if it comes).