void
ShowImage(FIBITMAP *src)
{
	MSG msg;
	FIBITMAP *src2;

	// initialize window classes
	InitMainWnd();

	hwndMain = CreateMainWnd();
	hdc = GetDC(hwndMain);

	assert(hdc != NULL);

	src2 = FreeImage_ConvertToStandardType(src);

	int width = FreeImage_GetWidth(src2);
	int height = FreeImage_GetHeight(src2);

	hbitmap = GetDibSection(src2, hdc, 0, 0, width, height);
	
	assert(hbitmap != NULL);

	hbitmap_hdc = CreateCompatibleDC(hdc);

	// Associate the new DC with the bitmap for drawing 
	SelectObject( hbitmap_hdc, hbitmap );

	ShowWindow(hwndMain, 1);

	// message-loop
	while(GetMessage(&msg, NULL, 0, 0) > 0)
	{
		DispatchMessage(&msg);
	}
}
Exemple #2
0
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nShowCmd)
{
    MSG		msg;
    HACCEL	hAccel;
    TCHAR	arg[MAX_PATH];
    TCHAR *	pszCmdline;

    EnableCrashingOnCrashes();

    //INITCOMMONCONTROLSEX icx = { sizeof(icx), ICC_
    g_hInstance = hInst;

    // This program requires COM
    OleInitialize(0);

    //
    //	Commandline processing
    //

    pszCmdline = GetArg(GetCommandLineW(), arg, MAX_PATH);

    if(pszCmdline && *pszCmdline == '-')
    {
        pszCmdline = GetArg(pszCmdline, arg, MAX_PATH);

        // 'touch' the specified file!
        if(lstrcmpi(arg, TEXT("-touch")) == 0)
        {
            // check to see if it's a quoted filename
            if(*pszCmdline == '\"')
            {
                GetArg(pszCmdline, arg, MAX_PATH);
                pszCmdline = arg;
            }

            if(!TouchFile(pszCmdline))
            {
                HexWinErrorBox(GetLastError(), 0);
                return 1;
            }
            return 0;
        }
        else
        {
            pszCmdline = GetArg(pszCmdline, arg, MAX_PATH);
        }
    }


    {
        INITCOMMONCONTROLSEX icex = { sizeof(icex), -1 };
        InitCommonControlsEx(&icex);
    }

    /*g_Config = OpenConfig(TEXT("mapsize.exe.129082349834.bookmarks"));
    smeg(g_Config, TEXT("bookmarks.bookmark."), TEXT("mapsize.exe"));
    SaveConfig(TEXT("oof.config"), g_Config);*/
    LoadSettings();

    RegisterTabView();
    InitMainWnd();
    CreateMainWnd();


    // open file specified on commmand line?
    if(pszCmdline && *pszCmdline)
    {
        // check to see if it's a quoted filename
        if(*pszCmdline == '\"')
        {
            GetArg(pszCmdline, arg, MAX_PATH);
            pszCmdline = arg;
        }

        if(!HexeditOpenFile(g_hwndMain, pszCmdline, DefaultFileMode()))//HVOF_DEFAULT))
        {
            SendMessage(g_hwndMain, WM_COMMAND, IDM_FILE_NEW, 0);
        }
    }
    // automatically create new document if none specified
    else
    {
        SendMessage(g_hwndMain, WM_COMMAND, IDM_FILE_NEW, 0);
    }

    InitDockingBars(g_hwndMain);

    if(g_fRestoreWinPos)
        nShowCmd = SW_SHOW;

    ShowWindow(g_hwndMain, nShowCmd);

    // force any floating popups (i.e. the DOCKWNDs) to
    // become visible at the same time
    //ShowOwnedPopups(g_hwndMain, TRUE);
    DockWnd_ShowDeferredPopups(g_hwndMain);

    //
    // load keyboard accelerator table
    //
    hAccel = LoadAccelerators(GetModuleHandle(0)/*g_hResourceModule*/, MAKEINTRESOURCE(IDR_ACCELERATOR1));

    //
    // message-pump
    //
    while(GetMessage(&msg, 0, 0, 0) > 0)
    {
        if(!TranslateAccelerator(g_hwndMain, hAccel, &msg))
        {
            if( !IsDialogMessage(g_hwndSearch, &msg) &&
                    !IsDialogMessage(g_hwndGoto, &msg)   &&
                    !DockWnd_IsDialogMessage(g_hwndMain, DWID_TYPEVIEW, &msg) &&
                    !DockWnd_IsDialogMessage(g_hwndMain, DWID_SEARCHBAR, &msg) &&
                    !DockWnd_IsDialogMessage(g_hwndMain, DWID_HIGHLIGHT, &msg)
              )
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
    }

    SaveSettings();

    // Shutdown COM
    OleUninitialize();

    return 0;
}
Exemple #3
0
VOID CGameProcedure::InitStaticMemeber(VOID)
{
	//-------------------------------------------------------------------
	// 初始化随即变量种子
	srand( (unsigned)timeGetTime() );

	//-------------------------------------------------------------------
	// 注册本地类
	g_theKernel.ReisgerClass(GETCLASS(tNode));
	// 网络管理器
	g_theKernel.ReisgerClass(GETCLASS(CNetManager));
	// 场景管理器
	g_theKernel.ReisgerClass(GETCLASS(CWorldManager));
	// 物体管理器
	g_theKernel.ReisgerClass(GETCLASS(CObjectManager));
	g_theKernel.ReisgerClass(GETCLASS(CObject));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Surface));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Effect));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Bullet));
	//g_theKernel.ReisgerClass(GETCLASS(CObject_SkillObj));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Special));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Map));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Static));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Building));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Dynamic));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Character));
	g_theKernel.ReisgerClass(GETCLASS(CObject_PlayerMySelf));
	g_theKernel.ReisgerClass(GETCLASS(CObject_PlayerNPC));
	g_theKernel.ReisgerClass(GETCLASS(CObject_PlayerOther));
	g_theKernel.ReisgerClass(GETCLASS(CObject_ProjTex));
	g_theKernel.ReisgerClass(GETCLASS(CObject_ProjTex_MouseTarget));
	g_theKernel.ReisgerClass(GETCLASS(CObject_ProjTex_AuraDure));
	g_theKernel.ReisgerClass(GETCLASS(CObject_ProjTex_BloodStain));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_Transport));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_ItemBox));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_ItemDrop));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_Resource));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_Platform));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Bus));

	// 图形系统
	g_theKernel.ReisgerClass(GETCLASS(CEngineInterface));
	// 输入管理器
	g_theKernel.ReisgerClass(GETCLASS(CInputSystem));
	// 计时器
	g_theKernel.ReisgerClass(GETCLASS(tTimeSystem));
	// 声音管理器
	g_theKernel.ReisgerClass(GETCLASS(CSoundSystemFMod));
	// 数据库管理器
	g_theKernel.ReisgerClass(GETCLASS(CDataBaseSystem));
	// 数据库管理器
	g_theKernel.ReisgerClass(GETCLASS(CVariableSystem));
	// UI操作接口
	g_theKernel.ReisgerClass(GETCLASS(CGameInterface));
	// UI数据池
	g_theKernel.ReisgerClass(GETCLASS(CUIDataPool));
	g_theKernel.ReisgerClass(GETCLASS(CDataPool));
	// UI鼠标操作类
	g_theKernel.ReisgerClass(GETCLASS(CCursorMng));
	// 脚本系统
	g_theKernel.ReisgerClass(GETCLASS(CScriptSystem));
	// 事件系统
	g_theKernel.ReisgerClass(GETCLASS(CEventSystem));
	// 操作管理
	g_theKernel.ReisgerClass(GETCLASS(CActionSystem));
	// UI模型显示管理
	g_theKernel.ReisgerClass(GETCLASS(CFakeObjSystem));
	// 外接帮助系统
	g_theKernel.ReisgerClass(GETCLASS(CHelperSystem));
	// 资源
	g_theKernel.ReisgerClass(GETCLASS(CResourceProvider));
	// 物品传输系统
	g_theKernel.ReisgerClass(GETCLASS(CTransferItemSystem));
	//注册定时器
	g_theKernel.ReisgerClass(GETCLASS(CTimerManager));

	//-------------------------------------------------------------------
	// 加载插件中的类
