Merge branch 'master' of https://github.com/openfl/lime into tvos

This commit is contained in:
Valerio Santinelli
2015-10-02 23:48:02 +02:00
18 changed files with 317 additions and 35 deletions

View File

@@ -1,3 +1,14 @@
2.6.7 (10/02/2015)
------------------
* Added initial changes to support Apple tvOS
* Added System.allowScreenTimeout to allow screensaver/sleep
* Updated CFFI to fix "hx_register_prim" issue on Android
* Improved "lime setup linux"
* Fixed preload when the same asset is listed twice
* Fixed an issue with importing lime.Assets in legacy builds
2.6.6 (09/24/2015)
------------------

View File

@@ -4,7 +4,7 @@
"license": "MIT",
"tags": [],
"description": "A flexible lightweight layer for Haxe cross-platform developers",
"version": "2.6.6",
"releasenote": "Patch for native static targets, minor fix",
"version": "2.6.7",
"releasenote": "Android CFFI fix, added System.allowScreenTimeout",
"contributors": [ "singmajesty" ]
}

View File

@@ -1,4 +1,5 @@
package lime;
package lime; #if (!lime_legacy || lime_hybrid)
#if !macro
@@ -1497,6 +1498,7 @@ class Assets {
}
#end
#end

View File

@@ -82,25 +82,37 @@ class Preloader #if flash extends Sprite #end {
case IMAGE:
if (!images.exists (url)) {
var image = new Image ();
images.set (url, image);
image.onload = image_onLoad;
image.src = url;
total++;
}
case BINARY:
if (!loaders.exists (url)) {
var loader = new URLLoader ();
loader.dataFormat = BINARY;
loaders.set (url, loader);
total++;
}
case TEXT:
if (!loaders.exists (url)) {
var loader = new URLLoader ();
loaders.set (url, loader);
total++;
}
case FONT:
total++;

View File

