有用N3 + CLR做界面的冲动
新建一个CLR WinForm工程, 直接引入N3的头文件和库进行编译........
编译不过, 找了半天才发现原因
晕死, .Net和N3都有个System命名空间, 没法改Microsoft的东西, 只好把N3的System改成了NSystem
然后就是链接不过
一是__fastcall不被CLR支持, 改成__cdecl (/Gd)重遍
二是Multi-threaded Debug (/MTd)跟/clr冲突, 改成Multi-threaded Debug DLL (/MDd)
终于链接过了.............
启动程序, Crash掉
拿着关键字就去问google, 没想到MSDN论坛上还真有解决方法(感谢我的先驱们, 我成功是了站在你们的"尸体"上)
原因是N3的对象系统在ImplementClass时定义了一些静态对象, 如果直接用CLR会导致不能正解地进行初始化
解决方案(引用原文):
- WorkaroundSteps:
- Intheprojectproperties:
- 1.SetLinker/Advanced/EntryPointto""(emptystring)
- 2.SetLinker/System/SubsystemtoNotSet
- Step1:MakessurethattheCRTstartupcodeisinvoked.Thisisbecause,ifnoentrypointisspecified,thelinkerwillautomaticallyusemainCRTStartup,whichisdefinedintheCRTlibraries.mainCRTStartupwillmakesurethattheglobalobjectisinitializedcorrectly.
- Step2:Makessurethatthelinkerwilllookforthesymbol“main”.Thelinkerlooksfor“main”becausemainCRTStartupcallsmain()initsbody.ThedefaultoptionforaWinformsapplicationisSubsystem:WindowsandthismakesthelinkerlookforWinMain().
- Thanks
- SaritaBafna
- VisualC++team
测试程序:
-
-
#include"stdafx.h"
-
#include"MainForm.h"
-
#include"stdneb.h"
-
#include"core/coreserver.h"
-
#include"io/ioserver.h"
-
usingnamespaceN3CLR;
- [STAThreadAttribute]
-
intmain(array<System::String^>^args)
- {
-
- Application::EnableVisualStyles();
-
Application::SetCompatibleTextRenderingDefault(false);
- Ptr<Core::CoreServer>coreServer=Core::CoreServer::Create();
- coreServer->Open();
-
n_printf("HelloCLR!");
- coreServer->Close();
- coreServer=NULL;
-
- Application::Run(gcnewMainForm());
-
return0;
- }
如果想嵌入到WinForm中的话, 需要更改DisplayDevice中的hWnd,我的做法是把DisplayDevice创建的窗口做为WinForm的子窗口.
注意InputDevice需要最顶层的窗口句柄来创建:
-
-
-
-
HWNDhWnd=FindWindow(NEBULA3_WINDOW_CLASS,NULL);
-
if(0==hWnd)
- {
- hWnd=DisplayDevice::Instance()->GetParentWnd();
- }
- n_assert(0!=hWnd);
分享到:
相关推荐
Nebula3 命令行应用程序向导 有建议的加我MSN交流
Nebula3的应用程序向导, 咋时先做个命令行的方便初学者学习用 有建议的加我MSN交流
这个插件暂时只能导出nvx2的网格,如果需要导出n3格式的文件,请关注后续的开发
Nebula模拟器Nebula模拟器Nebula模拟器Nebula模拟器
3-3 Nebula Graph v3 ——开源分布式高性能图数据库
A game engine and framework. It is built to be portable to various platforms, including the consoles and the iPhone. It has been used in commercial projects.
nebula3中加载xml格式的n3文件,代码修改在各个ModelNode类型的节点类中
图数据库nebula的前端展示界面
Nebula 提供了一组自定义的SWT控件和其它UI组件。 将nebula.zip解压到eclipse的安装目录下的dropins文件夹中clean方式重启eclipse
java-nebula客户端集成(csdn)————程序
常用的模拟器. 这是汉化版的,用着比较方便.
nebula图数据库V2.6.0
nebula3 是一个游戏引擎和开发框架,可移植的特性支持多平台,包括 iPhone。
这是Nebula PaperClips的打印例子,PaperClips的版本为1.0.4。
docker手动搭建3台nebula分布式集群,持久化配置的meta、graph、storage配置文件demo。
脱壳的nebula225b 修正处理了无法扫描到全部游戏子Rom问题|汉化修正绿色特别版
Nebula2的游戏架构,对了解引擎的架构有些帮助
渲染程序向导, 演示RTPlugin的用法
nebula-graph-3.2.0.el7.x86_64 安装包,包含客户端console
Docker搭建分布式集群nebula操作手册,亲自操作整理,无坑。