//	PROFILE_PUSH(LoadPluginDll);
//	g_theKernel.LoadPlugin(_T("Debuger.dll"), &g_theKernel);
#ifdef USEOGRELIB
extern VOID InstallUISystem( tKernel* pKernel );

	InstallUISystem(&g_theKernel);
#else
	g_theKernel.LoadPlugin(_T("UI_CEGUI.dll"), &g_theKernel);
#endif
	

//	PROFILE_POP(LoadPluginDll);

	//-------------------------------------------------------------------
	// 初始化所有的循环实例
	s_pProcLogIn			= new CGamePro_Login();			// 登录循环
	s_pProcCharSel			= new CGamePro_CharSel();		// 人物选择流程
	s_pProcCharCreate		= new CGamePro_CharCreate();	// 人物创建流程
	s_pProcEnter			= new CGamePro_Enter();			// 等待进入场景流程
	s_pProcMain				= new CGamePro_Main();			// 主游戏循环
	s_pProcChangeScene		= new CGamePro_ChangeScene();	// 服务器切换流程


	//-------------------------------------------------------------------
	// 初始化数据核心
	//0. 输入管理器
	s_pInputSystem		= (tInputSystem*)		g_theKernel.NewNode( _T("CInputSystem"), _T("bin"), _T("input"));  
	//1. 计时器
	s_pTimeSystem		= (tTimeSystem*)		g_theKernel.NewNode( _T("tTimeSystem"), _T("bin"), _T("time"));  
	//2. 网络管理器
	s_pNetManager		= (CNetManager*)		g_theKernel.NewNode( _T("CNetManager"), _T("bin"), _T("netman"));  
	//3. 音效管理器
	s_pSoundSystem		= (tSoundSystem*)		g_theKernel.NewNode( _T("CSoundSystemFMod"), _T("bin"), _T("snd"));
	//4. 渲染器节点
	s_pGfxSystem		= (tGfxSystem*)			g_theKernel.NewNode( _T("CEngineInterface"), _T("bin"), _T("gfx"));
	//5. 调试器节点
