Wiki Page Content

Differences between revisions 12 and 53 (spanning 41 versions)
Revision 12 as of 2010-04-28 06:48:35
Size: 10831
Editor: SheenaSmith
Comment: add content (basic format ver 2)
Revision 53 as of 2020-01-13 13:44:18
Size: 6496
Editor: markand
Comment: Add Sensors category
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
||<tablewidth="100%"style="color: rgb(255, 0, 0); text-align: center;">DRAFT ||
Line 8: Line 7:
= SDL 1.3 API by Category = = SDL 2.0 API by Category =
Line 11: Line 10:
== Functions by Type ==
=== Initialization ===
[[#InitI|Introduction to Initialization]]

||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryInit|Initialization & Shutdown]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL.h|SDL.h]] ||
||[[CategoryAtomic|Atomic Operations for 32 and 64 Bit Values]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_atomic.h|SDL_atomic.h]] ||
||[[CategoryVersion|Querying SDL Version]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_version.h|SDL_version.h]] ||
== Basics ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryInit|Initialization and Shutdown]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL.h|SDL.h]] ||
||[[CategoryHints|Configuration Variables]]||[[http://hg.libsdl.org/SDL/file/default/include/SDL_hints.h|SDL_hints.h]]||
||[[CategoryError|Error Handling]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_error.h|SDL_error.h]] ||
||[[CategoryLog|Log Handling]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_log.h|SDL_log
.h]] ||
||[[CategoryAssertions|Assertions]]||[[http://hg.libsdl.org/SDL/file/default/include/SDL_assert.h|SDL_assert.h]]||
||[[CategoryVersion|Querying SDL Version]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_version.h|SDL_version.h]] ||
Line 21: Line 22:
== Video ==
Line 22: Line 24:
<<Color2(green,Does SDL_error.h belong in this section?)>>
||[[CategoryError|Error Handling]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_error.h|SDL_error.h]] ||
||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryVideo|Display and Window Management]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_video.h|SDL_video.h]] ||
||[[CategoryRender|2D Accelerated Rendering]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_render.h|SDL_render.h]] ||
||[[CategoryPixels|Pixel Formats and Conversion Routines]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_pixels.h|SDL_pixels.h]] ||
||[[CategoryRect|Rectangle Functions]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_rect.h|SDL_rect.h]] ||
||[[CategorySurface|Surface Creation and Simple Drawing]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_surface.h|SDL_surface.h]] ||
||[[CategorySWM|Platform-specific Window Management]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_syswm.h|SDL_syswm.h]] ||
||[[CategoryClipboard|Clipboard Handling]]||[[http://hg.libsdl.org/SDL/file/default/include/SDL_clipboard.h|SDL_clipboard.h]]||
||[[CategoryVulkan|Vulkan Support]]||[[http://hg.libsdl.org/SDL/file/default/include/SDL_vulkan.h|SDL_vulkan.h]]||
Line 26: Line 35:
== Input Events ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryEvents|Event Handling]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_events.h|SDL_events.h]] ||
||[[CategoryKeyboard|Keyboard Support]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_keyboard.h|SDL_keyboard.h]]<<BR>>[[http://hg.libsdl.org/SDL/file/default/include/SDL_keycode.h|SDL_keycode.h]]<<BR>>[[http://hg.libsdl.org/SDL/file/default/include/SDL_scancode.h|SDL_scancode.h]]||
||[[CategoryMouse|Mouse Support]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_mouse.h|SDL_mouse.h]] ||
||[[CategoryJoystick|Joystick Support]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_joystick.h|SDL_joystick.h]] ||
||[[CategoryGameController|Game Controller Support]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_gamecontroller.h|SDL_gamecontroller.h]] ||
||[[CategorySensor|Sensors]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_sensor.h|SDL_sensor.h]] ||
Line 28: Line 46:
=== Video ===
[[#VideoI|Introduction to Video]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryVideo|Display Management, Window Management and Rendering]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_video.h|SDL_video.h]] ||
||[[CategoryPixels|Pixel Formats and Conversion Routines]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_pixels.h|SDL_pixels.h]] ||
||[[CategoryRect|Rectangle Functions]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_rect.h|SDL_rect.h]] ||
||[[CategorySurface|Surface Creation and Simple Drawing]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_surface.h|SDL_surface.h]] ||
||[[CategorySWM|Platform-specific Window Management]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_syswm.h|SDL_syswm.h]] ||
== Force Feedback ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryForceFeedback|Force Feedback Support]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_haptic.h|SDL_haptic.h]] ||
Line 38: Line 52:
== Audio ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryAudio|Audio Device Management, Playing and Recording]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_audio.h|SDL_audio.h]] ||
Line 40: Line 58:
=== Input ===
[[#InputI|Introduction to Input]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryJoystick|Joystick Support]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_joystick.h|SDL_joystick.h]] ||
||[[CategoryKeyboard|Keyboard Support]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_keyboard.h|SDL_keyboard.h]] ||
||[[CategoryMouse|Mouse Support]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_mouse.h|SDL_mouse.h]] ||
== Threads ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryThread|Thread Management]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_thread.h|SDL_thread.h]] ||
||[[CategoryMutex|Thread Synchronization Primitives]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_mutex.h|SDL_mutex.h]] ||
||[[CategoryAtomic|Atomic Operations]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_atomic.h|SDL_atomic.h]] ||
Line 48: Line 66:
== Timers ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryTimer|Timer Support]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_timer.h|SDL_timer.h]] ||
Line 50: Line 72:
=== Force Feedback ===
[[#FFI|Introduction to Force Feedback]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryForceFeedback|Force Feedback Support]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_haptic.h|SDL_haptic.h]] ||
== File Abstraction ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryFilesystem|Filesystem Paths]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_filesystem.h|SDL_filesystem.h]] ||
||[[CategoryIO|File I/O Abstraction]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_rwops.h|SDL_rwops.h]] ||
Line 56: Line 79:
== Shared Object Support ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategorySharedObject|Shared Object Loading and Function Lookup]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_loadso.h|SDL_loadso.h]] ||
Line 58: Line 85:
=== Audio ===
[[#AudioI|Introduction to Audio]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryAudio|Audio Device Management, Playing and Recording]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_audio.h|SDL_audio.h]] ||
== Platform and CPU Information ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryPlatform|Platform Detection]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_platform.h|SDL_platform.h]] ||
||[[CategoryCPU|CPU Feature Detection]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_cpuinfo.h|SDL_cpuinfo.h]] ||
||[[CategoryEndian|Byte Order and Byte Swapping]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_endian.h|SDL_endian.h]] ||
||[[CategoryBits|Bit Manipulation]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_bits.h|SDL_bits.h]] ||
Line 64: Line 94:
== Power Management ==

