hge教程适合初学者
文件大小: 229k
源码售价: 10 个金币 积分规则     积分充值
资源说明:HGE子窗口 Running HGE in a child window hosted by a Windows application may be useful to create authoring tools and ActiveX controls or to integrate HGE into a third party IDE. Here follow the guidelines how to do that. 运行HGE在主机的子窗口经由Windows系统可以帮助建立创造工具和ActiveX控制器或者将HGE整合到第三方IDE中。这里需要遵循一定的规定。 Creating HGE window as a child 建造HGE子窗口 To run HGE in a child window mode you should just specify the parent window handle. To do this set HGE_HWNDPARENT system state before calling to System_Initiate: 想要运行在子窗口模式运行HGE你必须指定出父窗口的名称。在调用System_Initiate之前需要先设置HGE_HWNDPARENT的系统状态: hge->System_SetState(HGE_HWNDPARENT, hwnd); Mouse cursor 鼠标指针 You may prefer HGE to use standard Windows cursor while in child window mode. This can be done by setting HGE_HIDEMOUSE system state to false: 你可以在将HE做为子窗口的模式下使用标准的Windows 指针。可以设定HGE_HIDEMOUSE系统状态为假: hge->System_SetState(HGE_HIDEMOUSE, false); Dispatching application's messages and running Frame Function 分派请求信息和运行框架函数 To provide additional flexibility System_Start behaves a bit differently in child window mode. First, it returns after just one call to user's frame function regardless of the value returned by it. Second, it doesn't dispatch window messages.So you should set up your own message processing loop.Here's the simpliest loop enough to run HGE properly: 在不同的子窗口模式下System_Start应灵活的控制使用。首先,不必在意调用使用者框架函数之后的返回值的内容。其次,不能分派窗口信息。所以你需要建立你的专有信息循环程序。如下这样简单的循环程序足够完全运行HGE: for(;;) { if(hge->System_GetState(HGE_HWND)) hge->System_Start(); if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) break; DispatchMessage(&msg); } } Moving and resizing HGE window 移动和改变HGE窗口大小 You can move and resize HGE window with WinAPI functions like MoveWindow. When it's window resized, HGE will reinitiate DirectX to meet new window dimensions: 你可以像用WinAPI函数那样移动和调整HGE窗口大小。调整好窗口大小之后,HGE将会控制DirectX去迎合新窗口的尺寸: MoveWindow(hge->System_GetState(HGE_HWND), x, y, width, height, true); Destroying HGE window 终结HGE窗口 HGE has lots of resources associated with it's window. So you should use System_Shutdown call to free them, don't rely on just destroying the window.The good place to do this is WM_DESTROY handler of the parent window: HGE的很多资源都是和它的窗口相互关联的。所以你需要使用System_Shutdown命令去释放它们,不能依赖于终结窗口去释放它们。在父窗口下使用WM_DESTROY: case WM_DESTROY: FreeLoadedHGEResources(); hge->System_Shutdown(); PostQuitMessage(0); return FALSE; Child window mode limitations 子窗口模式的限制 1. To accept keyboard events in child window mode HGE window must have input focus. It gains focus automatically when you click somewhere inside. Use the following call to set the focus explicitly: 1.在子窗口模式下要运行键盘事件HGE窗口必须输入关键点。当你点击内部的任何地方时都是自动的建造一个关键点。使用各焦点的时候必须要确定准确的焦点。 SetFocus(hge->System_GetState(HGE_HWND)); 2. Switching into fullscreen is unavailable when running in child window mode. Regardless of HGE_WINDOWED system state HGE will run in a window. 2.在运行子窗口模式的时候是很难转换到全屏模式的。HGE_WINDOWED系统状态可以不顾忌HGE而自行运行一个窗口的。
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。