[nme][game.dev] Neko Media Engine簡介

來源:互聯網
上載者:User

Introduction

 NME is an easy-to-use, cross-platform framework, perfect for game or application development.

The APIs follow the Flash API closely. This should make NME especially familiar if you have Actionscript experience. The API is also easy to understand if you have not worked with Flash before.

If you are new to programming, please visit the New Developers' Guide. This will help introduce you to the Haxe programming language, as well as basic programming concepts.

If you have experience with Actionscript, you be interested in visiting the AS3 Developers' Guide, which includes more details about the simularities (and small differences) between Actionscript 3, Flash, Haxe and NME.

架構介紹

 NME全程NekoMedia Engine,基於Neko的一個多媒體引擎,NME在Neko的基礎上添加了SDL架構抽象多媒體硬體相關操作,添加常用2D遊戲開發API,提供了一套以Haxe為語言的跨平台解決方案,只用編寫一次就能發布到iOS, webOS, Android, Windows, Mac, Linux, Flash Player等平台。

  • 目標平台Windows/Mac/Linux and iOS/Android/webOS,轉換後採用native語言;
  • 可編譯到Flash, so compile it for the browser.

幾個主要工程:

  1. Neko, 源碼翻譯為.n位元組碼,提供虛擬機器執行位元組碼,提供了一種跨平台的能力;
  2. Haxe, Haxe源碼可以轉換為JavaScript、as3、Neko位元組碼、cpp、php等;
  3. hxcpp, 如果目標語言為cpp,則需要該工程提供運行時支援;
  4. sdl-static,平台Win32, Mac OSX, iPhoneOS and Linux32下的靜態庫編譯;

NME主要組成部分:

  1. 仿照Flash的API結構,採用Haxe語言寫的API層;
  2. 針對目標平台預先編譯的庫支援,包括sdl,opengl,regexp,zlib等,只在平台Windows, Mac, Linux and webOS使用了sdl;

針對ios、android、win、webos、mac、linux平台,Haxe將源碼轉換為C++代碼,之後在目標平台與先行編譯的庫進行編譯\連結,以達到native的效率。

How It WorksPublishing to a Flash SWF

If you publish to Flash, NME will use the Haxe language compiler to generate a Flash SWF from your code. The compiler is very fast and reliable. Haxe was built by the same team that created MTASC, the original open-source Actionscript compiler.

Once your SWF has been created, NME embeds your assets directly into the SWF. If you would prefer to keep assets separate, you can still use nme.display.Loader and nme.net.URLLoader to load external assets. NME embeds only assets you have defined in your NMML project file.

Publishing to iOS

If you publish to iOS, NME will use the Haxe language compiler and the HXCPP library for Haxe to generate C++ class files. These are combined with a Flash-like "standard library" for iOS, composed of C++ and Objective-C class files. Your code and your assets are pushed into an XCode project that is generated for you.

When you are ready to compile, you can open the generated project in XCode and publish to the iPhone Simulator, a provisioned iPod Touch, iPhone or iPad, or any other target XCode may provide.

In development builds of NME, it is also possible to publish directly to the iPhone or iPad simulator, without opening XCode, using the "test" command and the "-simulator" or "-simulator -ipad" flags.

Publishing to webOS

 

If you publish to webOS, NME will use the Haxe language compiler, combined with the HXCPP library for Haxe, to generate C++ classes from your code. This is combined with a Flash-like "standard library" for webOS, written in C++. NME will then use an ARM g++ compiler to create an executable binary for your project. If you are using Windows, this will be the CodeSourcery ARM GNU/Linux g++ compiler that is recommended by HP. If you are using Mac or Linux, the toolchain is already installed with the webOS SDK.

With your executable compiled, NME will combine your application with your project assets and generate a webOS application (IPK) using the standard webOS SDK tools. If you like, NME will also install the application on a connected webOS device and run the project.

Publishing to Android

If you publish to Android, NME will use the Haxe language compiler, as well as the HXCPP library for Haxe, to generate C++ classes from your code. NME will also generate supporting Java classes for your application.

NME then combines your code with a Flash-like "standard library" for Android, written in Java and C++, and compiles using the Android NDK and Android SDK. By running an Apache Ant process, the build process is completed, and if you like, your application is installed to a connected Android device and run.

Publishing to Windows

If you publish to Windows, NME will use the Haxe language compiler, as well as the HXCPP library for Haxe, to generate C++ classes from your code. Combined with a Flash-like "standard library" written in C++, NME will use the Visual Studio C++ command-line compiler to generate a native Windows application.

Your application and supporting assets are copied to a single build directory, and if you like, the application is also run.

Publishing to Mac or Linux

If you publish to Mac or Linux, NME will use the Haxe language compiler, as well as the HXCPP library for Haxe, to generate C++ classes from your code. NME will then combine your code with a Flash-like "standard library" written in C++ and compile a native executable using the g++ compiler installed on your system.

If you are using a Mac, g++ is usually provided by XCode. If you are using Linux, g++ will probably be installed on your system already. NME supports 32- and 64-bit builds, so you can compile for either or both, so long as you have the necessary libraries on your system to cross-compile. NME will copy your application and supporting assets to the same build directory, and if you like, run your application.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.