Go Back   Angband Forums > Angband > Development

Thread Tools Display Modes
Old July 16, 2012, 01:41   #1
Join Date: Jan 2010
Posts: 6
Soluzar is on a distinguished road
Compiling on Windows, using Main-SDL.c

In my opinion, the SDL display module is by far the most pleasant to use. I'm not convinced that this opinion is widely shared, but in any case I recently compiled it from source, for Windows. There's not a lot of information 'out there' on this topic and what does exist is a little incomplete.

I'm hoping to do something about that. I'd like to document exactly what I did to get it working. Step by step instructions, so that anyone else can compile this a little more easily than I did. I made a few missteps along the way before eventual success, so these instructions may not be precisely correct at first.

With your help I would like to make them correct, and keep them up-to-date. If you can, and are willing, please attempt to follow these instructions and let me know where you run into trouble. Even if you've got no interest in the Windows/SDL version of Angband, it would help your fellow players.

The Procedure:

1) Install the compilation tools.

I'm using Orwell Dev-C++ which is a fork and a continuation of the older Bloodshed Dev-C++ which now appears to have stagnated. It's a handy IDE that works with the MinGW32 compiler.

That's the latest 32-bit version. It will work fine if you're running 64-bit Windows, I know I am.

2) Download the libraries.

Under the Tools menu in Dev-C++ there is an option to "Check For Updates/Packages" - in spite of the somewhat unhelpful name this will allow you to download additional libraries. If you click it you need to choose a site from which to download. wasn't working when I tried, so pick and choose the following:

SDL 1.2.15
SDLimage 1.2.12
SDLttf 2.0.11
Zlib 1.2.3
LibPNG 1.2.8

Those are the exact versions I chose. At time of writing I believe the SDL packages to be the newest ones available for Dev-C++ although there may be newer upstream releases. Do not choose a newer LibPNG - it will not work.

3) Create a new project

Select 'Empty Project' and be sure to move the radio button to "C Project and not "C++ Project". Add all the .c source code files from /src as well as from src/object, src/monster and src/player subfolders. Add the .c files from /src/win/ as well as the angband.rc file.

If you want to, you can create 'project folders' to match the source code folders. There's no point to it, but I did anyway. Because it's slightly neater, and pleases my mild OCD.

4) Set the project options

Open the project options (right-click the project name) and we can set the options required to compile this. First things first, if you want to there's the option to set the icon for your executable, using the angband.ico file included in the source tarball.

Click to the Parameters tab. The compiler parameters should be "-lmingw32 -mwindows -DWINDOWS -DUSE_SDL" while the linker parameters should be "-lwinmm -lmingw32 -mwindows -lSDLmain -lSDL -lSDL_ttf -lpng -lSDL_image".

Click to the Directories tab next. I'm pretty sure these options ought to be defaults but they weren't so... I'm setting them. If you understand better than I, then please explain it to me.

Under the Library Directories subtab, you need "C:\Program Files (x86)\Dev-Cpp\lib" while under the Include Directories subtab you need "C:\Program Files (x86)\Dev-Cpp\include\SDL". If you put your Dev-C++ installation in another place than "C:\Program Files (x86)\Dev-Cpp\" then you will need to adjust those paths in a predictable way.

That much is required for finding the SDL libraries you put in, but it also needs: "C:\Games\angband-v3.3.2\src\" "C:\Games\angband-v3.3.2\src\win\include" to finish the job.

With all that done, and assuming no mistakes were made, you should be able to compile a working version of Angband SDL for Windows.
Soluzar is offline   Reply With Quote
Old July 16, 2012, 23:36   #2
Angband Devteam member
Join Date: May 2007
Location: London, UK
Posts: 5,054
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Thanks for that - I'm sure it will come in very handy. I haven't tested it yet, but will report back when I do.
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila
Magnate is offline   Reply With Quote
Old July 17, 2012, 12:28   #3
PowerWyrm's Avatar
Join Date: Apr 2008
Posts: 2,335
PowerWyrm is on a distinguished road
For my variant, I have a whole procedure to compile the SDL client under Windows. The basic steps are:
- get Free Command Line Tools (free BCC compiler from Borland)
- get ZLIB 1.2.7 and LIBPNG 1.5.11 source code, compile them using given makefiles, generate static lib files
- get SDL 1.2.15, FreeType 2.4.10, SDL_ttf 2.0.11, SDL_image 1.2.12, MAD 0.15.1b (for the new MP3 support), SDL_mixer 1.2.12 source code, fix some of the files for compile errors, compile them with makefiles I wrote, generate static lib files
- copy headers and lib files into accessible directories and compile the SDL client using a dedicated makefile
- enjoy a nice SDL client
PWMAngband variant maintainer - check (or to learn more about this new variant!
PowerWyrm is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! New MP3 support not working with SDL client under Windows PowerWyrm Development 1 June 4, 2012 16:07
Compiling V for Windows Therem Harth Vanilla 8 September 4, 2011 23:36
Compiling Hengband on Windows EpicMan Development 2 May 7, 2010 19:15
Compiling Z+Angband under Windows Altefcat Variants 8 December 11, 2008 09:44
Windows Compiling and Makefiles APWhite Vanilla 11 August 22, 2007 21:22

All times are GMT +1. The time now is 09:22.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.