Sign in to follow this  

SDL Please???

This topic is 4298 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You set your program's icon when you create your windows class.

WNDCLASSEX wc;
wc.Icon = LoadIcon(NULL, IDI_EXCLAMATION);
wc.IconSm = LoadIcon(NULL, IDI_EXCLAMATION);

The Icon is the one you see for the executable of your program and the IconSm is the one in the upper left corner. I have been using IDI_EXCLAMATION up until now. Now I'm trying to use a custom one, and I can get the Icon to work but not the IconSm... To use a custom icon, assuming your compiler is like mine, click Insert->Resource->Icon. Then LoadIcon(NULL, IDI_WHATEVERYOUNAMEDIT).

Share this post


Link to post
Share on other sites
Download SDL (if you have not already done so), from here (SDL for windows).

Extract it, and go to your dev-cpp folder.

Copy the contents of ...\SDL-1.2.9\include

to C:\folder1\folder2\dev-cpp\include.

copy the contents of ...\SDL-1.2.9\lib

to C:\folder1\folder2\dev-cpp\lib.

Open dev-cpp, make a new project. Make it a windows project. Get rid of whatever code you get by default, and paste this in:



#include "SDL.h"

int main( int argc, char **argv )
{
SDL_Init( SDL_INIT_VIDEO );
SDL_Surface *screen = SDL_SetVideoMode(300,300,32,SDL_SWSURFACE);
SDL_Event event;
bool done = false;
while(!done)
{
while( SDL_PollEvent( &event ) )
{
if( event.type == SDL_QUIT )
done = true;
}
}
SDL_Quit();
return 0;
}




Go to project->project options->parameters and add this to "linker options"
Quote:

-lmingw32 -lSDLmain -lSDL


Save, compile and run. If it doesnt work, post the errors you get.

Edit: link fixed

Share this post


Link to post
Share on other sites
Dev-C++ has Dev-Paks that install libraries for you. It has one for SDL, too. Go to tools->updates/packages->devpaks.org for the server->check for updates->select SDL and any other libraries you want->download selection

The rest is easy to figure out. Then just create a new SDL project and it should work.

Share this post


Link to post
Share on other sites
Quote:
Original post by BASICisforsquares
ripoff, that's only the DLL.

And I should be able to get th Vc++ package to work with my IDE, right?


Whoops, you're right. This is what you want. (Dev-cpp uses mingw, so it should work). Its what I used if I remember correctly.

About the Vc++ package I don't know.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ezbez
Dev-C++ has Dev-Paks that install libraries for you. It has one for SDL, too. Go to tools->updates/packages->devpaks.org for the server->check for updates->select SDL and any other libraries you want->download selection

The rest is easy to figure out. Then just create a new SDL project and it should work.


The dev-packs are at version 1.2.4 though.

If you decide to do it this way, at least replace SDL.dll with a newer one.

Share this post


Link to post
Share on other sites
Quote:
Original post by Emmanuel Deloget
Quote:
Original post by BASICisforsquares
ripoff, that's only the DLL.

And I should be able to get th Vc++ package to work with my IDE, right?


I guess not - I might be wrong, but I believe that the library format is different (.lib != .a)

Regards,


Correct. Unless something's changed pretty recently, Visual C++ SDKs are not binary-compatible with dev-c++.

Share this post


Link to post
Share on other sites
Quote:
Original post by superpig
Quote:
Original post by Emmanuel Deloget
Quote:
Original post by BASICisforsquares
ripoff, that's only the DLL.

And I should be able to get th Vc++ package to work with my IDE, right?


I guess not - I might be wrong, but I believe that the library format is different (.lib != .a)

Regards,


Correct. Unless something's changed pretty recently, Visual C++ SDKs are not binary-compatible with dev-c++.


Well.... I think GCC (Mingw) is pretty smart. I've succesfully used some VC libs (.lib) with Code::Blocks<GCC>, with some being SDL libraries (I THINK one was SDL_ttf).

But then again, I'm may be just lucking out :).

Share this post


Link to post
Share on other sites
The SDL .libs are usable by mingw, I believe because they use the C abi iirc.

EDIT: for the brief period I used dev-cpp, I found that the devpaks Just Work. The devpaks for SDL are at least at 1.2.8, i think at 1.2.9 which is the latest, i recommend using the devpaks. There are tons of other nice libraries in devpaks amongst which are various add-ons for SDL.

Share this post


Link to post
Share on other sites

This topic is 4298 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this