||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategoryPower|Power Management Status]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_power.h|SDL_power.h]] ||
Line 66: Line 100:
=== File I/O Abstraction ===
[[#I.2BAC8-OI|Introduction to File I/O Abstraction]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryIO|File I/O Abstraction]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_rwops.h|SDL_rwops.h]] ||
== Additional Functionality ==
Line 71: Line 102:



=== Shared Object Support ===
[[#SOSI|Introduction to Shared Object Support]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategorySharedObject|Shared Object Loading and Function Lookup]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_loadso.h|SDL_loadso.h]] ||




=== Threads ===
[[#ThreadsI|Introduction to Threads]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryThread|Thread Management]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_thread.h|SDL_thread.h]] ||
||[[CategoryMutex|Thread Synchronization Primitives]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_mutex.h|SDL_mutex.h]] ||




=== Timers ===
[[#TimersI|Introduction to Timers]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryTimer|Timer Support]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_timer.h|SDL_timer.h]] ||
||[[CategoryEvents|Event Handling]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_events.h|SDL_events.h]] ||




=== CPU Feature Detection ===
[[#CPUI|Introduction to CPU Feature Detection]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryCPU|CPU Feature Detection]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_cpuinfo.h|SDL_cpuinfo.h]] ||
||[[CategoryPlatform|Platform Detection]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_platform.h|SDL_platform.h]] ||




=== Power Management ===
[[#PowerI|Introduction to Power Management]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryPower|Power Management Status]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_power.h|SDL_power.h]] ||




=== Endian Independence ===
[[#EndianI|Introduction to Endian Independence (Byte Order and Byte Swapping)]]
||<tablewidth="100%">'''View a List of Functions Related to...''' ||'''View the Header''' ||
||[[CategoryEndian|Byte Order and Byte Swapping]] ||[[http://hg.libsdl.org/SDL/file/68dfd6df47da/include/SDL_endian.h|SDL_endian.h]] ||




----

== Introductory Information by Category ==
<<Anchor(InitI)>>'''Introduction to Initialization'''

__General__<<BR>> Functions in this category are used to set up SDL 1.3 for use and generally have global effects in your program.

__Version__<<BR>> These functions are used to collect or display information about the version of SDL that is currently being used by the program.

 . The version number consists of three segments (X.Y.Z)
  * X = Major Version, which increments with massive changes, additions, and enhancements
  * Y = Minor Version, which increments with backwards-compatible changes to the major revision
  * Z = Patchlevel, which increments with fixes to the minor revision
 ''Example:'' 1.3.0

There are four (4) macros <<Color2(green,Create a link to a resource that describes macros)>> that apply to this header.

 * [[SDL_VERSION]]
  * This macro gathers information from SDL_MAJOR_VERSION, SDL_MINOR_VERSION, AND SDL_PATCHLEVEL (#defines) and fills the structure [[SDL_version]] with that information.
 * [[SDL_version#Related_Minor_Macros|SDL_VERSIONNUM]]
  * A minor macro that converts version numbers into a numeric value.
 * [[SDL_version#Related_Minor_Macros|SDL_COMPILEDVERSION]]
  * A minor macro that produces the current SDL version number (major.minor.patchlevel)
 * [[SDL_version#Related_Minor_Macros|SDL_VERSION_ATLEAST]]
  * A minor macro that confirms whether a program was compiled with a version no older than the specified version.

<<Anchor(VideoI)>>'''Introduction to Video'''

<<Anchor(InputI)>>'''Introduction to Input'''

<<Anchor(FFI)>>'''Introduction to Force Feedback'''

The SDL Haptic subsystem allows you to control haptic (force feedback) devices.

The basic usage is as follows:

 1. Initialize the Subsystem (SDL_INIT_HAPTIC)
 1. Open a Haptic Device
  a. [[SDL_HapticOpen]]() to open from index
  a. [[SDL_HapticOpenFromJoystick]]() to open from an existing joystick
 1. Create an effect ([[SDL_HapticEffect]]) <<Color2(green,= typedef union - page? no link?)>>
 1. Upload the effect with [[SDL_HapticNewEffect]]()
 1. Run the effect with [[SDL_HapticRunEffect]]()
 1. (optional) Free the effect with [[SDL_HapticDestroyEffect]]()
 1. Close the haptic device with [[SDL_HapticClose]]()

Code Example:

{{{#!highlight cpp
int test_haptic( SDL_Joystick * joystick ) {
 SDL_Haptic *haptic;
 SDL_HapticEffect effect;
 int effect_id;

 // Open the device
 haptic = SDL_HapticOpenFromJoystick( joystick );
 if (haptic == NULL) return -1; // Most likely joystick isn't haptic

 // See if it can do sine waves
 if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
  SDL_HapticClose(haptic); // No sine effect
  return -1;
 }

 // Create the effect
 memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
 effect.type = SDL_HAPTIC_SINE;
 effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
 effect.periodic.direction.dir[0] = 18000; // Force comes from south
 effect.periodic.period = 1000; // 1000 ms
 effect.periodic.magnitude = 20000; // 20000/32767 strength
 effect.periodic.length = 5000; // 5 seconds long
 effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
 effect.periodic.fade_length = 1000; // Takes 1 second to fade away

 // Upload the effect
 effect_id = SDL_HapticNewEffect( haptic, &effect );

 // Test the effect
 SDL_HapticRunEffect( haptic, effect_id, 1 );
 SDL_Delay( 5000); // Wait for the effect to finish

 // We destroy the effect, although closing the device also does this
 SDL_HapticDestroyEffect( haptic, effect_id );

 // Close the device
 SDL_HapticClose(haptic);

 return 0; // Success
}
}}}
<<Anchor(AudioI)>>'''Introduction to Audio'''

<<Anchor(I/OI)>>'''Introduction to File I/O Abstraction'''

<<Anchor(SOSI)>>'''Introduction to Shared Object Support'''

<<Anchor(ThreadsI)>>'''Introduction to Threads'''

<<Anchor(TimersI)>>'''Introduction to Timers'''

<<Anchor(CPUI)>>'''Introduction to CPU Feature Detection'''

<<Anchor(PowerI)>>'''Introduction to Power Management'''

<<Anchor(EndianI)>>'''Introduction to Endian Independence (Byte Order and Byte Swapping)'''

----
<<Color2(green,This section is junk I don't want to lose yet but will most likely delete. Ignore it.)>> -OR -

In each section:

 * For more detailed information on each Category, including how to get started, answers to common questions and errors, and more, click the '''Introduction to...''' link in each section
 * For a list of functions found in each header click the link under '''Related Functions'''
  * You will find links to detailed pages about each function on those pages
 * For the header file itself click the link under '''Header''' in each section

-OR-

Each section below includes

 * a link to introductory information about each function type including, where relevant:
  * <<Color2(green,Add a list here of the common sections found on each introductory page as the list develops.)>>
 * a link to one or more pages containing a complete list of functions belonging to each header in that category
  * listed functions link to detailed information on each
 * a link to the header page
||<tablewidth="100%"width="75%">'''View information and functions related to...'''||'''View the header'''||
||[[CategorySystem|Platform-specific Functionality]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_system.h|SDL_system.h]] ||
||[[CategoryStandard|Standard Library Functionality]] ||[[http://hg.libsdl.org/SDL/file/default/include/SDL_stdinc.h|SDL_stdinc.h]] ||

SDL 2.0 API by Category

Basics

View information and functions related to...

View the header

Initialization and Shutdown

SDL.h

Configuration Variables

SDL_hints.h

Error Handling

SDL_error.h

Log Handling

SDL_log.h

Assertions

SDL_assert.h

Querying SDL Version

SDL_version.h

Video

View information and functions related to...

View the header

Display and Window Management

SDL_video.h

2D Accelerated Rendering

SDL_render.h

Pixel Formats and Conversion Routines

SDL_pixels.h

Rectangle Functions

SDL_rect.h

Surface Creation and Simple Drawing

SDL_surface.h

Platform-specific Window Management

SDL_syswm.h

Clipboard Handling

SDL_clipboard.h

Vulkan Support

SDL_vulkan.h

Input Events

View information and functions related to...

View the header

Event Handling

SDL_events.h

Keyboard Support

SDL_keyboard.h
SDL_keycode.h
SDL_scancode.h

Mouse Support

SDL_mouse.h

Joystick Support

SDL_joystick.h

Game Controller Support

SDL_gamecontroller.h

Sensors

SDL_sensor.h

Force Feedback

View information and functions related to...

View the header

Force Feedback Support

SDL_haptic.h

Audio

View information and functions related to...

View the header

Audio Device Management, Playing and Recording

SDL_audio.h

Threads

View information and functions related to...

View the header

Thread Management

SDL_thread.h

Thread Synchronization Primitives

SDL_mutex.h

Atomic Operations

SDL_atomic.h

Timers

View information and functions related to...

View the header

Timer Support

SDL_timer.h

File Abstraction

View information and functions related to...

View the header

Filesystem Paths

SDL_filesystem.h

File I/O Abstraction

SDL_rwops.h

Shared Object Support

View information and functions related to...

View the header

Shared Object Loading and Function Lookup

SDL_loadso.h

Platform and CPU Information

View information and functions related to...

View the header

Platform Detection

SDL_platform.h

CPU Feature Detection

SDL_cpuinfo.h

Byte Order and Byte Swapping

SDL_endian.h

Bit Manipulation

SDL_bits.h

Power Management

View information and functions related to...

View the header

Power Management Status

SDL_power.h

Additional Functionality

View information and functions related to...

View the header

Platform-specific Functionality

SDL_system.h

Standard Library Functionality

SDL_stdinc.h

None: APIByCategory (last edited 2020-01-13 13:44:18 by markand)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit