Jump to content
  • Advertisement
Sign in to follow this  
BASICisforsquares

SDL Please???

This topic is 4582 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

Advertisement
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 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,

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!