About SDL, a substitute for DirectX

Source: Internet
Author: User
What is SDL?

That is, the Simple DirectMedia Layer uses the lgpl license.

  • Free cross-platform multimedia application programming interface
  • Used for games, game development tools, simulators, sample demonstrations, multimedia applications, etc.
What can it do?

Video, audio, event, CDROM support, thread, timer, reading of various image file formats, Fast Drawing, sound mixing, game bar support, network, MPEG decoding, etc., and CPU byte sequence is irrelevant.

In general, the relationship with DirectX is as follows:

  • Sdl_video, sdl_image, OpenGL -- DirectDraw, direct3d
  • Sdl_audio, sdl_mixer -- directsound
  • Sdl_joystick, sdl_base -- directinput
  • Sdl_net -- directplay
  • Smpeg, sdl_video, sdl_audio, sdl_sound, sdl_filter -- DirectShow
  • Font, window management and other practical tools and a large number of examples
Which platforms are supported?
  • Linux with system installation
  • Win32 requires one to several smaller DLL
  • BEOs
  • MacOS, MacOS X
  • Other unofficial migrations
Which programming languages can be used?

Almost all! SDL itself is written in C and has interfaces in various languages. Simple function calls without COM.

Personal opinion (not representative of any group or others)

In general, SDL is not very good, but it is one of the few DX alternatives. Some people may ask why there is no need to use DX or at least, and lazy people always want to do more things with less effort. For most people, both dx, OpenGL, and SDL are low-level APIs, especially dx. If you are proficient in dx, congratulations, your hardware knowledge must be good. If you pay attention to it, you will find that many games today provide options: direct3d, OpenGL, glide, and software. This means that many game manufacturers have designed their own high-level APIs as needed, the underlying layer can be replaced. Some people may say that high-level vendors are capable of high performance only by fully developing hardware functions. For example, although DirectDraw is used for rendering many 2D games, however, it is purely software rendering in the memory frame buffer, and finally calling DirectDraw to swap the image to the screen. For 2D games and today's machine configuration, the direct frame buffering operation by GDI is sufficient. 3D technology is required when more advanced rendering capabilities are required, this is why DirectDraw and direct3d are replaced by 3D directgraphics in dx8. But most importantly, selecting SDL means cross-platform.

Return to the topic. Similar to DX, each part of SDL can be used independently, but sdl_base is required. The window message management method is very antique. If you have written a Win32 program, you must remember switch... case. That's right. This is what SDL uses, but you can skip it. The C style of SDL is very strong, just like the com style of DirectX. People in non-C languages prefer to encapsulate it and use it again.

Compared with dx, SDL provides faster startup speed and convenient debugging (has the DX program been debugged? (), Simple interface, a small Runtime Library, of course, the first thing is cross-platform. SDL directly supports the multimedia file format, which is very convenient compared with dx. However, SDL provides simple and direct access to the media layer, which is not as versatile as DX supports, because not every platform can provide such functionality.

In the sample code, compared with dx, the SDL sample is very short and concise, and the program process is straight-line, with no effect at all. The non-C language translation version retains the C style and does not take advantage of advanced language features, which is a pity. As for the help file, it is definitely not as good as DirectX. a lot of useful information is the comment in the header file. But after all, the C interface is much simpler than com, and it will be used to look at the function name and sample. However, you may have a headache if you do not like English. If possible, the translation is much less than DX documentation.

Where is the detailed information?

Http://www.libsdl.org/SDL home

Http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME:20450 Delphi interface project home

Http://jsdl.sourceforge.net/Java interface home

Http://csgl.sourceforge.net C # interface home

Http://phpsdl.sourceforge.net PHP interface home

What are the games using SDL?

The http://www.libsdl.org/games.php has a list, in summary very much.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.