?? kailleraclient.h
字號:
/*
Kaillera client API v0.84
(c) 2001 Christophe Thibault
History:
0.84: added moreInfos callback
0.83: added clientDropped callback
0.8 : added in-game chat function/callback
0.72: added kailleraEndGame() method
added kailleraGetVersion() method
0.7: modified kailleraModifyPlayValues behaviour
*/
#ifndef KAILLERA_CLIENT_H
#define KAILLERA_CLIENT_H
#ifdef _WIN32
//#include <windows.h>
#include <winsock2.h>
#pragma comment(lib, "Ws2_32")
#endif
#define KAILLERA_CLIENT_API_VERSION "0.8"
#ifdef KAILLERA_DLL
#define DLLEXP __declspec(dllexport) int WINAPI
#else
#define DLLEXP __declspec(dllimport) int WINAPI
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char *appName;
char *gameName;
int (WINAPI *gameCallback)(char *game, int player, int numplayers);
} kailleraInfos;
typedef int (WINAPI *gameCallback)(char *game, int player, int numplayers);//聲明回調函數
enum
{
GAME_STATE_LOGIN,
GAME_STATE_CREATE,
GAME_STATE_JOIN,
GAME_STATE_START,
GAME_STATE_MSG,
GAME_STATE_END,
SERVER_SUCCESS,
SERVER_FAIL,
GAME_STATE_EXIT
};//消息種類
#define MAX_BUFFER 256
typedef struct {
int Room;
int Desk;
char Name[10];
}LoginInfo;
typedef struct {
char GameName[10];
}CreateInfo,JoinInfo,EndInfo;
typedef struct {
char GameName[10];
int player;
int numplayers;
}StartInfo;
typedef struct {
char Msg[MAX_BUFFER];
}MsgInfo;
typedef struct {
int MsgType;
int Size;
char Buffer[MAX_BUFFER];
}GameMsg;
int SendToServer(char *buf,int buflen,int nType);
/*
kailleraInit:
Call this method when your program starts
*/
DLLEXP kailleraInit();
DLLEXP kailleraConnect(char * a_pIP,DWORD a_dwPort);//連接到服務器
DLLEXP kailleraUserLogin(int roomid,int tableid,char *playername);//登陸
DLLEXP kailleraUserLogOut();//登出,結束游戲
DLLEXP kailleraCreateGame(char * gamename);//建立新游戲
DLLEXP kailleraJoinGame(char * gamename);//加入游戲
DLLEXP kailleraStartGame();//開始游戲
/*
kailleraShutdown:
Call this method when your program ends
*/
DLLEXP kailleraShutdown();//關閉程序
/*
kailleraSetInfos:
Use this method for setting up various infos:
Required:
- appName must be 128 chars max.
- gameList is composed of all the game names separated by a NULL char (\0).
The list ends with 2 NULL chars (\0\0).
Be sure to only put available games there.
- gameCallback will be the function called when a new game starts
game -> name of the selected game
player -> player number (1-8). 0 for spectator.
numplayers -> number of players in the game (1-8)
Optional:
- chatReceivedCallback will be the function called when a chat line text
has been received. Set it to NULL if you don't need/want this callback.
- clientDroppedCallback will be the function called when a client drops
from the current game. Set it to NULL if you don't need/want this callback.
- moreInfosCallback will be the function called when the user selects
"More infos about this game..." in the game list context menu.
Set it to NULL if you don't need/want this feature.
*/
DLLEXP kailleraSetInfos(kailleraInfos *infos);
/*
kailleraModifyPlayValues:
You must call this method at every frame after you retrieved values from your input devices.
This method will record/bufferize the values you send in and will manage to mix them with
the other players.
Basically, each players sends his values and receive all players values concatened.
e.g:
t - player 1 sends "867F" - player 2 sends "964F"
t+1 - player 1 receives "867F964F" - player 2 receives "867F964F"
you may want to look at the modified MAME source code available on kaillera's home page
to have a working example out of this (look in inptport.c)
Ideally, your input values should be defined like 1 bit for a given key, which has to be
unset when the key is not pressed and set when the key is pressed.
The size of the values you pass to this function is the size for ONE player's values.
Also, it must be the SAME for a given game and should be kept to a minimum (for network
speed and latency issues).
Be sure that the values parameters has enough space for receiving all inputs from all players
(8 players max.)
returns: length received or -1 on network error (player no more in the game)
*/
DLLEXP kailleraModifyPlayValues(void *values, int size);
/*
kailleraEndGame:
Your emulation thread must call this method when the user stops the emulation
*/
DLLEXP kailleraEndGame();//關閉sock
#ifdef __cplusplus
}
#endif
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -