Flashdevelop和命令编译
- 格式:docx
- 大小:100.96 KB
- 文档页数:7
一、IDE :flashdevelop由官网推荐的IDE:flashdevelop有haxe语法高亮及自动换行补齐功能,并且能够编译工程文件,其编译功能实际就是用命令行编译,也需要vs和android ndk等的支持。
二、flashdevelop的工程编译选项cpp工程1.1新建cpp工程:project->New project…->C++ project工程新建cpptest文件夹,内容为:1.3工程选项分析,properties各个选项卡:●output:因为建立的C++工程,所以平台默认为C++;output file里填写的是文件输出的目录:bintest project里的run constom command内容为run.bat,即运行时执行的run.bat,run.bat内容为:@echo offbin\Main-debug.exepause表明运行bin\Main-debug.exe,并且会暂停一下。
●classpath:内容为src,即类在文件夹src里。
1.4按Ctrl+Enter即可编译运行。
编译可选择debug和release模式,若是选择release模式,run.bat相应代码要改为bin\Main.exe。
编译实际是执行的命令haxe -cpsrc -cpp bin -main Main–debug该命令也可以用.hxml文件实现,在后面再讨论。
1.5其他工程与cpp工程类似。
由于flashdevelop上面提供的平台有限,可能并不能直接编译Android工程。
三、nme编译1.命令可以使用一下编译各个平台的应用程序,跨平台性可以在这里体现,一份代码可以生成各个平台能运行的程序。
nme test project.nmmliosnme test project.nmmlios -simulatornme test project.nmml androidnme test project.nmmlwebosnme test project.nmml blackberrynme test project.nmml windowsnme test project.nmml macnme test project.nmmllinuxnme test project.nmmllinux -64nme test project.nmml flashnme test project.nmml html52.nmml文件nmml文件中指定了工程的各种参数,包括名字,类名,库,源代码路径,资源文件路径。
下面以网上下载到的Android例子程序分析。
其nmml文件内容为:<?xml version="1.0"encoding="utf-8"?><project><meta title="PiratePig"package="com.eclecticdesignstudio.piratepig"version="1.0.0"company="Ecle ctic Design Studio"/><app path="Export"file="PiratePig"main="com.eclecticdesignstudio.piratepig .PiratePig"/><window width="800"height="600"if="desktop"/><window fps="30"/><source path="Source"/><haxelib name="nme"/><haxelib name="actuate"/><assets path="Assets/fonts"rename="fonts"include="*.ttf"/><assets path="Assets/images"rename="images"include="*"/><assets path="Assets/sounds"rename="sounds"if="web"><sound path="3.mp3"id="sound3"/><sound path="4.mp3"id="sound4"/><sound path="5.mp3"id="sound5"/><music path="theme.mp3"id="soundTheme"/></assets><assets path="Assets/sounds"rename="sounds"unless="web"><sound path="3.wav"id="sound3"/><sound path="4.wav"id="sound4"/><sound path="5.wav"id="sound5"/><music path="theme.mp3"id="soundTheme"/></assets><icon path="Assets/icons/icon-512.png"size="512"/><icon path="Assets/icons/icon-144.png"size="144"/><icon path="Assets/icons/icon-114.png"size="114"/><icon path="Assets/icons/icon-96.png"size="96"/><icon path="Assets/icons/icon-86.png"size="86"/><icon path="Assets/icons/icon-72.png"size="72"/><icon path="Assets/icons/icon-64.png"size="64"/><icon path="Assets/icons/icon-58.png"size="58"/><icon path="Assets/icons/icon-57.png"size="57"/><icon path="Assets/icons/icon-56.png"size="56"/><icon path="Assets/icons/icon-50.png"size="50"/><icon path="Assets/icons/icon-48.png"size="48"/><icon path="Assets/icons/icon-32.png"size="32"/><icon path="Assets/icons/icon-29.png"size="29"/><ndll name="std"/><ndll name="regexp"/><ndll name="zlib"/><ndll name="nme"haxelib="nme"/><section if="release-sign"><certificate path="C:\Development\Android\eclecticdesignstudio.keystore"if ="android"/><certificate path="C:\Development\BlackBerry\author.p12"if="blackberry"/> </section></project>app指定了应用的版本,名称,package等信息。
Windows为窗口大小,帧率等,width和height为0时为全屏。
source为源代码路径。
haxelib指定调用了哪些库。
assets为资源文件。
其余的还在研究…3.编译nme build “xxxxx.nmml” android4.说明所以利用nmml文件可以脱离IDE,并且能够编译各个平台的应用。
四、compile.hxml编译compile.hxml实际上根据haxe命令来编写的。
在命令行中输入haxe可得到以下信息:haXe Compiler 2.09 - (c)2005-2012 Motion-TwinUsage : haxe.exe -main <class> [-swf|-js|-neko|-php|-cpp|-as3] <output> [option s]Options :-cp<path> : add a directory to find source files-js<file> : compile code to JavaScript file-swf<file> : compile code to Flash SWF file-as3 <directory> : generate AS3 code into target directory-neko<file> : compile code to Neko Binary-php<directory> : generate PHP code into target directory-cpp<directory> : generate C++ code into target directory-xml <file> : generate XML types description-main <class> : select startup class-lib <library[:version]> : use a haxelib library-D <var> : define a conditional compilation flag-v : turn on verbose mode-debug : add debug informations to the compiled code-help Display this list of options--help Display this list of options这些参数的阅读与cmd命令参数阅读是一样的。