Misplaced Pages

Simple DirectMedia Layer

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

In computing , cross-platform software (also called multi-platform software , platform-agnostic software , or platform-independent software ) is computer software that is designed to work in several computing platforms . Some cross-platform software requires a separate build for each platform, but some can be directly run on any platform without special preparation, being written in an interpreted language or compiled to portable bytecode for which the interpreters or run-time packages are common or standard components of all supported platforms.

#131868

49-611: Simple DirectMedia Layer ( SDL ) is a cross-platform software development library designed to provide a hardware abstraction layer for computer multimedia hardware components . Software developers can use it to write high-performance computer games and other multimedia applications that can run on many operating systems such as Android , iOS , Linux , macOS , and Windows . SDL manages video , audio , input devices , threads , shared object loading, networking and timers. For 3D graphics, it can handle an OpenGL , Vulkan , Metal , or Direct3D11 (older Direct3D version 9

98-420: A fat binary . The use of different toolsets may not be enough to build a working executables for different platforms. In this case, programmers must port the source code to the new platform. For example, an application such as Firefox, which already runs on Windows on the x86 family, can be modified and re-built to run on Linux on the x86 (and potentially other architectures) as well. The multiple versions of

147-412: A library 's existing interface into a compatible interface. This is done for several reasons: Wrapper libraries can be implemented using the adapter , façade , and to a lesser extent, proxy design patterns . The specific way in which a wrapper library is implemented is highly specific to the environment it is being written in and the scenarios which it intends to address. This is especially true in

196-583: A JVM. Java software can be executed by a hardware-based Java processor . This is used mostly in embedded systems. Java code running in the JVM has access to OS-related services, like disk input/output (I/O) and network access, if the appropriate privileges are granted. The JVM makes the system calls on behalf of the Java application. This lets users to decide the appropriate protection level, depending on an access-control list (ACL). For example, disk and network access

245-442: A client/web-server architecture. The distinction between traditional and web applications is not always clear. Features, installation methods and architectures for web and traditional applications overlap and blur the distinction. Nevertheless, this simplifying distinction is a common and useful generalization. Traditional application software has been distributed as binary files, especially executable files . Executables only support

294-466: A cross-platform application may run on Linux , macOS and Microsoft Windows . Cross-platform software may run on many platforms, or as few as two. Some frameworks for cross-platform development are Codename One , ArkUI-X, Kivy , Qt , GTK , Flutter , NativeScript , Xamarin , Apache Cordova , Ionic , and React Native . Platform can refer to the type of processor (CPU) or other hardware on which an operating system (OS) or application runs,

343-483: A game with the intention of release on the latest Nintendo and Sony game consoles. Should Disney license the game with Sony first, it may be required to release the game solely on Sony's console for a short time or indefinitely . Several developers have implemented ways to play games online while using different platforms. Psyonix , Epic Games , Microsoft , and Valve all possess technology that allows Xbox 360 and PlayStation 3 gamers to play with PC gamers, leaving

392-443: A third. While this is straightforward, compared to developing for only one platform it can cost much more to pay a larger team or release products more slowly. It can also result in more bugs to be tracked and fixed. Another approach is to use software that hides the differences between the platforms. This abstraction layer insulates the application from the platform. Such applications are platform agnostic . Applications that run on

441-527: A time-consuming task because different OSs have different application programming interfaces (API). Software written for one OS may not automatically work on all architectures that OS supports. Just because software is written in a popular programming language such as C or C++ , it does not mean it will run on all OSs that support that language—or even on different versions of the same OS. Web applications are typically described as cross-platform because, ideally, they are accessible from any web browser :

490-469: A workaround for this problem. Tools such as the Page Object Model allow cross-platform tests to be scripted so that one test case covers multiple versions of an app. If different versions have similar user interfaces, all can be tested with one test case. Web applications are becoming increasingly popular but many computer users still use traditional application software which does not rely on

539-517: Is free and open-source software subject to the requirements of the zlib License since version 2.0, and with prior versions subject to the GNU Lesser General Public License . Under the zlib License, SDL 2.0 is freely available for static linking in closed-source projects, unlike SDL 1.2, although it's possible for the user to override the statically linked library with one provided by them. SDL 2.0, released in 2013,

SECTION 10

#1732782830132

588-700: Is IBM PowerVM Lx86 , which allows Linux/x86 applications to run unmodified on the Linux/Power OS. Example of cross-platform binary software: A script can be considered to be cross-platform if its interpreter is available on multiple platforms and the script only uses the facilities built into the language. For example, a script written in Python for a Unix-like system will likely run with little or no modification on Windows, because Python also runs on Windows; indeed there are many implementations (e.g. IronPython for .NET Framework ). The same goes for many of

637-418: Is a combination of both. An exception is Java , which uses an OS-independent virtual machine (VM) to execute Java bytecode . Some software platforms are: The Java language is typically compiled to run on a VM that is part of the Java platform. The Java virtual machine (Java VM, JVM) is a CPU implemented in software, which runs all Java code. This enables the same code to run on all systems that implement

686-477: Is a common VM platform which runs on many OSs and hardware types. A hardware platform can refer to an instruction set architecture . For example: ARM or the x86 architecture. These machines can run different operating systems. Smartphones and tablets generally run ARM architecture, these often run Android or iOS and other mobile operating systems . A software platform can be either an operating system (OS) or programming environment , though more commonly it

735-516: Is a term that can also apply to video games released on a range of video game consoles . Examples of cross-platform games include: Miner 2049er , Tomb Raider: Legend , FIFA series , NHL series and Minecraft . Each has been released across a variety of gaming platforms, such as the Wii , PlayStation 3 , Xbox 360 , personal computers , and mobile devices . Some platforms are harder to write for than others, requiring more time to develop

784-417: Is also supported) context. A common misconception is that SDL is a game engine . However, the library is suited to building games directly, or is usable indirectly by engines built on top of it. The library is internally written in C and possibly, depending on the target platform, C++ or Objective-C , and provides the application programming interface in C, with bindings to other languages available. It