//	s_pDebuger			= (tDebuger*)			g_theKernel.NewNode( _T("tDebuger"), _T("bin"), _T("debuger"));
	//6. 物体管理器
	s_pObjectManager	= (tObjectSystem*)		g_theKernel.NewNode( _T("CObjectManager"), _T("bin"), _T("objman"));  
	//7. UI管理器
	s_pUISystem			= (tUISystem*)			g_theKernel.NewNode( _T("CUISystem"), _T("bin"), _T("ui_"));
	//8. 数据库管理器
	s_pDataBaseSystem	= (tDataBaseSystem*)	g_theKernel.NewNode( _T("CDataBaseSystem"), _T("bin"), _T("dbc"));
	//9. 世界管理器
	s_pWorldManager		= (tWorldSystem*)		g_theKernel.NewNode( _T("CWorldManager"), _T("bin"), _T("worldman"));  
	//10. 系统变量管理器
	s_pVariableSystem	= (tVariableSystem*)	g_theKernel.NewNode( _T("CVariableSystem"), _T("bin"), _T("var"));
	//11. 接口管理器
	s_pGameInterface	= (tGameInterfaceBase*) g_theKernel.NewNode( _T("CGameInterface"), _T("bin"), _T("interface"));
	//12. UI数据池
	s_pUIDataPool		= ( tUIDataPool* )		g_theKernel.NewNode( _T( "CUIDataPool" ), _T( "bin" ), _T( "datapool" ) );
	s_pDataPool			= ( tDataPool* )		g_theKernel.NewNode( _T( "CDataPool" ), _T( "bin" ), _T( "datapool_" ) );
	//13. 鼠标指针管理器
	s_pCursorMng		= ( tCursorSystem* )	g_theKernel.NewNode( _T( "CCursorMng"), _T( "bin" ), _T("cursor" ) );
	//14. 脚本系统
	s_pScriptSystem		= ( tScriptSystem* )	g_theKernel.NewNode( _T( "CScriptSystem"), _T( "bin" ), _T("script" ) );
	//15. 事件系统
	s_pEventSystem		= ( tEventSystem* )		g_theKernel.NewNode( _T( "CEventSystem"), _T( "bin" ), _T("event" ) );
	//16. 操作管理
	s_pActionSystem		= ( tActionSystem* )	g_theKernel.NewNode( _T( "CActionSystem"), _T( "bin" ), _T("action" ) );
	//17. UI模型显示管理
	s_pFakeObjSystem	= ( tFakeObjSystem* )	g_theKernel.NewNode( _T( "CFakeObjSystem"), _T( "bin" ), _T("fake" ) );
	//18. 外接帮助系统
	s_pHelperSystem		= ( tHelperSystem* )	g_theKernel.NewNode( _T( "CHelperSystem"), _T( "bin" ), _T("helper" ) );
	//19. 资源提供
	s_pResourceProvider	= (tResourceProvider*)	g_theKernel.NewNode( _T( "CResourceProvider"), _T( "bin" ), _T("resprovider" ) );
	//20.定时器
	tTimerSystem* timerSys = (tTimerSystem*)g_theKernel.NewNode(_T("CTimerManager"), _T("bin"), _T("timer") );
	timerSys->Initial(NULL);
	//21.物品传输系统
	s_pTransferItemSystem = (tTransferItemSystem*)g_theKernel.NewNode(_T("CTransferItemSystem"), _T("bin"), _T("transfer"));

	// 在创建主窗口之前先加载配置表
	s_pVariableSystem	->Initial(NULL);

	//-------------------------------------------------------------------
	// 创建主窗口
	CreateMainWnd();

	//-------------------------------------------------------------------
	// 初始化工作节点

	s_pEventSystem		->Initial(NULL);
	s_pGfxSystem		->Initial(&g_hMainWnd);
	s_pScriptSystem		->Initial(NULL);
	s_pDataBaseSystem	->Initial(NULL);
	s_pTimeSystem		->Initial(NULL);
	s_pNetManager		->Initial(NULL); 
	s_pWorldManager		->Initial(NULL); 
	s_pObjectManager	->Initial(NULL); 
