|
1 |
| -#lime |
2 |
| ---- |
3 |
| -light media engine |
4 |
| -A lightweight OpenGL framework for [haxe](http://haxe.org). |
| 1 | +Lime |
| 2 | +==== |
5 | 3 |
|
6 |
| - |
| 4 | + |
7 | 5 |
|
| 6 | +Introduction |
| 7 | +------------ |
8 | 8 |
|
9 |
| -A starting point for building OpenGL applications across Mac, Windows, Linux, Blackberry, HTML5(WebGL), Android, iOS and more. |
| 9 | +Lime (Light Media Engine) is an abstraction layer that makes it simple to go cross-platform with only one codebase; without the compromise of relying upon a scripting language or a virtual machine. |
10 | 10 |
|
11 |
| -#What it does |
12 |
| - |
13 |
| -lime exposes the following |
| 11 | +Lime leverages the power of the [Haxe](http://haxe.org/) programming language, compiling Haxe code directly to C++, JavaScript and other target languages. Haxe is a flexible, robust language, and the resulting applications are truly native. |
14 | 12 |
|
15 |
| -- OpenGL |
16 |
| -- Audio |
17 |
| -- Input |
18 |
| -- Windowing |
19 |
| -- Useful native features |
| 13 | +Platforms |
| 14 | +--------- |
20 | 15 |
|
21 |
| -By setting up a bootstrap for your application, lime will handle all the low level events and call into your main class (this can be overridden) for you. |
| 16 | +Lime currently supports the following platforms: |
22 | 17 |
|
23 |
| -#How it works |
| 18 | + * Windows |
| 19 | + * Mac |
| 20 | + * Linux |
| 21 | + * iOS |
| 22 | + * Android |
| 23 | + * BlackBerry |
| 24 | + * Tizen |
| 25 | + * Emscripten |
| 26 | + * HTML5 |
24 | 27 |
|
25 |
| -lime is a cross platform haxe library powered by [lime-tools](http://github.com/openfl/lime-tools), for building upon opengl across many platforms. |
| 28 | +With legacy support for: |
26 | 29 |
|
27 |
| -### lime is two parts |
28 |
| -**One part** is the native code, the underlying platform templates and systems to expose the features. |
29 |
| -**The second part** is the haxe wrapper, forwarding the events to your application. |
| 30 | + * webOS |
| 31 | + * Flash |
30 | 32 |
|
31 |
| -For example, frameworks like [OpenFL](http://github.com/openfl) leverage lime to implement a cross platform Flash API by leaning on the native portion, without using the current lime haxe classes at all. |
| 33 | +What It Does |
| 34 | +------------ |
32 | 35 |
|
33 |
| -#Things to note |
| 36 | +Lime exposes the following: |
34 | 37 |
|
35 |
| -- lime (native, and wrapper) are low level. It does the bare minimum to give you access to the metal - without making it difficult. |
36 |
| -- The lime wrapper works by default by bootstrapping your application main class into the framework. |
37 |
| -- The lime wrapper will call functions into your class, for mouse, keys, gamepad and other system or windowing events (resizing, for example). Then, you handle them. |
38 |
| -- The lime wrapper exposes an API to talk to the windowing, audio and other API's across platforms. |
| 38 | + * OpenGL |
| 39 | + * Audio |
| 40 | + * Input |
| 41 | + * Windowing |
| 42 | + * Useful native features |
| 43 | + |
| 44 | +By setting up a bootstrap for your application, Lime will handle all of the low-level events, and call into your main class (this can be overridden) for you. |
39 | 45 |
|
40 |
| -- The lime GL wrapper code is based on WebGL Api. It matches very closely. Including types and constants. |
41 |
| -- The lime native parts were forked from [nme](http://github.com/haxenme/nme) (native media engine) and merged into openfl-native - but now (and lastly) been merged into lime and joined forces to create an agnostic, cross platform starting point to widen the haxe landscape for all frameworks and framework developers. |
42 |
| -- See the wiki for a 1.0 wrapper [roadmap](https://github.com/openfl/lime/wiki/lime-wrapper-1.0-Roadmap). |
| 46 | +The rendering API is very similar to WebGL, which in turn is similar to OpenGL ES. This enables us to support your code on platforms using OpenGL, OpenGL ES and WebGL. |
43 | 47 |
|
44 |
| -Expect docs, diagrams and breakdowns of how to get started using lime soon. See the examples/ folder for the basics for now. |
| 48 | +How It Works |
| 49 | +------------ |
45 | 50 |
|
46 |
| -# Using Development Builds |
| 51 | +Lime comes together in three different parts. |
| 52 | + |
| 53 | +The **first** are command-line tools, which manage the build, package, install and run process for each support platform. |
| 54 | + |
| 55 | +The **second** is a native layer, which handles rendering, sound and other features with hand-written C++ (with a small amount of Objective-C and Java) in order to handle the core of each platform. This layer is not used when targeting HTML5. |
| 56 | + |
| 57 | +The **third** is a Haxe wrapper (under development), which exposes this functionality and helps abstract differences (such as HTML5 vs native builds) |
| 58 | + |
| 59 | +Lime is designed to power higher-level frameworks, in addition to exposing a sensible cross-platform API for "more direct" development. Most popularly, Lime is also used as the foundation for [OpenFL](https://github.com/openfl/openfl) which is an open-source, accelerated version of the Flash API, supporting all of the Lime targets as well as an HTML5 canvas implementations of the Flash API as well. |
| 60 | + |
| 61 | +License |
| 62 | +------- |
| 63 | + |
| 64 | +Lime is free, open-source software under the MIT license. |
| 65 | + |
| 66 | +Installing Lime |
| 67 | +--------------- |
| 68 | + |
| 69 | +First you will need to first install Haxe 3.0 for [Windows](http://haxe.org/file/haxe-3.0.0-win.exe), [Mac](http://haxe.org/file/haxe-3.0.0-osx-installer.dmg) or [Linux](http://www.openfl.org/download_file/view/726/12426/). |
| 70 | + |
| 71 | +Once Haxe has been installed, you can install a release version of Lime from a terminal or command-prompt with these commands: |
| 72 | + |
| 73 | + haxelib install lime |
| 74 | + haxelib run lime setup |
| 75 | + |
| 76 | +Some platforms will require some additional setup before you can use them. For example, you must have Visual Studio C++ in order to build native applications for Windows. Lime includes a "setup" command that can help you walk through the process for each target: |
| 77 | + |
| 78 | + lime setup windows |
| 79 | + lime setup android |
| 80 | + lime setup blackberry |
| 81 | + lime setup tizen |
| 82 | + lime setup emscripten |
| 83 | + lime setup webos |
| 84 | + |
| 85 | +In order to build for Mac or iOS, you should already have a recent version of Xcode installed. In order to build for Linux, usually only g++ is required, which may be installed with your distribution already. No setup is required for these platforms. |
| 86 | + |
| 87 | +Development Builds |
| 88 | +------------------ |
| 89 | + |
| 90 | +If you would like to begin using Lime directly from the repository, or want to help contribute to its development, you will first want to clone the repository (or your fork of the repository) then tell "haxelib" where your development version is installed. You will also need to clone [lime-build](https://github.com/openfl/lime-build), which includes static libraries and headers required to recompile the Lime native layer from the source. |
47 | 91 |
|
48 | 92 | git clone https://github.com/openfl/lime
|
49 | 93 | haxelib dev lime lime
|
50 | 94 | git clone https://github.com/openfl/lime-build
|
51 | 95 | haxelib dev lime-build lime-build
|
52 | 96 |
|
53 |
| -After cloning, "lime/ndll" will be empty. You can build binaries for a platform, use "lime rebuild" or "openfl rebuild", such as: |
| 97 | +The "lime/ndll" directory will be empty, but you can easily rebuild the binaries for any platform using "lime rebuild", like: |
54 | 98 |
|
55 | 99 | lime rebuild windows
|
56 | 100 | lime rebuild windows,blackberry
|
57 | 101 | lime rebuild linux -64
|
58 | 102 | lime rebuild android -debug
|
59 | 103 |
|
60 |
| -If you are running Linux, you will (probably) need to install additional packages to build from the source. For an Ubuntu system, it may look like this: |
| 104 | +Most platforms do not require additional dependencies (other than usual dependencies) to rebuild, but if you are running linux you will development libraries for GL and GLU, as well as multilib versions of g++ if you plan to rebuild both 32- and 64-bit versions of the Lime native layer (which is done through "rebuild" by default) |
61 | 105 |
|
62 | 106 | sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev g++ g++-multilib gcc-multilib
|
63 |
| - |
64 |
| -For other platforms, the dependencies will be similar to compiling standard Lime/OpenFL applications for the platform, for example, you will need Visual Studio for Windows builds, Xcode for Mac and iOS builds, etc. Platforms which require "setup" step, such as Android, should have that completed, such as "lime setup android" |
65 | 107 |
|
66 |
| -The default "rebuild" for each target compiles all needed binaries, such as x86, armv5 and arm7 for release and debug. You can use "-debug", "-release", "-64" and "-32" to specify that you only want to rebuild one kind of binary. You can use commas to separate multiple builds. |
| 108 | +By default, "rebuild" will compile every binary needed for a target, including both release and debug, and for certain platforms, multiple architectures (such as x86 for an emulator or arm for a device). You can use "-debug", "-release", "-64" and "-32" to specify that you only want to rebuild one kind of binary, and you can use commas to separate multiple builds, in the same command. |
67 | 109 |
|
68 |
| -There is also a helpful "-rebuild" flag you can use in combination with other Lime/OpenFL commands, to rebuild the required binaries in addition to the meaning of the original command. For example, this will test the current application for Windows, while first building release platform binary before packaging: |
| 110 | +There is also a helpful "-rebuild" flag you can use, that rebuilds only the required Lime binary, in addition to the meaning of the original command. For example, the following will test the current application, rebuilding the Windows release binary for Lime first: |
69 | 111 |
|
70 | 112 | lime test windows -rebuild
|
71 | 113 |
|
72 |
| -To return to release builds: |
| 114 | +To return to release builds of Lime, use: |
73 | 115 |
|
74 | 116 | haxelib dev lime
|
| 117 | + |
| 118 | +Using Lime |
| 119 | +---------- |
| 120 | + |
| 121 | +If you prefer a low-level API, you may want to use Lime directly. The Lime 1.0 wrapper is still under development, you can see the wiki for the 1.0 [roadmap](https://github.com/openfl/lime/wiki/lime-wrapper-1.0-Roadmap). |
| 122 | + |
| 123 | +You can get a taste by trying the "SimpleOpenGL" or "HerokuShaders" samples: |
| 124 | + |
| 125 | + lime create lime:SimpleOpenGL |
| 126 | + cd SimpleOpenGL |
| 127 | + lime test linux |
| 128 | + |
| 129 | +You can substitute "HerokuShaders" for "SimpleOpenGL" in the above command, or use "lime create" to see all available samples. The "test" command combines "update", "build" and "run" into one step. If you are not running Linux, or would like to use a different target, you can try one of the following as well: |
| 130 | + |
| 131 | + lime test windows |
| 132 | + lime test mac |
| 133 | + lime test ios |
| 134 | + lime test ios -simulator |
| 135 | + lime test android |
| 136 | + lime test android -emulator |
| 137 | + lime test blackberry |
| 138 | + lime test blackberry -simulator |
| 139 | + lime test tizen |
| 140 | + lime test tizen -simulator |
| 141 | + lime test emscripten |
| 142 | + lime test html5 |
| 143 | + lime test webos |
| 144 | + lime test webos -simulator |
| 145 | + |
| 146 | +If you do not prefer a low-level API, [OpenFL](https://github.com/openfl/openfl) is currently the easiest way to use Lime. Instead of making direct OpenGL calls, OpenFL uses a much simpler (but powerful) API, on top of the functionality of Lime. For example, in order to display an image, OpenFL would use: |
| 147 | + |
| 148 | + var bitmap = new Bitmap (Assets.getBitmapData ("image.png")); |
| 149 | + addChild (bitmap); |
| 150 | + |
| 151 | +This is far fewer steps than using OpenGL directly, so you should decide what level of API you prefer, even if you are not familiar (or do not prefer) the Flash API, as OpenFL also allows direct OpenGL calls using "OpenGLView" if you prefer. |
0 commit comments