diff --git a/lime/_backend/native/NativeApplication.hx b/lime/_backend/native/NativeApplication.hx index 110d3f14b..511fa435d 100644 --- a/lime/_backend/native/NativeApplication.hx +++ b/lime/_backend/native/NativeApplication.hx @@ -103,7 +103,7 @@ class NativeApplication { public function create (config:Config):Void { - #if !macro + #if (!macro && lime_cffi) handle = NativeCFFI.lime_application_create ( { } ); #end @@ -114,6 +114,7 @@ class NativeApplication { #if !macro + #if lime_cffi NativeCFFI.lime_application_event_manager_register (handleApplicationEvent, applicationEventInfo); NativeCFFI.lime_clipboard_event_manager_register (handleClipboardEvent, clipboardEventInfo); NativeCFFI.lime_drop_event_manager_register (handleDropEvent, dropEventInfo); @@ -125,12 +126,12 @@ class NativeApplication { NativeCFFI.lime_text_event_manager_register (handleTextEvent, textEventInfo); NativeCFFI.lime_touch_event_manager_register (handleTouchEvent, touchEventInfo); NativeCFFI.lime_window_event_manager_register (handleWindowEvent, windowEventInfo); - #if (ios || android || tvos) NativeCFFI.lime_sensor_event_manager_register (handleSensorEvent, sensorEventInfo); #end + #end - #if nodejs + #if (nodejs && lime_cffi) NativeCFFI.lime_application_init (handle); @@ -176,7 +177,7 @@ class NativeApplication { AudioManager.shutdown (); - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_application_quit (handle); #end @@ -683,7 +684,7 @@ class NativeApplication { public function setFrameRate (value:Float):Float { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_application_set_frame_rate (handle, value); #end return frameRate = value; diff --git a/lime/_backend/native/NativeAudioSource.hx b/lime/_backend/native/NativeAudioSource.hx index 1479a4fc9..85951966c 100644 --- a/lime/_backend/native/NativeAudioSource.hx +++ b/lime/_backend/native/NativeAudioSource.hx @@ -185,6 +185,8 @@ class NativeAudioSource { private function readVorbisFileBuffer (vorbisFile:VorbisFile, length:Int):UInt8Array { + #if lime_vorbis + var buffer = new UInt8Array (length); var read = 0, total = 0, readMax; @@ -214,6 +216,12 @@ class NativeAudioSource { return buffer; + #else + + return null; + + #end + } diff --git a/lime/_backend/native/NativeMouse.hx b/lime/_backend/native/NativeMouse.hx index 4cf39d277..73d4cf778 100644 --- a/lime/_backend/native/NativeMouse.hx +++ b/lime/_backend/native/NativeMouse.hx @@ -28,7 +28,7 @@ class NativeMouse { __hidden = true; - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_mouse_hide (); #end @@ -43,7 +43,7 @@ class NativeMouse { __hidden = false; - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_mouse_show (); #end @@ -54,7 +54,7 @@ class NativeMouse { public static function warp (x:Int, y:Int, window:Window):Void { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_mouse_warp (x, y, window == null ? 0 : window.backend.handle); #end @@ -99,7 +99,7 @@ class NativeMouse { } - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_mouse_set_cursor (type); #end @@ -125,7 +125,7 @@ class NativeMouse { if (__lock != value) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_mouse_set_lock (value); #end diff --git a/lime/_backend/native/NativeRenderer.hx b/lime/_backend/native/NativeRenderer.hx index be68a7494..cfc1b645d 100644 --- a/lime/_backend/native/NativeRenderer.hx +++ b/lime/_backend/native/NativeRenderer.hx @@ -53,7 +53,7 @@ class NativeRenderer { public function create ():Void { - #if !macro + #if (!macro && lime_cffi) handle = NativeCFFI.lime_renderer_create (parent.window.backend.handle); parent.window.__scale = NativeCFFI.lime_renderer_get_scale (handle); @@ -111,7 +111,7 @@ class NativeRenderer { public function flip ():Void { - #if !macro + #if (!macro && lime_cffi) if (!useHardware) { #if lime_cairo @@ -135,7 +135,7 @@ class NativeRenderer { var imageBuffer:ImageBuffer = null; - #if !macro + #if (!macro && lime_cffi) #if !cs imageBuffer = NativeCFFI.lime_renderer_read_pixels (handle, rect, new ImageBuffer (new UInt8Array (Bytes.alloc (0)))); #else @@ -160,7 +160,7 @@ class NativeRenderer { public function render ():Void { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_renderer_make_current (handle); if (!useHardware) { diff --git a/lime/_backend/native/NativeWindow.hx b/lime/_backend/native/NativeWindow.hx index f30800e5b..b3b5378e0 100644 --- a/lime/_backend/native/NativeWindow.hx +++ b/lime/_backend/native/NativeWindow.hx @@ -46,7 +46,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_alert (handle, message, title); #end @@ -66,7 +66,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_close (handle); #end handle = null; @@ -132,7 +132,7 @@ class NativeWindow { } - #if !macro + #if (!macro && lime_cffi) handle = NativeCFFI.lime_window_create (application.backend.handle, parent.width, parent.height, flags, title); if (handle != null) { @@ -153,7 +153,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_focus (handle); #end @@ -166,7 +166,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) var index = NativeCFFI.lime_window_get_display (handle); if (index > -1) { @@ -187,7 +187,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) var data:Dynamic = NativeCFFI.lime_window_get_display_mode (handle); displayMode.width = data.width; displayMode.height = data.height; @@ -206,7 +206,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) var data:Dynamic = NativeCFFI.lime_window_set_display_mode (handle, value); displayMode.width = data.width; displayMode.height = data.height; @@ -225,7 +225,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) return NativeCFFI.lime_window_get_enable_text_events (handle); #end @@ -240,7 +240,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_move (handle, x, y); #end @@ -253,7 +253,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_resize (handle, width, height); #end @@ -266,7 +266,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_set_borderless (handle, value); #end @@ -280,7 +280,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_set_enable_text_events (handle, value); #end @@ -306,7 +306,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) value = NativeCFFI.lime_window_set_fullscreen (handle, value); parent.__width = NativeCFFI.lime_window_get_width (handle); @@ -332,7 +332,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_set_icon (handle, image.buffer); #end @@ -345,7 +345,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) return NativeCFFI.lime_window_set_maximized (handle, value); #end @@ -360,7 +360,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) return NativeCFFI.lime_window_set_minimized (handle, value); #end @@ -375,7 +375,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) NativeCFFI.lime_window_set_resizable (handle, value); // TODO: remove need for workaround @@ -394,7 +394,7 @@ class NativeWindow { if (handle != null) { - #if !macro + #if (!macro && lime_cffi) return NativeCFFI.lime_window_set_title (handle, value); #end diff --git a/lime/graphics/opengl/WebGL2Context.hx b/lime/graphics/opengl/WebGL2Context.hx index 35617fa64..3b7dd89f0 100644 --- a/lime/graphics/opengl/WebGL2Context.hx +++ b/lime/graphics/opengl/WebGL2Context.hx @@ -1994,7 +1994,7 @@ abstract WebGL2Context(GLRenderContext) from GLRenderContext to GLRenderContext #if (!js || !html5 || display) public inline function getBufferSubData (target:Int, srcByteOffset:DataPointer, dstData:ArrayBuffer, srcOffset:Int = 0, ?length:Int):Void { - var size = (length != null) ? length : (dstData != null) ? dstData.length : 0; + var size = (length != null) ? length : (dstData != null) ? dstData.byteLength : 0; this.getBufferSubData (target, srcByteOffset + srcOffset, size, dstData); } diff --git a/lime/system/Clipboard.hx b/lime/system/Clipboard.hx index 1f2d869b6..9c945ffbe 100644 --- a/lime/system/Clipboard.hx +++ b/lime/system/Clipboard.hx @@ -7,7 +7,7 @@ import lime.app.Event; #if flash import flash.desktop.Clipboard in FlashClipboard; -#elseif js +#elseif (js && html5) import lime._backend.html5.HTML5Window; #end diff --git a/lime/system/System.hx b/lime/system/System.hx index 18ddde915..db2bedda5 100644 --- a/lime/system/System.hx +++ b/lime/system/System.hx @@ -295,7 +295,7 @@ class System { #if flash return flash.Lib.getTimer (); - #elseif js + #elseif (js && !nodejs) return Std.int (Browser.window.performance.now ()); #elseif (!disable_cffi && !macro) return cast NativeCFFI.lime_system_get_timer (); diff --git a/lime/tools/helpers/AssetHelper.hx b/lime/tools/helpers/AssetHelper.hx index 269eaa7f5..c14f17c1a 100644 --- a/lime/tools/helpers/AssetHelper.hx +++ b/lime/tools/helpers/AssetHelper.hx @@ -533,6 +533,9 @@ class AssetHelper { if (isPackedLibrary (project, library)) { + // TODO + #if !nodejs + if (type == "zip") type = "deflate"; // TODO: Support library.embed=true by embedding all the assets instead of packing @@ -611,6 +614,8 @@ class AssetHelper { } + #end + } } diff --git a/lime/tools/helpers/FileHelper.hx b/lime/tools/helpers/FileHelper.hx index 2b6c9ff13..9848edb19 100644 --- a/lime/tools/helpers/FileHelper.hx +++ b/lime/tools/helpers/FileHelper.hx @@ -220,9 +220,7 @@ class FileHelper { try { - var fileOutput:FileOutput = File.write (destination, true); - fileOutput.writeString (result); - fileOutput.close (); + File.saveContent (destination, result); } catch (e:Dynamic) { diff --git a/lime/tools/helpers/LogHelper.hx b/lime/tools/helpers/LogHelper.hx index 20da15c93..70b00d468 100644 --- a/lime/tools/helpers/LogHelper.hx +++ b/lime/tools/helpers/LogHelper.hx @@ -52,7 +52,9 @@ class LogHelper { if (verbose && e != null) { - #if !cs + #if js + throw e; + #elseif !cs Lib.rethrow (e); #end diff --git a/lime/utils/BytePointer.hx b/lime/utils/BytePointer.hx index 6040e7b7e..f684e2a76 100644 --- a/lime/utils/BytePointer.hx +++ b/lime/utils/BytePointer.hx @@ -24,7 +24,7 @@ abstract BytePointer(BytePointerData) from BytePointerData to BytePointerData { if (buffer != null) { - #if (js && html5) + #if js bytes = Bytes.ofData (cast buffer); #else bytes = buffer; @@ -39,7 +39,7 @@ abstract BytePointer(BytePointerData) from BytePointerData to BytePointerData { } else { - #if (js && html5) + #if js this.bytes = Bytes.ofData (cast bufferView.buffer); #else this.bytes = bufferView.buffer;