833-430: Is available on Windows, macOS (both PowerPC and x86 through what Apple Inc. calls a Universal binary ), Linux, and BSD on multiple computer architectures. The four platforms (in this case, Windows, macOS, Linux, and BSD) are separate executable distributions, although they come largely from the same source code . In rare cases, executable code built for several platforms is combined into a single executable file called

882-456: Is divided into several subsystems: Besides this basic, low-level support, there also are a few separate official libraries that provide some more functions. These comprise the "standard library", and are provided on the official website and included in the official documentation: Other, non-standard libraries also exist. For example: SDL_Collide on SourceForge created by Amir Taaki . The SDL 2.0 library has language bindings for: Because of

931-399: Is initialization (RAII) in the new Mutex and Lock classes to ensure Mutex s are eventually unlocked and pthread_mutex_t objects are automatically released. The above code closely mimics the implementation of boost::scoped_lock and boost::mutex which are part of the boost::thread library. Some wrapper libraries exist to act as a bridge between a client application and

980-448: Is separation of functionality, which disables functionality not supported by browsers or OSs, while still delivering a complete application to the user. (See also: Separation of concerns .) This technique is used in web development where interpreted code (as in scripting languages) can query the platform it is running on to execute different blocks conditionally. Third-party libraries attempt to simplify cross-platform capability by hiding

1029-547: Is the practice of deliberately writing software to work on more than one platform. There are different ways to write a cross-platform application. One approach is to create multiple versions of the same software in different source trees —in other words, the Microsoft Windows version of an application might have one set of source code files and the Macintosh version another, while a FOSS *nix system might have

SECTION 20

#1732782830132

1078-604: Is to provide a common framework for accessing these functions for multiple operating systems (cross-platform). SDL provides support for 2D pixel operations, sound, file access, event handling, timing and threading. It is often used to complement OpenGL by setting up the graphical output and providing mouse and keyboard input, since OpenGL comprises only rendering. A game using the Simple DirectMedia Layer will not automatically run on every operating system; further adaptations must be applied. These are reduced to

1127-496: Is used to run games such as Quake . Over the years SDL was used for many commercial and non-commercial video game projects. For instance, MobyGames listed 120 games using SDL in 2013, and the SDL website itself listed around 700 games in 2012. Important commercial examples are Angry Birds , Unreal Tournament , and games developed using Valve 's Source Engine , which uses SDL extensively for cross-platform compatibility; ones from

1176-411: Is used with this technique. Cross-platform applications need much more integration testing . Some web browsers prohibit installation of different versions on the same machine. There are several approaches used to target multiple platforms, but all of them result in software that requires substantial manual effort for testing and maintenance. Techniques such as full virtualization are sometimes used as