//	if(s_pDebuger)		
//		s_pDebuger		->Initial(NULL); 
	if(s_pUISystem)		
		s_pUISystem		->Initial(NULL);
	s_pInputSystem		->Initial(NULL); 
	s_pSoundSystem		->Initial(&g_hMainWnd);
	s_pUIDataPool		->Initial(NULL);
	s_pDataPool			->Initial(NULL);
	s_pCursorMng		->Initial(&g_hInstance);
	s_pActionSystem		->Initial(NULL);
	s_pGameInterface	->Initial(NULL);
	s_pFakeObjSystem	->Initial(NULL);
	s_pHelperSystem		->Initial(NULL);
	s_pResourceProvider	->Initial(NULL);
	s_pTransferItemSystem->Initial(NULL);


	s_pSkillDataMgr	= new CSkillDataMgr;
	s_pSkillDataMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_SKILL_DATA )->GetDBCFile() );

	s_pBuffImpactMgr = new CBuffImpactMgr;
	s_pBuffImpactMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_BUFF_IMPACT )->GetDBCFile() );

	s_pDirectlyImpactMgr = new CDirectlyImpactMgr;
	s_pDirectlyImpactMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_DIRECTLY_IMPACT )->GetDBCFile() );

	s_pBulletDataMgr = new CBulletDataMgr;
	s_pBulletDataMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_BULLET_DATA ) );
	s_pBulletEntityManager = new CBulletEntityManager;
	
	// camp
	s_pCampDataMgr = new CampAndStandDataMgr_T;
	s_pCampDataMgr->InitFromDBMemory(s_pDataBaseSystem->GetDataBase(DBC_CAMP_AND_STAND)->GetDBCFile());

	s_pActionSetMgr	= new CActionSetMgr;
	s_pActionSetMgr->Init( "ActionSet/" );	

	// 每日活动功能
	s_pDaytipsDataMgr	= new DaytipsDataMgr;
	s_pDaytipsDataMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_DAY_TIPS )->GetDBCFile() );
	
	// 任务表
	s_pQuestLogDataMgr	= new QuestLogDataMgr;
	s_pQuestLogDataMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_QUEST_LOG )->GetDBCFile() );

	//-------------------------------------------------------------------
	// 创建Tick驱动
	INT nMaxFPS = s_pVariableSystem->GetAs_Int("System_MaxFPS");
	if(nMaxFPS < 5 || nMaxFPS >150) 
		nMaxFPS = 30;

	m_hTickEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
	::ResetEvent(m_hTickEvent);
	m_hEventTimer = ::timeSetEvent((INT)(1000.0f/nMaxFPS), (INT)(1000.0f/nMaxFPS), EventTimerProc, 0, TIME_PERIODIC|TIME_CALLBACK_FUNCTION); 

	// ------------------------------------------------------------------
	// 通过关闭窗口事件,来实现初始化所有窗口。
	// 解决了在游戏中初始化窗口时卡的问题。

	std::vector< STRING > vParam;
	CHAR szTemp[MAX_PATH];

	_snprintf(szTemp, MAX_PATH, "%d", 0);
	vParam.push_back(szTemp);

	vParam.push_back("distance");

	_snprintf(szTemp, MAX_PATH, "%.3f", 1.0f);
	vParam.push_back(szTemp);

	CEventSystem::GetMe()->PushEvent(GE_OBJECT_CARED_EVENT, vParam);
}
VOID CGameProcedure::InitStaticMemeber(VOID)
{
	//-------------------------------------------------------------------
	//初始化随即变量种子
	srand( (unsigned)timeGetTime() );

	//-------------------------------------------------------------------
	// 注册本地类
	g_theKernel.ReisgerClass(GETCLASS(tNode));
	//网络管理器
	g_theKernel.ReisgerClass(GETCLASS(CNetManager));
	//场景管理器
	g_theKernel.ReisgerClass(GETCLASS(CWorldManager));
	//物体管理器
	g_theKernel.ReisgerClass(GETCLASS(CObjectManager));
	g_theKernel.ReisgerClass(GETCLASS(CObject));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Surface));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Effect));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Bullet));
	//g_theKernel.ReisgerClass(GETCLASS(CObject_SkillObj));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Special));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Map));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Static));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Building));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Dynamic));
	g_theKernel.ReisgerClass(GETCLASS(CObject_Character));
	g_theKernel.ReisgerClass(GETCLASS(CObject_PlayerMySelf));
	g_theKernel.ReisgerClass(GETCLASS(CObject_PlayerNPC));
	g_theKernel.ReisgerClass(GETCLASS(CObject_PlayerOther));
	g_theKernel.ReisgerClass(GETCLASS(CObject_ProjTex));
	g_theKernel.ReisgerClass(GETCLASS(CObject_ProjTex_MouseTarget));
	g_theKernel.ReisgerClass(GETCLASS(CObject_ProjTex_AuraDure));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_Transport));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_ItemBox));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_Resource));
	g_theKernel.ReisgerClass(GETCLASS(CTripperObject_Platform));

	//输入管理器
	g_theKernel.ReisgerClass(GETCLASS(CInputSystem));
	//计时器
	g_theKernel.ReisgerClass(GETCLASS(tTimeSystem));
	//声音管理器
	g_theKernel.ReisgerClass(GETCLASS(CSoundSystemFMod));
	//数据库管理器
	g_theKernel.ReisgerClass(GETCLASS(CDataBaseSystem));
	//数据库管理器
	g_theKernel.ReisgerClass(GETCLASS(CVariableSystem));
	//UI操作接口
	g_theKernel.ReisgerClass(GETCLASS(CGameInterface));
	//UI数据池
	g_theKernel.ReisgerClass(GETCLASS(CUIDataPool));
	g_theKernel.ReisgerClass(GETCLASS(CDataPool));
	//UI鼠标操作类
	g_theKernel.ReisgerClass(GETCLASS(CCursorMng));
	//脚本系统
	g_theKernel.ReisgerClass(GETCLASS(CScriptSystem));
	//事件系统
	g_theKernel.ReisgerClass(GETCLASS(CEventSystem));
	//操作管理
	g_theKernel.ReisgerClass(GETCLASS(CActionSystem));
	//UI模型显示管理
	g_theKernel.ReisgerClass(GETCLASS(CFakeObjSystem));
	//外接帮助系统
	g_theKernel.ReisgerClass(GETCLASS(CHelperSystem));

	//-------------------------------------------------------------------
	// 加载插件中的类
