Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

The Orange Peanut

Can SDL do Windows?

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

I''d like to get into developing Window programs in C++ without having to learn the Windows API or MFC off the bat. I read somewhere on these forums that SDL could do that. Is that true? Also, how easy is it for a beginner. I have a fairly good understanding of C++ (functions, structs, pointers, strings, file manip., etc), so I dont think that will be a problem. Dat is off da hizzle fo shizzle dizzle

Share this post


Link to post
Share on other sites
Advertisement
Depends on what you mean by "Windows programs". If you mean traditional, window-based ones with text boxes and buttons and such, then no, SDL cannot do that.



[edited by - micepick on March 31, 2003 9:45:19 PM]

Share this post


Link to post
Share on other sites
Sure SDL can be used to make games for the Windows OS. Go to the web site and look at their boards for more information

SDL

GRELLIN

"Democracy does not guarantee equality of conditions - it only guarantees equality of opportunity."

Share this post


Link to post
Share on other sites
If you just want to make games, you don''t need the Win32 API even if you''re not using SDL. It can be useful for making tools like level editors, though.

Share this post


Link to post
Share on other sites
The SDL code is different than the Win32 coding. Just follow the tuts and you will be fine.

Tutorial

Next is code to initialize SDL and the Video, Timer, and Audio subsystems. It will also create a primary surface of 800x600x16 in a windowed application. Also it creates a back surface of the same dimensions and loads and displays a windows BMP file. On shut down it cleans up all of the memory alotment for surfaces. To test this code follow the instructions for setup in the previous link and make an 800x600x24 BMP file. Now the impressive part of this is all of the following was done in 15 lines of code!


  
#include "SDL.h" // Required for all SDL programs


int main( int argc, char* argv[] )
{
// initialize system

SDL_Init ( SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO );
// set our at exit function

atexit (SDL_Quit );
// create a window and primary surface

SDL_Surface *pSurface = SDL_SetVideoMode ( 800, 600, 16, SDL_HWSURFACE | SDL_DOUBLEBUF );
// create a second surface

SDL_Surface *bSurface = SDL_CreateRGBSurface(SDL_HWSURFACE, 800, 600, 16, 0, 0, 0, 0);
// loads bmp in to second surface

bSurface = SDL_LoadBMP("title.bmp");
// blits bmp from second to primary surface

SDL_BlitSurface(bSurface, NULL, pSurface, NULL);
// declare event variable

SDL_Event event;
// message pump

for (;;)
{
// look for an event

if (SDL_PollEvent ( &event ))
{
// an event was found

if (event.type == SDL_QUIT ) break;
}
}// end of message pump

// done

return (0);
}



GRELLIN

"Democracy does not guarantee equality of conditions - it only guarantees equality of opportunity."

[edited by - grellin on March 31, 2003 9:59:15 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by micepick
Depends on what you mean by "Windows programs". If you mean traditional, window-based ones with text boxes and buttons and such, then no, SDL cannot do that.



[edited by - micepick on March 31, 2003 9:45:19 PM]


You are right that SDL can''t do windows programs by itself. You didn''t mention that there are tons of widget libraries that will allow SDL to do just that.

You can find many of these helper libraries at the SDL homepage under the link "libraries".

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!