1225-764: Is usually enabled for desktop applications, but not for browser-based applets . The Java Native Interface (JNI) can also be used to access OS-specific functions, with a loss of portability. Currently, Java Standard Edition software can run on Microsoft Windows, macOS, several Unix-like OSs, and several real-time operating systems for embedded devices. For mobile applications, browser plugins are used for Windows and Mac based devices, and Android has built-in support for Java. There are also subsets of Java, such as Java Card or Java Platform, Micro Edition , designed for resource-constrained devices. For software to be considered cross-platform, it must function on more than one computer architecture or OS. Developing such software can be

1274-521: The emulators , such as DOSBox , FUSE ZX Spectrum emulator and VisualBoyAdvance . There were several books written for development with SDL (see further reading). SDL is used in university courses teaching multimedia and computer science , for instance, in a workshop about game programming using libSDL at the University of Cadiz in 2010, or a Game Design discipline at UTFPR (Ponta Grossa campus) in 2015. Cross-platform For example,

1323-422: The open-source scripting languages . Unlike binary executable files, the same script can be used on all computers that have software to interpret the script. This is because the script is generally stored in plain text in a text file . There may be some trivial issues, such as the representation of a new line character . Some popular cross-platform scripting languages are: Cross-platform or multi-platform

1372-583: The JVM are built this way. Some applications mix various methods of cross-platform programming to create the final application. An example is the Firefox web browser, which uses abstraction to build some of the lower-level components, with separate source subtrees for implementing platform-specific features (like the GUI), and the implementation of more than one scripting language to ease software portability . Firefox implements XUL , CSS and JavaScript for extending

1421-486: The browser is the platform. Web applications generally employ a client–server model , but vary widely in complexity and functionality. It can be hard to reconcile the desire for features with the need for compatibility. Basic web applications perform all or most processing from a stateless server , and pass the result to the client web browser. All user interaction with the application consists of simple exchanges of data requests and server responses. This type of application

1470-473: The browser, in addition to classic Netscape -style browser plugins. Much of the browser itself is written in XUL, CSS, and JavaScript. There are many tools available to help the process of cross-platform programming: There are many challenges when developing cross-platform software. Wrapper library Wrapper libraries (or library wrappers ) consist of a thin layer of code (a " shim ") which translates

1519-460: The case when cross-language/runtime interoperability is a consideration. The following provides a general illustration of a common wrapper library implementation. In this example, a C++ interface acts as a "wrapper" around a C interface. The original C interface can be regarded as error prone, particularly in the case where users of the library forget to unlock an already locked mutex. The new interface effectively utilizes resource acquisition

Simple DirectMedia Layer - Misplaced Pages Continue

1568-449: The code may be stored as separate codebases, or merged into one codebase. An alternative to porting is cross-platform virtualization , where applications compiled for one platform can run on another without modification of the source code or binaries. As an example, Apple's Rosetta , which is built into Intel -based Macintosh computers, runs applications compiled for the previous generation of Macs that used PowerPC CPUs. Another example

1617-470: The code, but can be worthwhile where the amount of platform-specific code is high. This strategy relies on having one codebase that may be compiled to multiple platform-specific formats. One technique is conditional compilation . With this technique, code that is common to all platforms is not repeated. Blocks of code that are only relevant to certain platforms are made conditional, so that they are only interpreted or compiled when needed. Another technique

1666-424: The company plans are currently on hold due to time constraints. Soon after putting Galaxy Gameworks on hold, Lantinga announced that SDL 1.3 (which would then later become SDL 2.0) would be licensed under the zlib License . Lantinga announced SDL 2.0 on 14 July 2012, at the same time announcing that he was joining Valve , the first version of which was announced the same day he joined the company. Lantinga announced

1715-447: The complexities of client differentiation behind a single, unified API, at the expense of vendor lock-in . Responsive web design (RWD) is a Web design approach aimed at crafting the visual layout of sites to provide an optimal viewing experience—easy reading and navigation with a minimum of resizing, panning, and scrolling—across a wide range of devices, from mobile phones to desktop computer monitors. Little or no platform-specific code

1764-526: The decision of which platform to use to consumers. The first game to allow this level of interactivity between PC and console games (Dreamcast with specially produced keyboard and mouse) was Quake 3 . Games that feature cross-platform online play include Rocket League , Final Fantasy XIV , Street Fighter V , Killer Instinct , Paragon and Fable Fortune , and Minecraft with its Better Together update on Windows 10 , VR editions, Pocket Edition and Xbox One . Cross-platform programming