//	PROFILE_PUSH(LoadPluginDll);
//	g_theKernel.LoadPlugin(_T("Debuger.dll"), &g_theKernel);
	g_theKernel.LoadPlugin(_T("WXRender.dll"), &g_theKernel);
	g_theKernel.LoadPlugin(_T("UISystem.dll"), &g_theKernel);
//	PROFILE_POP(LoadPluginDll);

	//-------------------------------------------------------------------
	//初始化所有的循环实例
	s_pProcLogIn			= new CGamePro_Login();			//!< 登录循环
	s_pProcCharSel			= new CGamePro_CharSel();		//!< 人物选择流程
	s_pProcCharCreate		= new CGamePro_CharCreate();	//!< 人物创建流程
	s_pProcEnter			= new CGamePro_Enter();			//!< 等待进入场景流程
	s_pProcMain				= new CGamePro_Main();			//!< 主游戏循环
	s_pProcChangeScene		= new CGamePro_ChangeScene();	//!< 服务器切换流程



	
	// 初始化数据核心
//0. 输入管理器
	s_pInputSystem	= (tInputSystem*)	g_theKernel.NewNode(_T("CInputSystem"), _T("bin"), _T("input"));  
//1. 计时器
	s_pTimeSystem	= (tTimeSystem*)	g_theKernel.NewNode(_T("tTimeSystem"), _T("bin"), _T("time"));  
