官方网址

http://www.libsdl.org/

1. Introduction to SDL

 

1.1. What is SDL?

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source code.

  • For the latest information on what is supported see the page about Installation.

SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python.

  • For the latest list of languages see http://www.libsdl.org/languages.php

SDL 2.0 is distributed under the zlib license. This license allows you to use SDL freely in any software. The Simple DirectMedia Layer library (SDL) is a general API that provides low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D framebuffer across multiple platforms.

 

1.2. What can SDL do?

Read ahead for an overview of what SDL is capable of. If you're simply interested in the changes from 1.2 to 2.0, check out the Migration Guide.

Video

  • 3D graphics:
    • SDL can be used in combination with the OpenGL API or Direct3D API for 3D graphics
  • Accelerated 2D render API:
    • Supports easy rotation, scaling and alpha blending, all accelerated using modern 3D APIs
    • Acceleration is supported using OpenGL and Direct3D, and there is a software fallback
  • Create and manage multiple windows

Input Events

  • Events and API functions provided for:
    • Application and window state changes
    • Mouse input
    • Keyboard input
    • Joystick and game controller input
    • Multitouch gestures
  • Each event can be enabled or disabled with SDL_EventState()

  • Events are passed through a user-specified filter function before being posted to the internal event queue
  • Thread-safe event queue

Force Feedback

  • Force feedback is supported under Windows, Mac OS X and Linux

Audio

  • Set audio playback of 8-bit and 16-bit audio, mono stereo or 5.1 surround sound, with optional conversion if the format is not supported by the hardware
  • Audio runs independently in a separate thread, filled via a user callback mechanism
  • Designed for custom software audio mixers, but SDL_mixer provides a complete audio/music output library

File I/O Abstraction

  • General purpose abstraction for opening, reading and writing data
  • Built-in support for files and memory

Shared Object Support

  • Load shared objects (DLL on Windows, .dylib on Mac OS X, .so on Linux)
  • Lookup functions in shared objects

Threads

  • Simple thread creation API
  • Simple thread local storage API
  • Mutexes, semaphores and condition variables
  • Atomic operations for lockless programming

Timers

  • Get the number of milliseconds elapsed
  • Wait a specified number of milliseconds
  • Create timers that run alongside your code in a separate thread
  • Use high resolution counter for profiling

CPU Feature Detection

  • Query the number of CPUs
  • Detect CPU features and supported instruction sets

Endian Independence

  • Detect the endianness of the current system
  • Routines for fast swapping of data values
  • Read and write data of a specified endianness

Power Management

  • Querying power management status

 

1.3. What platforms does SDL run on?

Windows

  • Uses Win32 APIs for display, taking advantage of Direct3D for hardware acceleration
  • Uses DirectSound and XAudio2 for sound

Mac OS X

  • Uses Cocoa for video display, taking advantage of OpenGL for hardware acceleration
  • Uses Core Audio for sound

Linux

  • Uses X11 for video display, taking advantage of OpenGL for hardware acceleration
  • Uses the ALSA, OSS and PulseAudio APIs for sound

iOS

  • Uses UIKit for video display, taking advantage of OpenGL ES 2.0 for hardware acceleration
  • Uses Core Audio for sound

Android

  • Uses JNI interfaces for video display, taking advantage of OpenGL ES 1.1 and 2.0 for hardware acceleration
  • Uses JNI audio callbacks for sound
  • See also Android

 

2. How to get and install SDL

You can get the source code and build and install it.

 

3. Transitioning from SDL 1.2 to 2.0

If you used SDL 1.2 previously and you want to use SDL 2.0, please note there are some API changes and some of your code will need to be adapted.

The migration guide lists the feature differences and how to adapt old code to the new SDL 2.0:

  • Migration Guide

 

官方Android 使用说明:

http://wiki.libsdl.org/Android

 

网友写的 Android sdl demo:

1,渲染一个图片

https://blog.csdn.net/ywl5320/article/details/73525531

 

2,播放视频

 

https://blog.csdn.net/danjuan123/article/details/65444098

更多相关文章

  1. I2C-Tools 4.0使用说明及android平台移植,提供源码下载路径
  2. android- activity,Application,activity渲染xml文件
  3. Android(安卓)[Camera 源码] 外接 USB 摄像头(External USB Came
  4. Android串口开发,基于官方的android-serialport-api增加支持设置
  5. android官方下载链接最新版 (Windows版本)
  6. android官方下载链接最新版 (Windows版本)
  7. Android官方DrawerLayout 抽屉式侧滑菜单-简单使用方法
  8. 【Android开发问题集】布局加载器异常的问题
  9. Android(安卓)Studio使用说明

随机推荐

  1. eclipse中android结构整理
  2. android 3D 游戏实现之人物行走(MD2)
  3. Android(安卓)商品筛选功能实现
  4. adb无线调试,摆脱数据线的束缚~
  5. Android坦克大战游戏设计解析一
  6. 引擎日记 2011.2.21
  7. Android实现遮罩层(蒙板)效果
  8. Android源码设计模式分析一期发布
  9. AndEngine进阶之自定义可拖动的背景
  10. Android(安卓)2.2 带来全新拍照增强特性