如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
IDE:flashdevelop由官网推荐的IDE:flashdevelop有haxe语法高亮及自动换行补齐功能,并且能够编译工程文件,其编译功能实际就是用命令行编译,也需要vs和androidndk等的支持。flashdevelop的工程编译选项cpp工程新建cpp工程:project->Newproject…->C++project工程新建cpptest文件夹,内容为:编辑Main.hx文件package;importcpp.Lib;/***...*@authorlidawn*/classMain{staticfunctionmain(){Lib.print("hellohaxecpp");}}工程选项分析,properties各个选项卡:output:因为建立的C++工程,所以平台默认为C++;outputfile里填写的是文件输出的目录:bintestproject里的runconstomcommand内容为run.bat,即运行时执行的run.bat,run.bat内容为:@echooffbin\Main-debug.exepause表明运行bin\Main-debug.exe,并且会暂停一下。classpath:内容为src,即类在文件夹src里。按Ctrl+Enter即可编译运行。编译可选择debug和release模式,若是选择release模式,run.bat相应代码要改为bin\Main.exe。编译实际是执行的命令haxe-cpsrc-cppbin-mainMain–debug该命令也可以用.hxml文件实现,在后面再讨论。其他工程与cpp工程类似。由于flashdevelop上面提供的平台有限,可能并不能直接编译Android工程。nme编译命令可以使用一下编译各个平台的应用程序,跨平台性可以在这里体现,一份代码可以生成各个平台能运行的程序。nmetestproject.nmmliosnmetestproject.nmmlios-simulatornmetestproject.nmmlandroidnmetestproject.nmmlwebosnmetestproject.nmmlblackberrynmetestproject.nmmlwindowsnmetestproject.nmmlmacnmetestproject.nmmllinuxnmetestproject.nmmllinux-64nmetestproject.nmmlflashnmetestproject.nmmlhtml5nmml文件nmml文件中指定了工程的各种参数,包括名字,类名,库,源代码路径,资源文件路径。下面以网上下载到的Android例子程序分析。其nmml文件内容为:<?xmlversion="1.0"encoding="utf-8"?><project><metatitle="PiratePig"package="com.eclecticdesignstudio.piratepig"version="1.0.0"company="EclecticDesignStudio"/><apppath="Export"file="PiratePig"main="com.eclecticdesignstudio.piratepig.PiratePig"/><windowwidth="800"height="600"if="desktop"/><windowfps="30"/><sourcepath="Source"/><haxelibname="nme"/><haxelibname="actuate"/><assetspath="Assets/fonts"rename="fonts"include="*.ttf"/><assetspath="Assets/images"rename="images"include="*"/><assetspath="Assets/sounds"rename="sounds"if="web"><soundpath="3.mp3"id="sound3"/><soundpath="4.mp3"id="sound4"/><soundpath="5.mp3"id="sound5"/><musicpath="theme.mp3"id="soundTheme"/></assets><assetspath="Assets/sounds"rename="sounds"unless="w