//2. 网络管理器
	s_pNetManager	= (CNetManager*)	g_theKernel.NewNode(_T("CNetManager"), _T("bin"), _T("netman"));  
//3. 音效管理器
	s_pSoundSystem  = (tSoundSystem*)	g_theKernel.NewNode(_T("CSoundSystemFMod"), _T("bin"), _T("snd"));
//4. 渲染器节点
	s_pGfxSystem	= (CRenderSystem*)	g_theKernel.NewNode(_T("CRenderSystem"), _T("bin"), _T("gfx"));
//5. 调试器节点
//	s_pDebuger		= (tDebuger*)		g_theKernel.NewNode(_T("TDDebuger"), _T("bin"), _T("debuger"));
//6. 物体管理器
	s_pObjectManager= (tObjectSystem*)	g_theKernel.NewNode(_T("CObjectManager"), _T("bin"), _T("objman"));  
//7. UI管理器
	s_pUISystem		= (tUISystem*)		g_theKernel.NewNode(_T("CUISystem"), _T("bin"), _T("ui_"));
//8. 世界管理器
	s_pWorldManager = (tWorldSystem*)	g_theKernel.NewNode(_T("CWorldManager"), _T("bin"), _T("worldman"));  
//9. 数据库管理器
	s_pDataBaseSystem	= (tDataBaseSystem*)	g_theKernel.NewNode(_T("CDataBaseSystem"), _T("bin"), _T("dbc"));
//10. 系统变量管理器
	s_pVariableSystem	= (tVariableSystem*)	g_theKernel.NewNode(_T("CVariableSystem"), _T("bin"), _T("var"));
//11. 接口管理器
	s_pGameInterface	= ( tGameInterfaceBase* ) g_theKernel.NewNode( _T("CGameInterface"), _T("bin"), _T("interface"));