1813-399: The library, first releasing it in early 1998, while working for Loki Software . He got the idea while porting a Windows application to Macintosh. He then used SDL to port Doom to BeOS (see Doom source ports ). Several other free libraries were developed to work alongside SDL, such as SMPEG and OpenAL . He also founded Galaxy Gameworks in 2008 to help commercially support SDL, although

1862-401: The minimum, since SDL also contains a few abstraction APIs for frequent functions offered by an operating system. The syntax of SDL is function-based: all operations done in SDL are done by passing parameters to subroutines (functions). Special structures are also used to store the specific information SDL needs to handle. SDL functions are categorized under several different subsystems. SDL

1911-454: The more recent versions of popular web browsers. These features include Ajax , JavaScript , Dynamic HTML , SVG , and other components of rich web applications . Because of the competing interests of compatibility and functionality, numerous design strategies have emerged. Many software systems use a layered architecture where platform-dependent code is restricted to the upper- and lowermost layers. Graceful degradation attempts to provide

1960-565: The open-source domain are OpenTTD , The Battle for Wesnoth or Freeciv . The cross-platform game releases of the popular Humble Indie Bundles for Linux, Mac and Android are often SDL-based. SDL is also often used for later ports on new platforms with legacy code. For instance, the PC game Homeworld was ported to the Pandora handheld and Jagged Alliance 2 for Android via SDL. Also, several non video game programs use SDL; examples are

2009-542: The platform they were built for—which means that a single cross-platform executable could be very bloated with code that never executes on a particular platform. Instead, generally there is a selection of executables, each built for one platform. For software that is distributed as a binary executable, such as that written in C or C++, there must be a software build for each platform, using a toolset that translates—transcompiles—a single codebase into multiple binary executables. For example, Firefox , an open-source web browser,

Simple DirectMedia Layer - Misplaced Pages Continue

2058-497: The same or similar functionality to all users and platforms, while diminishing that functionality to a least common denominator for more limited client browsers. For example, a user attempting to use a limited-feature browser to access Gmail may notice that Gmail switches to basic mode, with reduced functionality but still of use. Some software is maintained in distinct codebases for different (hardware and OS) platforms, with equivalent functionality. This requires more effort to maintain

2107-415: The stable release of SDL 2.0.0 on 13 August 2013. SDL 2.0 is a major update to the SDL 1.2 codebase with a different, not backwards-compatible API . It replaces several parts of the 1.2 API with more general support for multiple input and output options. Some feature additions include multiple window support, hardware-accelerated 2D graphics, and better Unicode support. Support for Mir and Wayland

2156-509: The type of OS, or a combination of the two. An example of a common platform is Android which runs on the ARM architecture family . Other well-known platforms are Linux / Unix , macOS and Windows , these are all cross-platform. Applications can be written to depend on the features of a particular platform—either the hardware, OS, or virtual machine (VM) it runs on. For example, the Java platform

2205-497: The video game to the same standard. To offset this, a video game may be released on a few platforms first, then later on others. Typically, this happens when a new gaming system is released, because video game developers need to acquaint themselves with its hardware and software. Some games may not be cross-platform because of licensing agreements between developers and video game console manufacturers that limit development to one particular console. As an example, Disney could create

2254-407: The way SDL is designed, much of its source code is split into separate modules for each operating system, to make calls to the underlying system. When SDL is compiled, the appropriate modules are selected for the target system. The following back-ends are available: An unofficial Sixel back-end is available for SDL 1.2. The Rockbox MP3 player firmware also distributes a version of SDL 1.2, which

2303-416: Was a major departure from previous versions, offering more opportunity for 3D hardware acceleration, but breaking backwards-compatibility, a wrapper library made to translate 1.2 calls to 2.0 was later made available. SDL is extensively used in the industry in both large and small projects. By 2010, over 700 games, 180 applications, and 120 demos had been posted on the library website. Sam Lantinga created

2352-451: Was added in SDL 2.0.2 and enabled by default in SDL 2.0.4. Version 2.0.4 also provided better support for Android. In 2024, the stable preview of SDL 3.1.3 was released. It makes the API more consistent and allows access to more parts of the device, along with other features. SDL is a wrapper around the operating-system-specific functions that the game needs to access. The only purpose of SDL

2401-565: Was the norm in the early phases of World Wide Web application development. Such applications follow a simple transaction model, identical to that of serving static web pages . Today, they are still relatively common, especially where cross-platform compatibility and simplicity are deemed more critical than advanced functionality. Prominent examples of advanced web applications include the Web interface to Gmail and Google Maps . Such applications routinely depend on additional features found only in

#131868