Jump to content
  • Advertisement
Sign in to follow this  
donjonson

Using SDL for window Creation?

This topic is 4841 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 am wondering if there is any disadvantage to using SDL for window Creation even if my game uses directX for all the graphics rendering. Right now I am creating my window using all that windows api garbage. it seems rather convoluted just to create a window. Can you easily make a GUI with SDL?

Share this post


Link to post
Share on other sites
Advertisement
I made 3 sdl windows with a thomson book on sdl and all 3 wouldn't work for me
I know sdl prolly works for most people
I just had bad experiance with it

Share this post


Link to post
Share on other sites
SDL generally expects to have one window and only one window. It may be possible to make more, but I haven't tried, and it would probably be rather strange to do.

You can NOT mix SDL and DirectX. It's not a situation of one handles the drawing and the other handles the windows, it's a situation of each trying to do everything itself; drawing, window-management, sound, the whole shebang.

There are GUI packages for SDL out there, but they aren't wrappers for the Windows API, they're entirely new GUI's, meant to be drawn as part of a game. If you want a Windows-ish GUI without the Windows API, look at other GUI toolkits like GTK, wxWindows, TK, things like that.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kylotan
Both the original poster and Icefox might want to read this.

Direct3D 9.0 with SDL


The whole purpose of SDL is to have a portable application.
If you use DX and SDL, you are kind of.. well, defy the purpose of SDL.
Why not just use OpenGL with it?

Share this post


Link to post
Share on other sites
Quote:
Original post by Raduprv
Quote:
Original post by Kylotan
Both the original poster and Icefox might want to read this.

Direct3D 9.0 with SDL


The whole purpose of SDL is to have a portable application.
If you use DX and SDL, you are kind of.. well, defy the purpose of SDL.
Why not just use OpenGL with it?


Because some people prefer DirectX over OpenGL, but they despise the Win32 API, so they look for easier solutions (SDL, or they write their own wrappers (however this is time-consuming, and why not just use something that's already there?)). Also, just because SDL is cross-platform doesn't mean you HAVE to use it's crossplatform capabilities, and somebody who preferes DirectX obviously isn't too interested in cross-platform work.

Share this post


Link to post
Share on other sites
SDL's API is pretty similar with the Win32 API (it's procedural, for example). I can't see how you can hate Win32 but like SDL.

Share this post


Link to post
Share on other sites
Quote:
Original post by Raduprv
SDL's API is pretty similar with the Win32 API (it's procedural, for example). I can't see how you can hate Win32 but like SDL.


Well, mostly it's because SDL only takes about 2 lines of code to get a window up on the screen (well, 3 if you count declaring an SDL_Surface), wheras with the Win32 API it takes a couple of hundred lines to do the same thing (unless you're using MessageBox, but you can't use that with DirectX). Sure, they're both procedural, but one looks nicer and takes less code, and the other one takes up lots more space and looks rather cryptic to the majority of people.

Share this post


Link to post
Share on other sites
Yes, but most of the programmers already have a copy and apste ready code to create the basic stuff (set up an window, get the surface, etc.)
And, unless it's a quick prototype, your init code is far, far smaller than the rest of your code.

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!