Fixes for Node.js without CFFI
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
@@ -52,7 +52,9 @@ class LogHelper {
|
||||
|
||||
if (verbose && e != null) {
|
||||
|
||||
#if !cs
|
||||
#if js
|
||||
throw e;
|
||||
#elseif !cs
|
||||
Lib.rethrow (e);
|
||||
#end
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user