//12. UI数据池
	s_pDataPool			= ( tDataPool* ) g_theKernel.NewNode( _T( "CUIDataPool" ), _T( "bin" ), _T( "datapool" ) );
	s_pDataPool_		= ( tDataPool_* ) g_theKernel.NewNode( _T( "CDataPool" ), _T( "bin" ), _T( "datapool_" ) );
//13. 鼠标指针管理器
	s_pCursorMng		= ( tCursorSystem* ) g_theKernel.NewNode( _T( "CCursorMng"), _T( "bin" ), _T("cursor" ) );
//14. 脚本系统
	s_pScriptSystem		= ( tScriptSystem* ) g_theKernel.NewNode( _T( "CScriptSystem"), _T( "bin" ), _T("script" ) );
//15. 事件系统
	s_pEventSystem		= ( tEventSystem* ) g_theKernel.NewNode( _T( "CEventSystem"), _T( "bin" ), _T("event" ) );
//16. 操作管理
	s_pActionSystem		= ( tActionSystem* ) g_theKernel.NewNode( _T( "CActionSystem"), _T( "bin" ), _T("action" ) );
//17. UI模型显示管理
	s_pFakeObjSystem	= ( tFakeObjSystem* ) g_theKernel.NewNode( _T( "CFakeObjSystem"), _T( "bin" ), _T("fake" ) );
//18. 外接帮助系统
	s_pHelperSystem		= ( tHelperSystem* ) g_theKernel.NewNode( _T( "CHelperSystem"), _T( "bin" ), _T("helper" ) );

