HunoJoyWrapper Library version 2.0.0
Joystick/Joypad library
Prerequisite:
Installing static libraries ==> libSDL_image.a, libSDL_gfx and libSDL.a and
their include files
Concept idea of this library:
* Easy integration of joystick/joypad support in any application or SDL game
without needing to be an expert in programmation
* Easy preferences system with button swapping assignations, directional axis
swappings, Joypads/Joystick automatic count detection, information about
joysticks/joypads names
* Drivers internal owners of some joysticks
* Complete support of any joystick/joypad
Simple setting :
To incorporate this library in your code, first you have to:
* Copy the library from the archive in lib/libHJW.a to your SDK in the
"newlib/lib" directory
* Copy the includes directory of the library (named "libHJW") to the
newlib/include directory of your SDK
* To link the library, you just have to add this line in your code:
#include "libHJW/HunoJoyWrapper.h"
In order to compile:
-lHWJ -lSDL_image -lSDL_gfx
This library is "freeware" but is in no way OpenSource.
Rules regarding the integration of this library in any engine are as follow :
* You have to join the "Freeware_licenseLibHJW.txt" file in your program's
directory
* You have to activate the logo at startup of your program or game (see below
regarding the integration of the logo).
* You have to add the executable "Testing-JoysticksHWJlib.exe" in your
directory.
* You have to add a link to the archive in your readme as well as a link to my
site (http://www.clubevolution4.com/HunoPortSDL/)
* Source code and makefile of the modified part integrating joystick/joypad
support must be included in the archive in order to help potential developpers
thanks to your examples
* You have to send me a mail with the name of your application or game in which
you have added the library, it will allow me to update my list of
applications/games supporting "libHWJ" (contact: nouvel.hugues(AT)free.fr)
How to initialise the library:
In order to initialise, you have to declare in main:
extern SDL_Event event;
In order to initalize the LOGO:
//Initialize the wrapper and the logo (about the logo, you have to declare the
surface of the screen, usually "screen" but this inot compulsory, developpers
like to change). Important: the logo doesn't have any OpenGL rendering, you must
use it in 2D, thanks.
InitHunoJoyWrapper();
InitLogoHJW (Display);
Call an axial direction function:
//Declare in the events for the 1st player:
Uint8* joyHJW;
joyHJW = GetJoyStateHJW();
//In order to declare a button or an axis for the 1st player for example:
joyHJW[JOY_HJW_DOWN]/ / ===> example of integration in a code: (keys
[SDLK_DOWN] | | joyHJW [JOY_HJW_DOWN]) / / ===> The first statement is the
original one (so the keyboard event) then the second integration of the first
joystick <===
// All possibilities:
JOY_HJW_UP
JOY_HJW_DOWN
JOY_HJW_LEFT
JOY_HJW_RIGHT
JOY_HJW_B0
JOY_HJW_B1
JOY_HJW_B2
JOY_HJW_B3
JOY_HJW_B4
JOY_HJW_B5
JOY_HJW_B6
JOY_HJW_B7
JOY_HJW_B8
JOY_HJW_B9
JOY_HJW_B10
JOY_HJW_B11
JOY_HJW_B12
JOY_HJW_B13
JOY_HJW_B14
JOY_HJW_B15
JOY_HJW_B16
JOY_HJW_B17
JOY_HJW_B18
JOY_HJW_B19
//Declare in the events for the 2nd player:
Uint8* joyHJW2;
joyHJW2 = GetJoyState2HJW();
//In order to declare a button or an axis for the 2nd player for example:
joyHJW2[JOY2_HJW_DOWN]/ / ===> example of integration in a code: (keys2
[SDLK_DOWN] | | joyHJW2 [JOY2_HJW_DOWN]) / / ===> The first statement is the
original one (so the keyboard event) then the second integration of the second
joystick <===
// All possibilities:
JOY2_HJW_UP
JOY2_HJW_DOWN
JOY2_HJW_LEFT
JOY2_HJW_RIGHT
JOY2_HJW_B0
JOY2_HJW_B1
JOY2_HJW_B2
JOY2_HJW_B3
JOY2_HJW_B4
JOY2_HJW_B5
JOY2_HJW_B6
JOY2_HJW_B7
JOY2_HJW_B8
JOY2_HJW_B9
JOY2_HJW_B10
JOY2_HJW_B11
JOY2_HJW_B12
JOY2_HJW_B13
JOY2_HJW_B14
JOY2_HJW_B15
JOY2_HJW_B16
JOY2_HJW_B17
JOY2_HJW_B18
JOY2_HJW_B19
// At the end of the main, free the library
ShutdownHunoJoyWrapper ();
Keyboard shortcuts for the Joystick Test GUI
=> ESCAPE to quit
=> F5 to reload the config file after modifications
=> F10 to saving your prefs
=> F1 active on joystick 1 inverter
=> F2 disable on joystick 1 inverter
=> F3 active on joystick 2 inverter
=> F4 disable on joystick 2 inverter
=> Button + E edition of the selected button
=> Cancel button + R button to edit the selecte
Press the button you want to change (red selection) and simultaneously press the
"E" key on the keyboard, then press the desired button (both buttons will be
swapped). If you want to cancel the edit button, you select the button (red
selection) and simultaneously press the "R" key on the keyboard.
List of drivers currently supported natively:
Driver USB Joystick Adaptator HAMA Single adaptator Playstation
Driver Twin USB Joystick APM Adaptator Playstation
Driver ThrustMaster Dual Analog 3.2
Driver WingMan Precision USB
Driver Joystick FreeBox USB
Driver Joystick Cyborg V.1
Driver MadCatz Call of Duty GamePad
Driver Logitech(R) Precision(TM) Gamepad
Driver Saitek P220 Gamepad
Driver Saitek P990 Dual Analog Pad
Driver Teckmo mobility 2 IN 1 Gamepad
Driver TechMobility Mega World Gamepad
Driver Speedlink Strike2 GreenAsia Inc Gamepad
Driver SPEED-LINK Competition Pro
Driver XBOX 360 For Windows
Driver Gamepad ArcadeJoy (TM)
Driver PLAYSTATION(R)3 Controller
Driver Cyborg Force Rumble Pad
Driver RetroBoxAtari Pad
=============>Generic driver for a minimum operating a joystick having no
driver<==============
Generic Driver for HunoJoyWrapper
----IMPORTANT----
In order for me to add new drivers into the library, please send me : both
infosJoystick.dat and InfosJoystick2.dat files (they are created at program's
launch and are deleted at program's close).
You also have to configure your Joystick/JoyPad with the configuration GUI (to
map the buttons at the right place) and then send me the file HunoJoyWrapper.cfg
You can send me the 3 file at the following address : nouvel.hugues (AT) free.fr
Thank you.
| |