Browse Subversion Repository
Contents of /connection/NetInit.cpp
Parent Directory
| Revision Log
Revision 191 -
( show annotations)
( download)
( as text)
Fri Jan 4 02:49:36 2008 UTC
(16 years, 3 months ago)
by satofumi
File MIME type: text/x-c++src
File size: 828 byte(s)
using namespace beego
| 1 |
/*! |
| 2 |
\file |
| 3 |
\brief SDL_net の初期化 |
| 4 |
|
| 5 |
\author Satofumi KAMIMURA |
| 6 |
|
| 7 |
$Id$ |
| 8 |
*/ |
| 9 |
|
| 10 |
#ifdef HAVE_CONFIG_H |
| 11 |
#include "config.h" |
| 12 |
#endif |
| 13 |
#include "SdlInit.h" |
| 14 |
#include "NetInit.h" |
| 15 |
#if !HAVE_CONFIG_H || HAVE_LIBSDL_NET |
| 16 |
#include <SDL_net.h> |
| 17 |
#endif |
| 18 |
|
| 19 |
using namespace beego; |
| 20 |
|
| 21 |
|
| 22 |
/*! |
| 23 |
\brief NetInit の内部クラス |
| 24 |
*/ |
| 25 |
struct NetInit::pImpl : private SdlInit { |
| 26 |
static bool initialized; |
| 27 |
}; |
| 28 |
|
| 29 |
bool NetInit::pImpl::initialized = false; |
| 30 |
|
| 31 |
|
| 32 |
NetInit::NetInit(void) : pimpl(new pImpl) { |
| 33 |
if (pimpl->initialized == false) { |
| 34 |
#if !HAVE_CONFIG_H || HAVE_LIBSDL_NET |
| 35 |
if (SDLNet_Init() < 0) { |
| 36 |
throw; |
| 37 |
} |
| 38 |
//printf("SDLNet_Init is called\n"); |
| 39 |
atexit(SDLNet_Quit); |
| 40 |
#else |
| 41 |
// !!! エラーメッセージの出力方式を検討する |
| 42 |
fprintf(stderr, "SDL_net is not installed!\n"); |
| 43 |
#endif |
| 44 |
pimpl->initialized = true; |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
NetInit::~NetInit(void) { |
| 50 |
} |
|