@@ -365,7 +365,7 @@ class URLLoader {
private function writeFunction (output:Bytes, size:Int, nmemb:Int):Int {
__data.readBytes (ByteArray.fromBytes (output));
__data.writeBytes (ByteArray.fromBytes (output));
return size * nmemb;
}

View File

@@ -159,7 +159,9 @@ class HXProject {
}
} else if (target == Platform.TVOS) {
architectures = [ Architecture.ARM64 ];
} else {
architectures = [ Architecture.ARMV6 ];

View File

@@ -33,6 +33,7 @@ import sys.io.Process;
class System {
public static var allowScreenTimeout (get, set):Bool;
public static var applicationDirectory (get, null):String;
public static var applicationStorageDirectory (get, null):String;
public static var desktopDirectory (get, null):String;
@@ -227,6 +228,28 @@ class System {
private static function get_allowScreenTimeout ():Bool {
#if ((cpp || neko || nodejs) && !macro)
return lime_system_get_allow_screen_timeout ();
#else
return true;
#end
}
private static function set_allowScreenTimeout (value:Bool):Bool {
#if ((cpp || neko || nodejs) && !macro)
return lime_system_set_allow_screen_timeout (value);
#else
return true;
#end
}
private static function get_applicationDirectory ():String {
#if ((cpp || neko || nodejs) && !macro)
@@ -394,6 +417,8 @@ class System {
#if ((cpp || neko || nodejs) && !macro)
@:cffi private static function lime_system_get_allow_screen_timeout ():Bool;
@:cffi private static function lime_system_set_allow_screen_timeout (value:Bool):Bool;
@:cffi private static function lime_system_get_directory (type:Int, company:String, title:String):Dynamic;
@:cffi private static function lime_system_get_display (index:Int):Dynamic;
@:cffi private static function lime_system_get_num_displays ():Int;

View File

@@ -239,12 +239,6 @@ class MacPlatform extends PlatformTarget {
}
if (targetFlags.exists("tvos")) {
commands.push ([ "-Dtvos", "-Dtoolchain=appletvos", "-DBINDIR=AppleTV" ]);
}
CPPHelper.rebuild (project, commands);
}

View File

@@ -309,7 +309,7 @@ struct AutoValue
#define DEFINE_PRIME12v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
#else
#elif STATIC_LINK
#define DEFINE_PRIME0(func) extern "C" { \
@@ -555,7 +555,202 @@ struct AutoValue
int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
}
#else
#define DEFINE_PRIME0(func) extern "C" { \
EXPORT value func##__prime(const char *inSig) { \
if (!cffi::CheckSig0(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap() { return cffi::ToValue( func() ); } \
EXPORT void *func##__0() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME0v(func) extern "C" { \
EXPORT value func##__prime(const char *inSig) { \
if (!cffi::CheckSig0(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap() { func(); return alloc_null(); } \
EXPORT void *func##__0() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME1(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig1(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL1) { return cffi::ToValue( func(PRIME_ARG_LIST1) ); } \
EXPORT void *func##__1() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME1v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig1(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL1) { func(PRIME_ARG_LIST1); return alloc_null(); } \
EXPORT void *func##__1() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME2(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig2(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL2) { return cffi::ToValue( func(PRIME_ARG_LIST2) ); } \
EXPORT void *func##__2() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME2v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig2(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL2) { func(PRIME_ARG_LIST2); return alloc_null(); } \
EXPORT void *func##__2() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME3(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig3(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL3) { return cffi::ToValue( func(PRIME_ARG_LIST3) ); } \
EXPORT void *func##__3() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME3v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig3(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL3) { func(PRIME_ARG_LIST3); return alloc_null(); } \
EXPORT void *func##__3() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME4(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig4(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL4) { return cffi::ToValue( func(PRIME_ARG_LIST4) ); } \
EXPORT void *func##__4() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME4v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig4(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL4) { func(PRIME_ARG_LIST4); return alloc_null(); } \
EXPORT void *func##__4() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME5(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig5(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL5) { return cffi::ToValue( func(PRIME_ARG_LIST5) ); } \
EXPORT void *func##__5() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME5v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig5(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(PRIME_ARG_DECL5) { func(PRIME_ARG_LIST5); return alloc_null(); } \
EXPORT void *func##__5() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME6(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig6(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST6) ); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME6v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig6(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST6); return alloc_null(); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME7(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig7(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST7) ); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME7v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig7(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST7); return alloc_null(); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME8(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig8(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST8) ); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME8v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig8(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST8); return alloc_null(); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME9(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig9(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST9) ); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME9v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig9(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST9); return alloc_null(); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME10(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig10(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
}
#define DEFINE_PRIME10v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig10(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST10); return alloc_null(); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME11(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig11(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST11) ); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME11v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig11(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST11); return alloc_null(); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME12(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig12(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST12) ); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#define DEFINE_PRIME12v(func) extern "C" { \
EXPORT void *func##__prime(const char *inSig) { \
if (!cffi::CheckSig12(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST12); return alloc_null(); } \
EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
}
#endif
#endif

View File

@@ -25,10 +25,12 @@ namespace lime {
public:
static bool GetAllowScreenTimeout ();
static const char* GetDirectory (SystemDirectory type, const char* company, const char* title);
static value GetDisplay (int id);
static int GetNumDisplays ();
static double GetTimer ();
static bool SetAllowScreenTimeout (bool allow);
};

View File

@@ -1029,6 +1029,13 @@ namespace lime {
}
bool lime_system_get_allow_screen_timeout () {
return System::GetAllowScreenTimeout ();
}
value lime_system_get_directory (int type, HxString company, HxString title) {
const char* path = System::GetDirectory ((SystemDirectory)type, company.__s, title.__s);
@@ -1058,6 +1065,13 @@ namespace lime {
}
bool lime_system_set_allow_screen_timeout (bool allow) {
return System::SetAllowScreenTimeout (allow);
}
void lime_text_event_manager_register (value callback, value eventObject) {
TextEvent::callback = new AutoGCRoot (callback);
@@ -1359,10 +1373,12 @@ namespace lime {
DEFINE_PRIME1v (lime_renderer_unlock);
DEFINE_PRIME2v (lime_render_event_manager_register);
DEFINE_PRIME2v (lime_sensor_event_manager_register);
DEFINE_PRIME0 (lime_system_get_allow_screen_timeout);
DEFINE_PRIME3 (lime_system_get_directory);
DEFINE_PRIME1 (lime_system_get_display);
DEFINE_PRIME0 (lime_system_get_num_displays);
DEFINE_PRIME0 (lime_system_get_timer);
DEFINE_PRIME1 (lime_system_set_allow_screen_timeout);
DEFINE_PRIME2v (lime_text_event_manager_register);
DEFINE_PRIME3 (lime_text_layout_create);
DEFINE_PRIME5 (lime_text_layout_position);

View File

@@ -80,6 +80,13 @@ namespace lime {
}
bool System::GetAllowScreenTimeout () {
return SDL_IsScreenSaverEnabled ();
}
const char* System::GetDirectory (SystemDirectory type, const char* company, const char* title) {
switch (type) {
@@ -312,6 +319,23 @@ namespace lime {
}
bool System::SetAllowScreenTimeout (bool allow) {
if (allow) {
SDL_EnableScreenSaver ();
} else {
SDL_DisableScreenSaver ();
}
return allow;
}
FILE* FILE_HANDLE::getFile () {
#ifndef HX_WINDOWS

View File

@@ -315,15 +315,14 @@ class DefaultAssetLibrary extends AssetLibrary {
#else
if (className.exists (id)) {
var fontClass = className.get (id);
return cast (Type.createInstance (fontClass, []), Image);
} else {
#if tvos
return Image.fromFile ("assets/" + path.get (id));
#else
return Image.fromFile (path.get (id));
#end
}
#end

View File

@@ -759,7 +759,7 @@ class CommandLineTools {
LogHelper.println (" \x1b[1mlinux\x1b[0m -- Create a Linux application");
LogHelper.println (" \x1b[1mmac\x1b[0m -- Create a Mac OS X application");
LogHelper.println (" \x1b[1mtizen\x1b[0m -- Create a Tizen application");
LogHelper.println (" \x1b[1mtvos\x1b[0m -- Create an AppleTVOS application");
LogHelper.println (" \x1b[1mtvos\x1b[0m -- Create a tvOS application");
LogHelper.println (" \x1b[1mwebos\x1b[0m -- Create a webOS application");
LogHelper.println (" \x1b[1mwindows\x1b[0m -- Create a Windows application");
LogHelper.println ("");