diff -r f49254ddfc67 -r 273ad375d64e frontlib/frontlib.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/frontlib/frontlib.h Thu May 31 00:35:06 2012 +0200 @@ -0,0 +1,37 @@ +/* + * Public header file for the hedgewars frontent networking library. + * + * This is the only header you should need to include from frontend code. + */ + +#ifndef FRONTLIB_H_ +#define FRONTLIB_H_ + +#define FRONTLIB_SDL_ALREADY_INITIALIZED 1 + +/** + * Call this function before anything else in this library. + * + * If the calling program uses SDL, it needs to call SDL_Init before initializing + * this library and then pass FRONTLIB_SDL_ALREADY_INITIALIZED as flag to this function. + * + * Otherwise, pass 0 to let this library handle SDL_Init an SDL_Quit itself. + * + * Returns 0 on success, -1 on error. + */ +int flib_init(int flags); + +/** + * Free resources associated with the library. Call this function once + * the library is no longer needed. You can re-initialize the library by calling + * flib_init again. + */ +void flib_quit(); + +/** + * Start listening for a connection from the engine. + * Returns the port we are listening on, which needs to be passed to the engine. + */ +int flib_ipc_listen(); + +#endif /* FRONTLIB_H_ */