//19. 资源提供
	s_pResourceProvider	= ( CResourceProvider* ) g_theKernel.NewNode( _T( "CResourceProvider"), _T( "bin" ), _T("resprovider" ) );

	//-------------------------------------------------------------------
	//初始化工作节点
	s_pVariableSystem	->Initial(NULL);
	s_pEventSystem		->Initial(NULL);
	//-------------------------------------------------------------------
	// 创建主窗口
	CreateMainWnd();

	//-------------------------------------------------------------------
	s_pGfxSystem		->Initial(&g_hMainWnd);
	s_pScriptSystem		->Initial(NULL);
	s_pDataBaseSystem	->Initial(NULL);
	s_pTimeSystem		->Initial(NULL);
	s_pNetManager		->Initial(NULL); 
	s_pWorldManager		->Initial(NULL); 
	s_pObjectManager	->Initial(NULL); 
	if(s_pDebuger)		s_pDebuger->Initial(NULL); 
	if(s_pUISystem)		s_pUISystem->Initial(NULL);
	s_pInputSystem		->Initial(NULL); 
	s_pSoundSystem		->Initial(&g_hMainWnd);
	s_pDataPool			->Initial(NULL);
	s_pDataPool_		->Initial(NULL);
	s_pCursorMng		->Initial(&g_hInstance);
	s_pActionSystem		->Initial(NULL);
	s_pGameInterface	->Initial(NULL);
	s_pFakeObjSystem	->Initial(NULL);
	s_pHelperSystem		->Initial(NULL);
	s_pResourceProvider	->Initial(NULL);


	s_pSkillDataMgr	= new CSkillDataMgr;
	s_pSkillDataMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_SKILL_DATA )->GetDBCFile() );

	s_pBuffImpactMgr	= new CBuffImpactMgr;
	s_pBuffImpactMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_BUFF_IMPACT )->GetDBCFile() );

	s_pDirectlyImpactMgr	= new CDirectlyImpactMgr;
	s_pDirectlyImpactMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_DIRECTLY_IMPACT )->GetDBCFile() );

	s_pBulletDataMgr	= new CBulletDataMgr;
	s_pBulletDataMgr->Init( s_pDataBaseSystem->GetDataBase( DBC_BULLET_DATA ) );
	//camp
	s_pCampDataMgr	= new CampAndStandDataMgr_T;
	s_pCampDataMgr->InitFromDBMemory(s_pDataBaseSystem->GetDataBase(DBC_CAMP_AND_STAND)->GetDBCFile());

	s_pActionSetMgr	= new CActionSetMgr;
	s_pActionSetMgr->Init( "ActionSet/" );

	//-------------------------------------------------------------------
	//创建Tick驱动
	INT nMaxFPS = s_pVariableSystem->GetAs_Int("System_MaxFPS");
	if(nMaxFPS < 5 || nMaxFPS >150) nMaxFPS = 30;

	m_hTickEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
	::ResetEvent(m_hTickEvent);
	m_hEventTimer = ::timeSetEvent((INT)(1000.0f/nMaxFPS), (INT)(1000.0f/nMaxFPS), EventTimerProc, 0, TIME_PERIODIC|TIME_CALLBACK_FUNCTION); 

	// 2006-2-27
	// 初试化 人物创建过程, 在这里面创建了男 , 女人物主角, 避免在进入游戏过程中, 创建很慢.
	if(s_pProcCharCreate)
	{
		s_pProcCharCreate->CallInit();
	}//
}
Exemple #5
0
//
//	Entry-point for text-editor application
//
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int iShowCmd)
{
	MSG			msg;
	HACCEL		hAccel;
	TCHAR		**argv;
	int			argc;
	//TCHAR		*pszCmdlineFile = 0;
	TCHAR		arg[MAX_PATH];

	//
	// get the first commandline argument
	//
	TCHAR *pszCmdline = GetArg(GetCommandLineW(), arg, MAX_PATH);
	argv = GetArgvCommandLine(&argc);

	// check if we have any options
	if(pszCmdline && *pszCmdline == '-')
	{
		pszCmdline = GetArg(pszCmdline, arg, MAX_PATH);

		// do the user-account-control thing
		if(lstrcmpi(arg, _T("-uac")) == 0)
		{
			//return 0;
		}
		// image-file-execute-options
		else if(lstrcmpi(arg, _T("-ifeo")) == 0)
		{
			// skip notepad.exe
			pszCmdline = GetArg(pszCmdline, arg, MAX_PATH);
		}
		// unrecognised option
		else
		{
		}
	}


	// has a prior instance elevated us to admin in order to 
	// modify some system-wide settings in the registry?
	if(argv && argc == 4 && lstrcmpi(argv[1], _T("-uac")) == 0)
	{
		g_fAddToExplorer	= _ttoi(argv[2]);
		g_fReplaceNotepad	= _ttoi(argv[3]);

		if(SetExplorerContextMenu(g_fAddToExplorer) &&
			SetImageFileExecutionOptions(g_fReplaceNotepad))
		{
			SaveRegSysSettings();
			return 0;
		}
		else
		{
			return ERROR_ACCESS_DENIED;
		}
	}

	// default to the built-in resources
	g_hResourceModule = hInst;

	OleInitialize(0);

	// initialize window classes
	InitMainWnd();
	InitTextView();

	LoadRegSettings();

	// create the main window!
	g_hwndMain = CreateMainWnd();

	// open file specified on commmand line
	if(pszCmdline && *pszCmdline)
	{
		// check to see if it's a quoted filename
		if(*pszCmdline == '\"')
		{
			GetArg(pszCmdline, arg, MAX_PATH);
			pszCmdline = arg;
		}

		NeatpadOpenFile(g_hwndMain, pszCmdline);
		LoadFileData(pszCmdline, g_hwndMain);
	}
	// automatically create new document if none specified
	else
	{
		PostMessage(g_hwndMain, WM_COMMAND, IDM_FILE_NEW, 0);
	}

	ApplyRegSettings();
	ShowWindow(g_hwndMain, iShowCmd);

	//
	// load keyboard accelerator table
	//
	hAccel = LoadAccelerators(g_hResourceModule, MAKEINTRESOURCE(IDR_ACCELERATOR1));

	
	//
	// message-loop
	//
	while(GetMessage(&msg, NULL, 0, 0) > 0)
	{
		if(!TranslateAccelerator(g_hwndMain, hAccel, &msg))
		{
			if((!IsWindow(g_hwndSearchDlg) || !IsDialogMessage(g_hwndSearchDlg, &msg)))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
	}

	if(g_fSaveOnExit)
		SaveRegSettings();

	OleUninitialize();
	ExitProcess(0);
	return 0;
}