njGetPeripheral Japanese
--|INDEX|->
Gets information of input device(peripheral).

FORMAT

#include <NinjaWin.h>
NJS_PERIPHERAL *njGetPeripheral(port)
Uint32 port

PARAMETER

port
Peripheral port number

NJD_PORT_SYSKEYBOARDSystem keyboard
NJD_PORT_SYSMOUSE System mouse
NJD_PORT_JOYSTICK1 Joystick port 1
:
NJD_PORT_JOYSTICK16 Joystick port 16


RETURN VALUE

The address of peripheral structure

FUNCTION


EXAMPLE

Sint32 njUserMain(void)
{
NJS_PERIPHERAL* per;

/* Gets information of peripheral which is
 * connected to joystick port1. 
 */
per = njGetPeripheral(NJD_DEV_JOYSTICK1);

if(per->id == NJD_DEV_NODEVICE){
/* Peripheral disconnected */
}

if(per->push & NJD_DGT_ST){
/* Start button is pushed (edge) */
}

if(per->on & NJD_DGT_KU){
/* Directional key is pushed */
}

if((per->on & (NJD_DGT_TA | NJD_DGT_TB))==(NJD_DGT_TA | NJD_DGT_TB){
/* Judgement for some buttons pushed
 * simultaneously - Both buttons A and B are pushed.
 */

}

return NJS_USER_CONTINUE;
}

NOTES


RELATED TOPICS

njPrintPeripheralInfo
NjWinDef.h

njGetPeripheral
--|INDEX|->

Copyright SEGA ENTERPRISES, LTD., 1997