Using SDL for window Creation?

Started by
12 comments, last by Icefox 18 years, 10 months ago
Quote:Original post by Raduprv
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.


Good point. I guess it's just a matter of choice.
Advertisement
Can't we all just get along?! :)

Learn about game programming!Games Programming in C++: Start to Finish
Quote:Original post by Raduprv
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?


I'm going to have to disagree with you on this one [smile]

Reasons why I would want to use DX and SDL:

1. Smaller base code size:
In ~163 (Without of comments and with code that does fonts) lines of code, you can setup SDL and D3D and have a framework ready to run and use. Compare this to traditional methods, and it's quite an improvement (roughly 1/3 of that required with NeHe 3D, which is just a blank window).

2. Easier Input:
Input with SDL is quite easy compared to DirectInput and you can make an input system that can nearly rival that of DI with a lot less code. I know because I've had to write input libraries for both APIs. Yes, with SDL, you will not have access to Force Feedback, but then again, I don't recall using it when I made the DI class [wink]. For mouse and keyboard, you can get the same thing that DI provides with SDL.

3. Easier Sound:
With SDL you have access to SDL_Sound and SDL_Mixer. Then there are other libaries that you can use, such as SMPEG that you can use for MP3 if needed, Timidity for MIDI, then OGG and Wav are supported by default. There is no messing around with DirectSound or DirectMusic, or having to jump though the DirectShow hoop (something I see done a lot in the DX forum).

4. 'Extras':
With SDL you have easy access to threads, the CDROM device, networking (SDL_net), and SDL_RWops. Extra features like these you can add in to use in your game with relative ease. Of course with networking now with DX, you will have to use something other than DirectPlay.

5. Access to Win32:
With SDL you still have access to all the Win32 stuff. For example, if you need the windows HWND, it's easily obtainable! With that you can then do all the window movement, sizing, and anything else you want with it.

6. Comparison of DX and OGL easier:
We all know that DX and OpenGL do not work the same on all cards. YOu can have OGL code that works fine on NVIDIA, but messes up on ATI cards, and vice versa. Most of the time, people don't bother testing both APIS, but if you were to, doing it via SDL would require a lot less code and more reason to than if you used Win32. (I acknowledge this is not the best supported argument, so please no one debate me on this)

Well that's what I think, to each their own though [grin]. I think SDL provides a good interface to both API's and if utilized correctly, you can get some niec stuff made with it.
Quote:Original post by Kylotan
Both the original poster and Icefox might want to read this.

Direct3D 9.0 with SDL


I stand humbly corrected.
-----http://alopex.liLet's Program: http://youtube.com/user/icefox192

This topic is closed to new replies.

Advertisement