general.h

Go to the documentation of this file.
00001 /*
00002  * general.h
00003  *
00004  * Bogus file for doxygen.  Don't use this file!
00005  */
00006 
00007 /// \ingroup gamepad
00008 /// \defgroup gamepad_general General Gamepad Overview
00009 ///
00010 /// To use this library, you need to be aware of a few key concepts.
00011 ///  - <b>Source Devices</b>  These abstract hardware devices (such as
00012 ///     controllers, or USB adapters that expose multiple controllers).
00013 ///     Source Devices (\ref gamepad::SourceDevice) generate the raw input
00014 ///     events that are then mapped to actual gamepad objects.
00015 ///  - <b>Gamepad Types</b> A gamepad type (\ref gamepad::Type) gives information
00016 ///     about a type of gamepad, for instance, Playstation 3 or XBox 360 or 
00017 ///     Nintendo 64, etc.  Your code can look at gamepad::Type objects to
00018 ///     see how many joysticks are supported on the gamepad, how many
00019 ///     buttons, etc.
00020 ///  - <b>Mapping</b> A mapping object maps from raw Source Device events to
00021 ///     a particular Gamepad.  Mappings are required because even the exact
00022 ///     same physical gamepad device may expose different Source Device
00023 ///     events depending on USB adapters, manufacturers, etc.  In fact, most
00024 ///     of the purpose of this library is to make Mappings (gamepad::Map)
00025 ///     easy to create and manage.
00026 ///  - <b>Gamepad</b> A gamepad (gamepad::Gamepad) is an actual instance of
00027 ///     a gamepad.  Once you have a Source Device and a Mapping, you can
00028 ///     combine the two to create a logical gamepad::Gamepad device, and
00029 ///     read inputs from that.
00030 ///  - <b>Manager</b> The gamepad::Manager object is what holds all the
00031 ///     known gamepad::SourceDevice objects, all the gamepad::Map objects,
00032 ///     and all the created gamepad::Gamepad objects.
00033 ///
00034 /// \n
00035 /// <b>Configuration of Gamepads</b><br/>
00036 /// Most of the work of this library is automating the mapping from raw
00037 /// hardware inputs into meaningful gamepad events.  For instance, the
00038 /// hardware may say "axis 7 was just moved to position 55" and this
00039 /// library will do the mapping to say "gamepad 2, which is an XBox 360
00040 /// gamepad, just had its left direction pad pushed up".
00041 ///
00042 /// In general, the mappings aren't known ahead of time.  I suspect that
00043 /// directly-attached gamepads (such as Playstation 3 and XBox 360
00044 /// controllers) may have stable mappings.  But in general, gamepads will
00045 /// provide random hardware inputs, so it won't always be possible to
00046 /// hard-code the mappings.  Instead, we'll need the user (whoever is
00047 /// actually holding the controller) to configure the gamepad manually
00048 /// so we can figure the mapping out.
00049 ///
00050 /// To do that, this library exposes a Configurator object
00051 /// (gamepad::Configurator) to walk the user through configuration.
00052 /// The Configurator has no UI, just an API.  This way, the Configurator
00053 /// can be used in any rendering system (OpenGL, DirectX, whatever). 
00054 /// The gamepad-opengl project in SourceForge has an OpenGL example
00055 /// program that uses the Configurator to configure gamepads.
00056 ///
00057 /// The Configurator is designed to be run in games etc. that are running
00058 /// in a rendering loop (or other event loop).  To use the Configurator,
00059 /// create it and then call update() during each event loop (you should also
00060 /// call update() on the gamepad::Manager each iteration so that source
00061 /// devices have state updated).  The Configurator will tell you where it
00062 /// is in the configuration process, and what it wants the user to do
00063 /// next, by returning a config_status_t structure.
00064 ///
00065 /// See the configureGamepad tool as an example of how the Configurator
00066 /// can be used to configure gamepads in an event loop.  The gamepad-opengl
00067 /// sourceforge project has a graphical example.
00068 ///
00069 /// Once the Configurator has finished, it will produce a mapping
00070 /// (gamepad::Map) that you can use to create a Gamepad object.
00071 ///
00072 /// You can also save/load completed gamepad::Map objects so users don't
00073 /// have to re-configure their gamepads every time they play your game.
00074 ///
00075 /// \n
00076 /// <b>How to Use This Library</b><br/>
00077 /// Usually, your code will do this:
00078 ///  - Create a gamepad::Manager object at program startup.
00079 ///  - Call gamepad::Manager::rediscover() infrequently (once per second?)
00080 ///     to detect if gamepads have been attached or detached.
00081 ///  - Call gamepad::Manager::update() every frame to gather the most
00082 ///     recent gamepad events
00083 ///  - Use the gamepad::Configurator to help the user configure gamepads
00084 ///     when necessary.
00085 ///  - Use gamepad::Map objects (from the Configurator, or loaded from
00086 ///     disk) to create gamepad::Gamepad objects from given
00087 ///     gamepad::SourceDevice objects.
00088 ///  - Link using the single SDK library (see \ref gamepad_general_sdk)
00089 ///
00090 /// \n
00091 /// <b>Support for other Gamepad Types</b><br/>
00092 /// This library is completely data-driven.  I've provided built-in support
00093 /// for several common gamepads, such as:
00094 ///  - Playstation 2
00095 ///  - Playstation 3
00096 ///  - XBox 360
00097 ///  - Nintendo 64
00098 ///
00099 /// You can always add your own type of gamepad!  All of the data is in the
00100 /// \b data directory off the main gamepad directory.  There are two files
00101 /// you'll probably want to provide:
00102 ///  - <b>.gamepad</b>  This file contains the raw data about the gamepad,
00103 ///     such as how many joysticks, direction pads, and buttons a gamepad
00104 ///     has, and the logical name of each.
00105 ///  - <b>.vgfx</b> This file contains vector graphics rendering instructions
00106 ///     so that the gamepad can be rendered on any platform.
00107 ///
00108 /// If you add your own gamepad type, you should also provide a locale file
00109 /// in the appropriate directory in the \b strings subdirectory so that
00110 /// people can localize the user-facing strings associated with the gamepad.