I’m working on a gameplay prototype for one of my projects, something i needed (or perhaps really just wanted,) was to be able to draw lines and circles for diagnostic purposes. Turns out what i need for that is “SDL_gfx” a pretty decent collection of routines which has lots of primitives support and also includes a framerate limiter and scale/rotate functions for surfaces. This all sounded simply super, i was excited and went to the website.
Being a n00b, i was sure i’d missed something, but there aren’t any downloads that you can install to use, you have to download the source and build your own.
I’ve looked around, and found that i cant get hold of any binaries of the most recent release, but i did find a site that explained how to build the source in Visual C++ 2008.
I used the guide from http://blog.ryara.net/2008/07/12/compiling-sdl_gfx-2017-on-visual-studio-2008-vs9 and the modified files from that are included in the file archive.
sdlgfx.lib goes in your lib folder, mine was “C:\Program Files\Microsoft Visual Studio 9.0\VC\lib”
You’ll need to put all the .h files from the archive (just the .h files) in the same folder you setup SDL, for me that was “C:\Program Files\Microsoft Visual Studio 9.0\VC\include\SDL”
Its a good idea to put sdlgfx.dll in “C:\WINDOWS\system32″ But you’ll want to make sure you include sdlgfx.dll in your final release along with the normal sdl.dll
You should link “SDL.lib SDLmain.lib sdlgfx.lib” when building your projects.
“This is great” i hear you all shout, “but how can i test it?” More importantly, “OMG, no tutorials? No guides??”
Yeah, pretty much.. I’ve searched to the best of my ability and found almost nothing, which is a shame, as i’m not skillful enough to just read the dry documentation available and work it out from there, but i have been able to locate and piece together some code that uses the framelimiter, its a good test of whether you’ve installed SDL_gfx properly
Links:
SDL_gfx
How to Build
My SDL_gfx Downloads
And here is my example of how to use “SDL_framerate.h” - Part of SDL_gfx;
#include <iostream>
#include “SDL/SDL_framerate.h”
using namespace std;
FPSmanager *framerate = new FPSmanager;
int main(int argc, char **argv){
SDL_initFramerate(framerate);
SDL_setFramerate(framerate, 3);
bool loop = true;
while (loop){
// Input
// Process
// Render
cout << “blee “;
SDL_framerateDelay(framerate);
}
return 0;
}
No comments
Comments feed for this article
Trackback link
http://games.leighashton.com/2008/08/29/the-fun-that-is-sdl_gfx-or-how-i-stopped-worrying-and-learned-how-to-build-dlls/trackback/