コード例 #1
0
ファイル: XConsoleMain.cpp プロジェクト: xahgo/tama
void XConsoleMain::Create( void )
{
	XLIB = CreateXLibrary();
	XE::xtLoadType typeLoad = XE::xLT_PACKAGE_ONLY;
	for( int i = 0; i < XE::xLT_MAX; ++i ) {
		if( OnSelectLoadType( ( XE::xtLoadType ) i ) ) {
			typeLoad = ( XE::xtLoadType ) i;
			break;
		}
	}
	XE::InitResourceManager( this, typeLoad );

	//	XArrayLinear<_tstring> ary;
	//	LPCTSTR pathPackage = XE::GetPathPackageRoot();
	//	int num = XSYSTEM::CreateFileList( pathPackage, _T("*.*"), &ary );
	//
	const auto seedNew = xGenerateSeed();
	xSRand( seedNew );
	srand( seedNew );
	// 	xSRand( timeGetTime() );
	// 	srand( timeGetTime() );

	CTimer::Initialize();		// pause가능한 가상타이머를 초기화한다

	// text_ko같은것도 앞으로 이쪽으로 옮겨올 예정이므로 그것도 고려해야함.
	DidFinishCreate();		// this의 Create가 끝난후 다른 Create가 있다면 하위클래스에 맡긴다.

}
コード例 #2
0
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    // Set up the highest resolution timer we can manage 
//	TIMECAPS tc; 
//	UINT nPeriod;
//	if( TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)) ) 
//		nPeriod = tc.wPeriodMin;
//	else
//		nPeriod = 1;  
//	timeBeginPeriod( nPeriod ); 

	HWND hWnd;
	g_hMainWnd	= hWnd	= CreateWindow(g_szWindowClass, g_szTitle, WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

	int x = 480, y = 0;
	SetWindowPos( hWnd, NULL, x, y, 800, 416, SWP_SHOWWINDOW );

	if (!hWnd)
		return FALSE;

	SetTimer( g_hMainWnd, 0, SEC( 60 ), NULL );	// 60
	SetTimer( g_hMainWnd, 1, MIN( 60 ), NULL );	// 3600

	CTime time = CTime::GetCurrentTime();
	SetLogInfo( LOGTYPE_TIME, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );

	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);

#ifndef _DEBUG
// 	#if defined(__MINIDUMP)
// 		InitDumper( DUMP_LEVEL_0 );
// 	#else
// 		InitEH();
// 	#endif // !__MINIDUMP
#endif	// _DEBUG

	EnableFloatException();

	if( InitializeNetLib() == FALSE )
		return FALSE;

	if( InitializeScriptLib() == FALSE )
		return FALSE;

	xSRand( timeGetTime()  );	// 속도를 요하는 랜덤은 xRandom()을 쓰도록...

	if( Script( g_szINI ) == TRUE )
	{
		if( !prj.OpenProject( "Masquerade.prj" ) ) 
		{
			Error( "OpenProject ERROR check Masquerade.prj" );
			return FALSE;
		}

		SetLogInfo( LOGTYPE_REDRAW, "" );
		SetTitle();

		if( CompileItemScript( "ItemScript.lua" ) == FALSE )
			return FALSE;

	#if defined(__REMOVE_SCIRPT_060712)
		if( CWorldDialog::GetInstance().Init() == FALSE )
		{
			OutputDebugString( "WorldDialog.DLL load failed\n" );
			return FALSE;
		}
	#endif
		return CRunObject::GetInstance()->Init();
	}
	else
	{
		char szBuffer[300] = {0,};
		char szDir[255] = {0,};
		GetCurrentDirectory( 255, szDir );
		sprintf( szBuffer, "%s\\WorldServer.ini File not found", szDir );
		AfxMessageBox( szBuffer );
		return FALSE;
	}
}