/*
 *  Shinobi Library
 *  Copyright (c) 1998 SEGA
 *
 *       Keyboard
 *
 *  Module  : Library Header File
 *  File    : sg_pdkbd.h
 *  Create  : 1998-03-25
 *  Modify  : 1999-01-20
 *  Version : 1.06
 *  Note    :
 */

#ifndef _KBD_H_
#define _KBD_H_

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include <shinobi.h>

/******** キーボード情報構造体 *********************************************/
typedef struct {
	Uint8 lang;                           /* キーボード言語                */
	Uint8 type;                           /* キーボードタイプ              */
	Uint8 reserved[2];                    /* 予約                          */
} PDS_KEYBOARDINFO;

typedef struct {
	Uint8 used;
	Uint8 rate;
	Uint8 delay;
	Uint8 rate_count;
	Uint8 delay_count;
	Uint8 repeat_flag;
	Uint8 predata;
	Uint8 old_data[8];
	Uint32 port;
	Uint32 putp;
	Uint32 getp;
	Uint8* buf;
	Uint32 bufsize;
	Uint32 linep;
	char* line;
} PDS_KBDSTRUCT;

typedef PDS_KBDSTRUCT* PD_KBD;


/*
 *  PROTOTYPES
 */

const PDS_KEYBOARDINFO* pdKbdGetInfo(Uint32 port);

void pdKbdInit(void);
void pdKbdSetState(PD_KBD hKbd, Uint8 rate, Uint8 delay);
void pdKbdGetState(PD_KBD hKbd, Uint8* rate, Uint8* delay);
Sint32 pdKbdIsHit(PD_KBD hKbd);
PD_KBD pdKbdCreate(Uint32 port);
void pdKbdDestroy(PD_KBD kbd);
char pdKbdGetChar(PD_KBD hKbd);
void pdKbdExecServer(void);
void pdKbdExecServerOne(PD_KBD hKbd);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* _KBD_H_ */
