DirectX Substitute SDL Introduction

zhaozj2021-02-11  180

DirectX Substitute SDL Introduction

What is SDL?

That is, Simple DirectMedia Layer, use the LGPL license.

Free cross-platform multimedia application programming interface for games, game development tools, simulators, sample demonstrations, multimedia applications, etc.

What can it do?

Video, audio, events, CDROM support, thread, timer, various image file format read, quick draw, mix, game rod support, network, MPEG decoding, etc., and the CPU byte order is independent.

The correspondence with DirectX is as follows:

SDL_Video, SDL_Image, OpenGL - DirectDraw, Direct3DSDL_Audio, SDL_Mixer - DirectSoundSDL_Joystick, SDL_Base - DirectInputSDL_Net - DirectPlaySMPEG, SDL_Video, SDL_Audio, SDL_Sound, SDL_Filter - DirectShow fonts, window managers, and other utilities, and a large number of samples

What platforms support?

Linux installs Win32 to install Win32 to a few smaller DLLBEOS MACOS, Macos X Other non-official transplants

What programming languages ​​can be used in?

Almost all! SDL itself is written in C, there are various languages. Simple function call, no COM.

Personal view (does not represent any group and others)

Overall, SDL is not very good, but it is one of the few DX alternatives. Some people will ask why they don't have to use DX, and they don't have not much. At least lazy people always want to do more with less Kung Fu. For most people, regardless of DX, OpenGL or SDL, is a low-level API, especially DX, if you are proficient in DX, then congratulations, your hardware knowledge is also good. If you pay attention, you will find that today's games are available: Direct3D, OpenGL, GLIDE is still Software, both that many game manufacturers have designed their own high-rise APIs as needed, and the bottom layer can be replaced. Then some people say that the high-level manufacturers are fully developed hardware features, then I will give an example. Although many 2D games have used DirectDraw, but pure software is rendered in the memory frame buffer, and finally Call DirectDRAW to swap the image to the screen. For 2D games, Today's machine configuration, GDI plus direct frame buffer operation is sufficient, you need to use 3D technology when you need more advanced rendering capabilities, which is why DirectDraw and Direct 3D are replaced by 3D DirectGraphics. But the most important thing is to choose SDL means cross-platform.

Back to the topic. Like DX, the part of the SDL can be used alone, but there must be SDL_BASE. Window message management is very antique, write Win32 program must remember Switch ... case, there is this, but it is entirely available. SDL's C is very strong, just like DirectX's COM style, people who use non-Class Class C-language will be more willing to pack it.

Compared with DX, SDL has a faster start speed, convenient debugging (debugging DX program?: (), Simple interface, small runtime library, of course, the primary is cross-platform. SDL directly supports many media File format, which is very convenient to DX. But SDL simply directly access the media layer, not like DX support so many features, of course, because it is not per platform to provide so many features.

Above the sample code, the sample is very short, the program process is linear, and the effect is not bad. The non-C language translation version retains C's style, no advanced language characteristics, is a regret. As for help files, it is absolutely better than DirectX, and many useful information are comments in the header file. However, after all, the C interface is much simpler than COM, and it will be used in the function name and sample. But there is no Chinese information, you don't like reading English, you may have a headache. If possible, everyone is divided into translation, after all, more than DX documents. Where is the details?

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 page

http://csgl.sourceforge.net C # interface home page

http://phpsdl.sourceforge.net PHP interface home page

What are the games using SDL?

Http://www.libsdl.org/games.php There is a list, there is a lot.

转载请注明原文地址:https://www.9cbs.com/read-5109.html

New Post(0)