diff --git a/lime/_backend/native/NativeApplication.hx b/lime/_backend/native/NativeApplication.hx index ad5f23d35..37331b6f2 100644 --- a/lime/_backend/native/NativeApplication.hx +++ b/lime/_backend/native/NativeApplication.hx @@ -17,7 +17,9 @@ import lime.ui.Gamepad; import lime.ui.Touch; import lime.ui.Window; +#if !macro @:build(lime.system.CFFI.build()) +#end @:access(haxe.Timer) @:access(lime._backend.native.NativeRenderer) diff --git a/lime/_backend/native/NativeMouse.hx b/lime/_backend/native/NativeMouse.hx index 748723b97..6b985d436 100644 --- a/lime/_backend/native/NativeMouse.hx +++ b/lime/_backend/native/NativeMouse.hx @@ -1,10 +1,13 @@ package lime._backend.native; -import lime.system.System; import lime.ui.MouseCursor; import lime.ui.Window; +#if !macro +@:build(lime.system.CFFI.build()) +#end + @:access(lime.ui.Window) @@ -22,7 +25,7 @@ class NativeMouse { __hidden = true; - lime_mouse_hide.call (); + lime_mouse_hide (); } @@ -35,7 +38,7 @@ class NativeMouse { __hidden = false; - lime_mouse_show.call (); + lime_mouse_show (); } @@ -44,7 +47,7 @@ class NativeMouse { public static function warp (x:Int, y:Int, window:Window):Void { - lime_mouse_warp.call (x, y, window == null ? 0 : window.backend.handle); + lime_mouse_warp (x, y, window == null ? 0 : window.backend.handle); } @@ -87,7 +90,7 @@ class NativeMouse { } - lime_mouse_set_cursor.call (type); + lime_mouse_set_cursor (type); } @@ -111,7 +114,7 @@ class NativeMouse { if (__lock != value) { - lime_mouse_set_lock.call (value); + lime_mouse_set_lock (value); __hidden = value; __lock = value; @@ -130,11 +133,11 @@ class NativeMouse { - private static var lime_mouse_hide = System.loadPrime ("lime", "lime_mouse_hide", "v"); - private static var lime_mouse_set_cursor = System.loadPrime ("lime", "lime_mouse_set_cursor", "iv"); - private static var lime_mouse_set_lock = System.loadPrime ("lime", "lime_mouse_set_lock", "bv"); - private static var lime_mouse_show = System.loadPrime ("lime", "lime_mouse_show", "v"); - private static var lime_mouse_warp = System.loadPrime ("lime", "lime_mouse_warp", "iidv"); + @:cffi private static function lime_mouse_hide ():Void; + @:cffi private static function lime_mouse_set_cursor (cursor:Int):Void; + @:cffi private static function lime_mouse_set_lock (lock:Bool):Void; + @:cffi private static function lime_mouse_show ():Void; + @:cffi private static function lime_mouse_warp (x:Int, y:Int, window:Float):Void; } diff --git a/lime/_backend/native/NativeRenderer.hx b/lime/_backend/native/NativeRenderer.hx index 453443c6b..dee1ec321 100644 --- a/lime/_backend/native/NativeRenderer.hx +++ b/lime/_backend/native/NativeRenderer.hx @@ -9,7 +9,10 @@ import lime.graphics.CairoRenderContext; import lime.graphics.ConsoleRenderContext; import lime.graphics.GLRenderContext; import lime.graphics.Renderer; -import lime.system.System; + +#if !macro +@:build(lime.system.CFFI.build()) +#end @:access(lime.ui.Window) @@ -38,7 +41,7 @@ class NativeRenderer { public function create ():Void { - handle = lime_renderer_create.call (parent.window.backend.handle); + handle = lime_renderer_create (parent.window.backend.handle); #if lime_console @@ -47,7 +50,7 @@ class NativeRenderer { #else - var type = lime_renderer_get_type.call (handle); + var type = lime_renderer_get_type (handle); switch (type) { @@ -92,23 +95,23 @@ class NativeRenderer { } #end - lime_renderer_unlock.call (handle); + lime_renderer_unlock (handle); } - lime_renderer_flip.call (handle); + lime_renderer_flip (handle); } public function render ():Void { - lime_renderer_make_current.call (handle); + lime_renderer_make_current (handle); if (!useHardware) { #if lime_cairo - var lock:Dynamic = lime_renderer_lock.call (handle); + var lock:Dynamic = lime_renderer_lock (handle); if (cacheLock == null || cacheLock.pixels != lock.pixels || cacheLock.width != lock.width || cacheLock.height != lock.height) { @@ -149,13 +152,13 @@ class NativeRenderer { - private static var lime_renderer_create = System.loadPrime ("lime", "lime_renderer_create", "dd"); - private static var lime_renderer_flip = System.loadPrime ("lime", "lime_renderer_flip", "dv"); - private static var lime_renderer_get_context = System.loadPrime ("lime", "lime_renderer_get_context", "dd"); - private static var lime_renderer_get_type = System.loadPrime ("lime", "lime_renderer_get_type", "ds"); - private static var lime_renderer_lock = System.loadPrime ("lime", "lime_renderer_lock", "do"); - private static var lime_renderer_make_current = System.loadPrime ("lime", "lime_renderer_make_current", "dv"); - private static var lime_renderer_unlock = System.loadPrime ("lime", "lime_renderer_unlock", "dv"); + @:cffi private static function lime_renderer_create (window:Float):Float; + @:cffi private static function lime_renderer_flip (handle:Float):Void; + @:cffi private static function lime_renderer_get_context (handle:Float):Float; + @:cffi private static function lime_renderer_get_type (handle:Float):String; + @:cffi private static function lime_renderer_lock (handle:Float):Dynamic; + @:cffi private static function lime_renderer_make_current (handle:Float):Void; + @:cffi private static function lime_renderer_unlock (handle:Float):Void; } diff --git a/lime/_backend/native/NativeWindow.hx b/lime/_backend/native/NativeWindow.hx index c58520864..3d06f60df 100644 --- a/lime/_backend/native/NativeWindow.hx +++ b/lime/_backend/native/NativeWindow.hx @@ -9,6 +9,10 @@ import lime.system.Display; import lime.system.System; import lime.ui.Window; +#if !macro +@:build(lime.system.CFFI.build()) +#end + @:access(lime.app.Application) @:access(lime.ui.Window) @@ -32,7 +36,7 @@ class NativeWindow { if (handle != null) { - lime_window_close.call (handle); + lime_window_close (handle); handle = null; } @@ -77,15 +81,15 @@ class NativeWindow { } - handle = lime_window_create.call (application.backend.handle, parent.width, parent.height, flags, title); + handle = lime_window_create (application.backend.handle, parent.width, parent.height, flags, title); if (handle != null) { - parent.__width = lime_window_get_width.call (handle); - parent.__height = lime_window_get_height.call (handle); - parent.__x = lime_window_get_x.call (handle); - parent.__y = lime_window_get_y.call (handle); - parent.id = lime_window_get_id.call (handle); + parent.__width = lime_window_get_width (handle); + parent.__height = lime_window_get_height (handle); + parent.__x = lime_window_get_x (handle); + parent.__y = lime_window_get_y (handle); + parent.id = lime_window_get_id (handle); } @@ -96,7 +100,7 @@ class NativeWindow { if (handle != null) { - lime_window_focus.call (handle); + lime_window_focus (handle); } @@ -130,7 +134,7 @@ class NativeWindow { if (handle != null) { - return lime_window_get_enable_text_events.call (handle); + return lime_window_get_enable_text_events (handle); } @@ -143,7 +147,7 @@ class NativeWindow { if (handle != null) { - lime_window_move.call (handle, x, y); + lime_window_move (handle, x, y); } @@ -154,7 +158,7 @@ class NativeWindow { if (handle != null) { - lime_window_resize.call (handle, width, height); + lime_window_resize (handle, width, height); } @@ -165,7 +169,7 @@ class NativeWindow { if (handle != null) { - lime_window_set_enable_text_events.call (handle, value); + lime_window_set_enable_text_events (handle, value); } @@ -178,7 +182,7 @@ class NativeWindow { if (handle != null) { - value = lime_window_set_fullscreen.call (handle, value); + value = lime_window_set_fullscreen (handle, value); if (value) { @@ -197,7 +201,7 @@ class NativeWindow { if (handle != null) { - lime_window_set_icon.call (handle, image.buffer); + lime_window_set_icon (handle, image.buffer); } @@ -208,7 +212,7 @@ class NativeWindow { if (handle != null) { - return lime_window_set_minimized.call (handle, value); + return lime_window_set_minimized (handle, value); } @@ -221,7 +225,7 @@ class NativeWindow { if (handle != null) { - return lime_window_set_title.call (handle, value); + return lime_window_set_title (handle, value); } @@ -230,22 +234,22 @@ class NativeWindow { } - private static var lime_window_close = System.loadPrime ("lime", "lime_window_close", "dv"); - private static var lime_window_create = System.loadPrime ("lime", "lime_window_create", "diiisd"); - private static var lime_window_focus = System.loadPrime ("lime", "lime_window_focus", "dv"); - private static var lime_window_get_enable_text_events = System.loadPrime ("lime", "lime_window_get_enable_text_events", "db"); - private static var lime_window_get_height = System.loadPrime ("lime", "lime_window_get_height", "di"); - private static var lime_window_get_id = System.loadPrime ("lime", "lime_window_get_id", "di"); - private static var lime_window_get_width = System.loadPrime ("lime", "lime_window_get_width", "di"); - private static var lime_window_get_x = System.loadPrime ("lime", "lime_window_get_x", "di"); - private static var lime_window_get_y = System.loadPrime ("lime", "lime_window_get_y", "di"); - private static var lime_window_move = System.loadPrime ("lime", "lime_window_move", "diiv"); - private static var lime_window_resize = System.loadPrime ("lime", "lime_window_resize", "diiv"); - private static var lime_window_set_enable_text_events = System.loadPrime ("lime", "lime_window_set_enable_text_events", "dbv"); - private static var lime_window_set_fullscreen = System.loadPrime ("lime", "lime_window_set_fullscreen", "dbb"); - private static var lime_window_set_icon = System.loadPrime ("lime", "lime_window_set_icon", "dov"); - private static var lime_window_set_minimized = System.loadPrime ("lime", "lime_window_set_minimized", "dbb"); - private static var lime_window_set_title = System.loadPrime ("lime", "lime_window_set_title", "dss"); + @:cffi private static function lime_window_close (handle:Float):Void; + @:cffi private static function lime_window_create (application:Float, width:Int, height:Int, flags:Int, title:String):Float; + @:cffi private static function lime_window_focus (handle:Float):Void; + @:cffi private static function lime_window_get_enable_text_events (handle:Float):Bool; + @:cffi private static function lime_window_get_height (handle:Float):Int; + @:cffi private static function lime_window_get_id (handle:Float):Int; + @:cffi private static function lime_window_get_width (handle:Float):Int; + @:cffi private static function lime_window_get_x (handle:Float):Int; + @:cffi private static function lime_window_get_y (handle:Float):Int; + @:cffi private static function lime_window_move (handle:Float, x:Int, y:Int):Void; + @:cffi private static function lime_window_resize (handle:Float, width:Int, height:Int):Void; + @:cffi private static function lime_window_set_enable_text_events (handle:Float, enabled:Bool):Void; + @:cffi private static function lime_window_set_fullscreen (handle:Float, fullscreen:Bool):Bool; + @:cffi private static function lime_window_set_icon (handle:Float, buffer:Dynamic):Void; + @:cffi private static function lime_window_set_minimized (handle:Float, minimized:Bool):Bool; + @:cffi private static function lime_window_set_title (handle:Float, title:String):String; } diff --git a/lime/audio/AudioBuffer.hx b/lime/audio/AudioBuffer.hx index 09b45eaef..a1fe8025a 100644 --- a/lime/audio/AudioBuffer.hx +++ b/lime/audio/AudioBuffer.hx @@ -5,7 +5,6 @@ import haxe.io.Bytes; import lime.audio.openal.AL; import lime.net.URLLoader; import lime.net.URLRequest; -import lime.system.CFFI; import lime.utils.ByteArray; import lime.utils.Float32Array; @@ -17,6 +16,10 @@ import flash.media.Sound; import lime.audio.fmod.Sound; #end +#if !macro +@:build(lime.system.CFFI.build()) +#end + class AudioBuffer { @@ -78,7 +81,7 @@ class AudioBuffer { #elseif (cpp || neko || nodejs) - var data:Dynamic = lime_audio_load.call (bytes); + var data:Dynamic = lime_audio_load (bytes); if (data != null) { @@ -118,7 +121,7 @@ class AudioBuffer { #elseif (cpp || neko || nodejs) - var data:Dynamic = lime_audio_load.call (path); + var data:Dynamic = lime_audio_load (path); if (data != null) { @@ -179,7 +182,7 @@ class AudioBuffer { #if (cpp || neko || nodejs) - private static var lime_audio_load = new CFFIDynamic> ("lime", "lime_audio_load"); + @:cffi private static function lime_audio_load (data:Dynamic):Dynamic; #end diff --git a/lime/graphics/Image.hx b/lime/graphics/Image.hx index 39d1eebb7..bc2d06961 100644 --- a/lime/graphics/Image.hx +++ b/lime/graphics/Image.hx @@ -19,7 +19,6 @@ import lime.math.ColorMatrix; import lime.math.Rectangle; import lime.math.Vector2; import lime.system.CFFI; -import lime.system.System; import lime.utils.ArrayBuffer; import lime.utils.ByteArray; import lime.utils.UInt8Array; @@ -49,6 +48,11 @@ import sys.io.File; import lime.graphics.console.TextureData; #end +#if !macro +@:build(lime.system.CFFI.build()) +#end + +@:autoBuild(lime.Assets.embedImage()) @:allow(lime.graphics.util.ImageCanvasUtil) @:allow(lime.graphics.util.ImageDataUtil) @:access(lime.app.Application) @@ -56,8 +60,6 @@ import lime.graphics.console.TextureData; @:access(lime.math.Rectangle) @:access(lime.math.Vector2) -@:autoBuild(lime.Assets.embedImage()) - class Image { @@ -1075,7 +1077,7 @@ class Image { #elseif (cpp || neko || nodejs) - var data:Dynamic = lime_image_load.call (bytes); + var data:Dynamic = lime_image_load (bytes); if (data != null) { @@ -1189,9 +1191,9 @@ class Image { #else - if (#if (sys && (!disable_cffi || !format) && !java) true #else false #end && !System.disableCFFI) { + if (#if (sys && (!disable_cffi || !format) && !java) true #else false #end && CFFI.enabled) { - var data:Dynamic = lime_image_load.call (path); + var data:Dynamic = lime_image_load (path); if (data != null) { @@ -1546,8 +1548,8 @@ class Image { #if (cpp || neko || nodejs) - private static var lime_image_encode = new CFFIInt->Int->Dynamic> ("lime", "lime_image_encode"); - private static var lime_image_load = new CFFIDynamic> ("lime", "lime_image_load"); + @:cffi private static function lime_image_encode (buffer:Dynamic, Type:Int, quality:Int):Dynamic; + @:cffi private static function lime_image_load (data:Dynamic):Dynamic; #end diff --git a/lime/graphics/cairo/Cairo.hx b/lime/graphics/cairo/Cairo.hx index f94aa1802..c6b8ff849 100644 --- a/lime/graphics/cairo/Cairo.hx +++ b/lime/graphics/cairo/Cairo.hx @@ -5,6 +5,10 @@ import lime.math.Matrix3; import lime.math.Vector2; import lime.system.CFFI; +#if !macro +@:build(lime.system.CFFI.build()) +#end + class Cairo { @@ -41,7 +45,7 @@ class Cairo { if (surface != null) { #if lime_cairo - handle = lime_cairo_create.call (surface); + handle = lime_cairo_create (surface); #end } @@ -52,7 +56,7 @@ class Cairo { #if lime_cairo destroy (); - handle = lime_cairo_create.call (surface); + handle = lime_cairo_create (surface); #end } @@ -60,7 +64,7 @@ class Cairo { public function arc (xc:Float, yc:Float, radius:Float, angle1:Float, angle2:Float):Void { #if lime_cairo - lime_cairo_arc.call (handle, xc, yc, radius, angle1, angle2); + lime_cairo_arc (handle, xc, yc, radius, angle1, angle2); #end } @@ -69,7 +73,7 @@ class Cairo { public function arcNegative (xc:Float, yc:Float, radius:Float, angle1:Float, angle2:Float):Void { #if lime_cairo - lime_cairo_arc_negative.call (handle, xc, yc, radius, angle1, angle2); + lime_cairo_arc_negative (handle, xc, yc, radius, angle1, angle2); #end } @@ -78,7 +82,7 @@ class Cairo { public function clip ():Void { #if lime_cairo - lime_cairo_clip.call (handle); + lime_cairo_clip (handle); #end } @@ -87,7 +91,7 @@ class Cairo { public function clipExtents (x1:Float, y1:Float, x2:Float, y2:Float):Void { #if lime_cairo - lime_cairo_clip_extents.call (handle, x1, y1, x2, y2); + lime_cairo_clip_extents (handle, x1, y1, x2, y2); #end } @@ -96,7 +100,7 @@ class Cairo { public function clipPreserve ():Void { #if lime_cairo - lime_cairo_clip_preserve.call (handle); + lime_cairo_clip_preserve (handle); #end } @@ -105,7 +109,7 @@ class Cairo { public function closePath ():Void { #if lime_cairo - lime_cairo_close_path.call (handle); + lime_cairo_close_path (handle); #end } @@ -114,7 +118,7 @@ class Cairo { public function copyPage ():Void { #if lime_cairo - lime_cairo_copy_page.call (handle); + lime_cairo_copy_page (handle); #end } @@ -123,7 +127,7 @@ class Cairo { public function curveTo (x1:Float, y1:Float, x2:Float, y2:Float, x3:Float, y3:Float):Void { #if lime_cairo - lime_cairo_curve_to.call (handle, x1, y1, x2, y2, x3, y3); + lime_cairo_curve_to (handle, x1, y1, x2, y2, x3, y3); #end } @@ -132,7 +136,7 @@ class Cairo { public function destroy ():Void { #if lime_cairo - lime_cairo_destroy.call (handle); + lime_cairo_destroy (handle); #end } @@ -141,7 +145,7 @@ class Cairo { public function fill ():Void { #if lime_cairo - lime_cairo_fill.call (handle); + lime_cairo_fill (handle); #end } @@ -150,7 +154,7 @@ class Cairo { public function fillExtents (x1:Float, y1:Float, x2:Float, y2:Float):Void { #if lime_cairo - lime_cairo_fill_extents.call (handle, x1, y1, x2, y2); + lime_cairo_fill_extents (handle, x1, y1, x2, y2); #end } @@ -159,7 +163,7 @@ class Cairo { public function fillPreserve ():Void { #if lime_cairo - lime_cairo_fill_preserve.call (handle); + lime_cairo_fill_preserve (handle); #end } @@ -168,7 +172,7 @@ class Cairo { public function identityMatrix ():Void { #if lime_cairo - lime_cairo_identity_matrix.call (handle); + lime_cairo_identity_matrix (handle); #end } @@ -177,7 +181,7 @@ class Cairo { public function inClip (x:Float, y:Float):Bool { #if lime_cairo - return lime_cairo_in_clip.call (handle, x, y); + return lime_cairo_in_clip (handle, x, y); #else return false; #end @@ -188,7 +192,7 @@ class Cairo { public function inFill (x:Float, y:Float):Bool { #if lime_cairo - return lime_cairo_in_fill.call (handle, x, y); + return lime_cairo_in_fill (handle, x, y); #else return false; #end @@ -199,7 +203,7 @@ class Cairo { public function inStroke (x:Float, y:Float):Bool { #if lime_cairo - return lime_cairo_in_stroke.call (handle, x, y); + return lime_cairo_in_stroke (handle, x, y); #else return false; #end @@ -210,7 +214,7 @@ class Cairo { public function lineTo (x:Float, y:Float):Void { #if lime_cairo - lime_cairo_line_to.call (handle, x, y); + lime_cairo_line_to (handle, x, y); #end } @@ -219,7 +223,7 @@ class Cairo { public function moveTo (x:Float, y:Float):Void { #if lime_cairo - lime_cairo_move_to.call (handle, x, y); + lime_cairo_move_to (handle, x, y); #end } @@ -228,7 +232,7 @@ class Cairo { public function mask (pattern:CairoPattern):Void { #if lime_cairo - lime_cairo_mask.call (handle, pattern); + lime_cairo_mask (handle, pattern); #end } @@ -237,7 +241,7 @@ class Cairo { public function maskSurface (surface:CairoSurface, x:Float, y:Float):Void { #if lime_cairo - lime_cairo_mask_surface.call (handle, surface, x, y); + lime_cairo_mask_surface (handle, surface, x, y); #end } @@ -246,7 +250,7 @@ class Cairo { public function newPath ():Void { #if lime_cairo - lime_cairo_new_path.call (handle); + lime_cairo_new_path (handle); #end } @@ -255,7 +259,7 @@ class Cairo { public function paint ():Void { #if lime_cairo - lime_cairo_paint.call (handle); + lime_cairo_paint (handle); #end } @@ -264,7 +268,7 @@ class Cairo { public function paintWithAlpha (alpha:Float):Void { #if lime_cairo - lime_cairo_paint_with_alpha.call (handle, alpha); + lime_cairo_paint_with_alpha (handle, alpha); #end } @@ -273,7 +277,7 @@ class Cairo { public function popGroup ():CairoPattern { #if lime_cairo - return lime_cairo_pop_group.call (handle); + return lime_cairo_pop_group (handle); #else return null; #end @@ -284,7 +288,7 @@ class Cairo { public function popGroupToSource ():Void { #if lime_cairo - lime_cairo_pop_group_to_source.call (handle); + lime_cairo_pop_group_to_source (handle); #end } @@ -293,7 +297,7 @@ class Cairo { public function pushGroup ():Void { #if lime_cairo - lime_cairo_push_group.call (handle); + lime_cairo_push_group (handle); #end } @@ -302,7 +306,7 @@ class Cairo { public function pushGroupWithContent (content:CairoContent):Void { #if lime_cairo - lime_cairo_push_group_with_content.call (handle, content); + lime_cairo_push_group_with_content (handle, content); #end } @@ -311,7 +315,7 @@ class Cairo { public function rectangle (x:Float, y:Float, width:Float, height:Float):Void { #if lime_cairo - lime_cairo_rectangle.call (handle, x, y, width, height); + lime_cairo_rectangle (handle, x, y, width, height); #end } @@ -320,7 +324,7 @@ class Cairo { public function reference ():Void { #if lime_cairo - lime_cairo_reference.call (handle); + lime_cairo_reference (handle); #end } @@ -329,7 +333,7 @@ class Cairo { public function relCurveTo (dx1:Float, dy1:Float, dx2:Float, dy2:Float, dx3:Float, dy3:Float):Void { #if lime_cairo - lime_cairo_rel_curve_to.call (handle, dx1, dy1, dx2, dy2, dx3, dy3); + lime_cairo_rel_curve_to (handle, dx1, dy1, dx2, dy2, dx3, dy3); #end } @@ -338,7 +342,7 @@ class Cairo { public function relLineTo (dx:Float, dy:Float):Void { #if lime_cairo - lime_cairo_rel_line_to.call (handle, dx, dy); + lime_cairo_rel_line_to (handle, dx, dy); #end } @@ -347,7 +351,7 @@ class Cairo { public function relMoveTo (dx:Float, dy:Float):Void { #if lime_cairo - lime_cairo_rel_move_to.call (handle, dx, dy); + lime_cairo_rel_move_to (handle, dx, dy); #end } @@ -356,7 +360,7 @@ class Cairo { public function resetClip ():Void { #if lime_cairo - lime_cairo_reset_clip.call (handle); + lime_cairo_reset_clip (handle); #end } @@ -365,7 +369,7 @@ class Cairo { public function restore ():Void { #if lime_cairo - lime_cairo_restore.call (handle); + lime_cairo_restore (handle); #end } @@ -374,7 +378,7 @@ class Cairo { public function save ():Void { #if lime_cairo - lime_cairo_save.call (handle); + lime_cairo_save (handle); #end } @@ -383,7 +387,7 @@ class Cairo { public function setFontSize (size:Float):Void { #if lime_cairo - lime_cairo_set_font_size.call (handle, size); + lime_cairo_set_font_size (handle, size); #end } @@ -392,7 +396,7 @@ class Cairo { public function setSourceRGB (r:Float, g:Float, b:Float):Void { #if lime_cairo - lime_cairo_set_source_rgb.call (handle, r, g, b); + lime_cairo_set_source_rgb (handle, r, g, b); #end } @@ -401,7 +405,7 @@ class Cairo { public function setSourceRGBA (r:Float, g:Float, b:Float, a:Float):Void { #if lime_cairo - lime_cairo_set_source_rgba.call (handle, r, g, b, a); + lime_cairo_set_source_rgba (handle, r, g, b, a); #end } @@ -410,7 +414,7 @@ class Cairo { public function setSourceSurface (surface:CairoSurface, x:Float, y:Float):Void { #if lime_cairo - lime_cairo_set_source_surface.call (handle, surface, x, y); + lime_cairo_set_source_surface (handle, surface, x, y); #end } @@ -419,7 +423,7 @@ class Cairo { public function showPage ():Void { #if lime_cairo - lime_cairo_show_page.call (handle); + lime_cairo_show_page (handle); #end } @@ -428,7 +432,7 @@ class Cairo { public function showText (utf8:String):Void { #if lime_cairo - lime_cairo_show_text.call (handle, utf8); + lime_cairo_show_text (handle, utf8); #end } @@ -437,7 +441,7 @@ class Cairo { public function status ():CairoStatus { #if lime_cairo - return lime_cairo_status.call (handle); + return lime_cairo_status (handle); #else return cast 0; #end @@ -448,7 +452,7 @@ class Cairo { public function stroke ():Void { #if lime_cairo - lime_cairo_stroke.call (handle); + lime_cairo_stroke (handle); #end } @@ -457,7 +461,7 @@ class Cairo { public function strokeExtents (x1:Float, y1:Float, x2:Float, y2:Float):Void { #if lime_cairo - lime_cairo_stroke_extents.call (handle, x1, y1, x2, y2); + lime_cairo_stroke_extents (handle, x1, y1, x2, y2); #end } @@ -466,7 +470,7 @@ class Cairo { public function strokePreserve ():Void { #if lime_cairo - lime_cairo_stroke_preserve.call (handle); + lime_cairo_stroke_preserve (handle); #end } @@ -475,7 +479,7 @@ class Cairo { public function transform (matrix:Matrix3):Void { #if lime_cairo - lime_cairo_transform.call (handle, matrix); + lime_cairo_transform (handle, matrix); #end } @@ -483,7 +487,7 @@ class Cairo { public function rotate (amount:Float):Void { #if lime_cairo - lime_cairo_rotate.call (handle, amount); + lime_cairo_rotate (handle, amount); #end } @@ -491,7 +495,7 @@ class Cairo { public function scale (x:Float, y:Float):Void { #if lime_cairo - lime_cairo_scale.call (handle, x, y); + lime_cairo_scale (handle, x, y); #end } @@ -500,7 +504,7 @@ class Cairo { public function translate (x:Float, y:Float):Void { #if lime_cairo - lime_cairo_translate.call (handle, x, y); + lime_cairo_translate (handle, x, y); #end } @@ -518,7 +522,7 @@ class Cairo { @:noCompletion private function get_antialias ():CairoAntialias { #if lime_cairo - return lime_cairo_get_antialias.call (handle); + return lime_cairo_get_antialias (handle); #end return cast 0; @@ -529,7 +533,7 @@ class Cairo { @:noCompletion private function set_antialias (value:CairoAntialias):CairoAntialias { #if lime_cairo - lime_cairo_set_antialias.call (handle, value); + lime_cairo_set_antialias (handle, value); #end return value; @@ -540,7 +544,7 @@ class Cairo { @:noCompletion private function get_currentPoint ():Vector2 { #if lime_cairo - var vec:Dynamic = lime_cairo_get_current_point.call (handle); + var vec:Dynamic = lime_cairo_get_current_point (handle); return new Vector2 (vec.x, vec.y); #end @@ -552,7 +556,7 @@ class Cairo { @:noCompletion private function get_dash ():Array { #if lime_cairo - var result:Dynamic = lime_cairo_get_dash.call (handle); + var result:Dynamic = lime_cairo_get_dash (handle); return result; #end @@ -564,7 +568,7 @@ class Cairo { @:noCompletion private function set_dash (value:Array):Array { #if lime_cairo - lime_cairo_set_dash.call (handle, value); + lime_cairo_set_dash (handle, value); #end return value; @@ -575,7 +579,7 @@ class Cairo { @:noCompletion private function get_dashCount ():Int { #if lime_cairo - return lime_cairo_get_dash_count.call (handle); + return lime_cairo_get_dash_count (handle); #end return 0; @@ -586,7 +590,7 @@ class Cairo { @:noCompletion private function get_fillRule ():CairoFillRule { #if lime_cairo - return lime_cairo_get_fill_rule.call (handle); + return lime_cairo_get_fill_rule (handle); #end return cast 0; @@ -597,7 +601,7 @@ class Cairo { @:noCompletion private function set_fillRule (value:CairoFillRule):CairoFillRule { #if lime_cairo - lime_cairo_set_fill_rule.call (handle, value); + lime_cairo_set_fill_rule (handle, value); #end return value; @@ -608,7 +612,7 @@ class Cairo { @:noCompletion private function get_fontFace ():CairoFontFace { #if lime_cairo - return lime_cairo_get_font_face.call (handle); + return lime_cairo_get_font_face (handle); #end return cast 0; @@ -619,7 +623,7 @@ class Cairo { @:noCompletion private function set_fontFace (value:CairoFontFace):CairoFontFace { #if lime_cairo - lime_cairo_set_font_face.call (handle, value); + lime_cairo_set_font_face (handle, value); #end return value; @@ -630,7 +634,7 @@ class Cairo { @:noCompletion private function get_fontOptions ():CairoFontOptions { #if lime_cairo - return lime_cairo_get_font_options.call (handle); + return lime_cairo_get_font_options (handle); #else return null; #end @@ -641,7 +645,7 @@ class Cairo { @:noCompletion private function set_fontOptions (value:CairoFontOptions):CairoFontOptions { #if lime_cairo - lime_cairo_set_font_options.call (handle, value); + lime_cairo_set_font_options (handle, value); #end return value; @@ -652,7 +656,7 @@ class Cairo { @:noCompletion private function get_groupTarget ():CairoSurface { #if lime_cairo - return lime_cairo_get_group_target.call (handle); + return lime_cairo_get_group_target (handle); #else return cast 0; #end @@ -663,7 +667,7 @@ class Cairo { @:noCompletion private function get_hasCurrentPoint ():Bool { #if lime_cairo - return lime_cairo_has_current_point.call (handle); + return lime_cairo_has_current_point (handle); #end return false; @@ -674,7 +678,7 @@ class Cairo { @:noCompletion private function get_lineCap ():CairoLineCap { #if lime_cairo - return lime_cairo_get_line_cap.call (handle); + return lime_cairo_get_line_cap (handle); #end return 0; @@ -685,7 +689,7 @@ class Cairo { @:noCompletion private function set_lineCap (value:CairoLineCap):CairoLineCap { #if lime_cairo - lime_cairo_set_line_cap.call (handle, value); + lime_cairo_set_line_cap (handle, value); #end return value; @@ -696,7 +700,7 @@ class Cairo { @:noCompletion private function get_lineJoin ():CairoLineJoin { #if lime_cairo - return lime_cairo_get_line_join.call (handle); + return lime_cairo_get_line_join (handle); #end return 0; @@ -707,7 +711,7 @@ class Cairo { @:noCompletion private function set_lineJoin (value:CairoLineJoin):CairoLineJoin { #if lime_cairo - lime_cairo_set_line_join.call (handle, value); + lime_cairo_set_line_join (handle, value); #end return value; @@ -718,7 +722,7 @@ class Cairo { @:noCompletion private function get_lineWidth ():Float { #if lime_cairo - return lime_cairo_get_line_width.call (handle); + return lime_cairo_get_line_width (handle); #end return 0; @@ -729,7 +733,7 @@ class Cairo { @:noCompletion private function set_lineWidth (value:Float):Float { #if lime_cairo - lime_cairo_set_line_width.call (handle, value); + lime_cairo_set_line_width (handle, value); #end return value; @@ -740,7 +744,7 @@ class Cairo { @:noCompletion private function get_matrix ():Matrix3 { #if lime_cairo - var m:Dynamic = lime_cairo_get_matrix.call (handle); + var m:Dynamic = lime_cairo_get_matrix (handle); return new Matrix3 (m.a, m.b, m.c, m.d, m.tx, m.ty); #end @@ -752,7 +756,7 @@ class Cairo { @:noCompletion private function set_matrix (value:Matrix3):Matrix3 { #if lime_cairo - lime_cairo_set_matrix.call (handle, value); + lime_cairo_set_matrix (handle, value); #end return value; @@ -763,7 +767,7 @@ class Cairo { @:noCompletion private function get_miterLimit ():Float { #if lime_cairo - return lime_cairo_get_miter_limit.call (handle); + return lime_cairo_get_miter_limit (handle); #end return 0; @@ -774,7 +778,7 @@ class Cairo { @:noCompletion private function set_miterLimit (value:Float):Float { #if lime_cairo - lime_cairo_set_miter_limit.call (handle, value); + lime_cairo_set_miter_limit (handle, value); #end return value; @@ -785,7 +789,7 @@ class Cairo { @:noCompletion private function get_operator ():CairoOperator { #if lime_cairo - return lime_cairo_get_operator.call (handle); + return lime_cairo_get_operator (handle); #end return cast 0; @@ -796,7 +800,7 @@ class Cairo { @:noCompletion private function set_operator (value:CairoOperator):CairoOperator { #if lime_cairo - lime_cairo_set_operator.call (handle, value); + lime_cairo_set_operator (handle, value); #end return value; @@ -807,7 +811,7 @@ class Cairo { @:noCompletion private function get_referenceCount ():Int { #if lime_cairo - return lime_cairo_get_reference_count.call (handle); + return lime_cairo_get_reference_count (handle); #else return 0; #end @@ -818,7 +822,7 @@ class Cairo { @:noCompletion private function get_source ():CairoPattern { #if lime_cairo - return lime_cairo_get_source.call (handle); + return lime_cairo_get_source (handle); #end return cast 0; @@ -829,7 +833,7 @@ class Cairo { @:noCompletion private function set_source (value:CairoPattern):CairoPattern { #if lime_cairo - lime_cairo_set_source.call (handle, value); + lime_cairo_set_source (handle, value); #end return value; @@ -840,7 +844,7 @@ class Cairo { @:noCompletion private function get_target ():CairoSurface { #if lime_cairo - return lime_cairo_get_target.call (handle); + return lime_cairo_get_target (handle); #else return cast 0; #end @@ -851,7 +855,7 @@ class Cairo { @:noCompletion private function get_tolerance ():Float { #if lime_cairo - return lime_cairo_get_tolerance.call (handle); + return lime_cairo_get_tolerance (handle); #else return 0; #end @@ -862,7 +866,7 @@ class Cairo { @:noCompletion private function set_tolerance (value:Float):Float { #if lime_cairo - lime_cairo_set_tolerance.call (handle, value); + lime_cairo_set_tolerance (handle, value); #end return value; @@ -873,7 +877,7 @@ class Cairo { private static function get_version ():Int { #if lime_cairo - return lime_cairo_version.call (); + return lime_cairo_version (); #else return 0; #end @@ -884,7 +888,7 @@ class Cairo { private static function get_versionString ():String { #if lime_cairo - return lime_cairo_version_string.call (); + return lime_cairo_version_string (); #else return ""; #end @@ -900,90 +904,90 @@ class Cairo { #if lime_cairo - private static var lime_cairo_arc = new CFFIFloat->Float->Float->Float->Float->Void> ("lime", "lime_cairo_arc"); - private static var lime_cairo_arc_negative = new CFFIFloat->Float->Float->Float->Float->Void> ("lime", "lime_cairo_arc_negative"); - private static var lime_cairo_clip = new CFFIVoid> ("lime", "lime_cairo_clip"); - private static var lime_cairo_clip_preserve = new CFFIVoid> ("lime", "lime_cairo_clip_preserve"); - private static var lime_cairo_clip_extents = new CFFIFloat->Float->Float->Float->Void> ("lime", "lime_cairo_clip_extents"); - private static var lime_cairo_close_path = new CFFIVoid> ("lime", "lime_cairo_close_path"); - private static var lime_cairo_copy_page = new CFFIVoid> ("lime", "lime_cairo_copy_page"); - private static var lime_cairo_create = new CFFIFloat> ("lime", "lime_cairo_create"); - private static var lime_cairo_curve_to = new CFFIFloat->Float->Float->Float->Float->Float->Void> ("lime", "lime_cairo_curve_to"); - private static var lime_cairo_destroy = new CFFIVoid> ("lime", "lime_cairo_destroy"); - private static var lime_cairo_fill = new CFFIVoid> ("lime", "lime_cairo_fill"); - private static var lime_cairo_fill_extents = new CFFIFloat->Float->Float->Float->Void> ("lime", "lime_cairo_fill_extents"); - private static var lime_cairo_fill_preserve = new CFFIVoid> ("lime", "lime_cairo_fill_preserve"); - private static var lime_cairo_get_antialias = new CFFIInt> ("lime", "lime_cairo_get_antialias"); - private static var lime_cairo_get_current_point = new CFFIDynamic> ("lime", "lime_cairo_get_current_point"); - private static var lime_cairo_get_dash = new CFFIDynamic> ("lime", "lime_cairo_get_dash"); - private static var lime_cairo_get_dash_count = new CFFIInt> ("lime", "lime_cairo_get_dash_count"); - private static var lime_cairo_get_fill_rule = new CFFIInt> ("lime", "lime_cairo_get_fill_rule"); - private static var lime_cairo_get_font_face = new CFFIFloat> ("lime", "lime_cairo_get_font_face"); - private static var lime_cairo_get_font_options = new CFFIFloat> ("lime", "lime_cairo_get_font_options"); - private static var lime_cairo_get_group_target = new CFFIFloat> ("lime", "lime_cairo_get_group_target"); - private static var lime_cairo_get_line_cap = new CFFIInt> ("lime", "lime_cairo_get_line_cap"); - private static var lime_cairo_get_line_join = new CFFIInt> ("lime", "lime_cairo_get_line_join"); - private static var lime_cairo_get_line_width = new CFFIFloat> ("lime", "lime_cairo_get_line_width"); - private static var lime_cairo_get_matrix = new CFFIDynamic> ("lime", "lime_cairo_get_matrix"); - private static var lime_cairo_get_miter_limit = new CFFIFloat> ("lime", "lime_cairo_get_miter_limit"); - private static var lime_cairo_get_operator = new CFFIInt> ("lime", "lime_cairo_get_operator"); - private static var lime_cairo_get_reference_count = new CFFIInt> ("lime", "lime_cairo_get_reference_count"); - private static var lime_cairo_get_source = new CFFIFloat> ("lime", "lime_cairo_get_source"); - private static var lime_cairo_get_target = new CFFIFloat> ("lime", "lime_cairo_get_target"); - private static var lime_cairo_get_tolerance = new CFFIFloat> ("lime", "lime_cairo_get_tolerance"); - private static var lime_cairo_has_current_point = new CFFIBool> ("lime", "lime_cairo_has_current_point"); - private static var lime_cairo_identity_matrix = new CFFIVoid> ("lime", "lime_cairo_identity_matrix"); - private static var lime_cairo_in_clip = new CFFIFloat->Float->Bool> ("lime", "lime_cairo_in_clip"); - private static var lime_cairo_in_fill = new CFFIFloat->Float->Bool> ("lime", "lime_cairo_in_fill"); - private static var lime_cairo_in_stroke = new CFFIFloat->Float->Bool> ("lime", "lime_cairo_in_stroke"); - private static var lime_cairo_line_to = new CFFIFloat->Float->Void> ("lime", "lime_cairo_line_to"); - private static var lime_cairo_mask = new CFFIFloat->Void> ("lime", "lime_cairo_mask"); - private static var lime_cairo_mask_surface = new CFFIFloat->Float->Float->Void> ("lime", "lime_cairo_mask_surface"); - private static var lime_cairo_move_to = new CFFIFloat->Float->Void> ("lime", "lime_cairo_move_to"); - private static var lime_cairo_new_path = new CFFIVoid> ("lime", "lime_cairo_new_path"); - private static var lime_cairo_paint = new CFFIVoid> ("lime", "lime_cairo_paint"); - private static var lime_cairo_paint_with_alpha = new CFFIFloat->Void> ("lime", "lime_cairo_paint_with_alpha"); - private static var lime_cairo_pop_group = new CFFIFloat> ("lime", "lime_cairo_pop_group"); - private static var lime_cairo_pop_group_to_source = new CFFIVoid> ("lime", "lime_cairo_pop_group_to_source"); - private static var lime_cairo_push_group = new CFFIVoid> ("lime", "lime_cairo_push_group"); - private static var lime_cairo_push_group_with_content = new CFFIInt->Void> ("lime", "lime_cairo_push_group_with_content"); - private static var lime_cairo_rectangle = new CFFIFloat->Float->Float->Float->Void> ("lime", "lime_cairo_rectangle"); - private static var lime_cairo_reference = new CFFIVoid> ("lime", "lime_cairo_reference"); - private static var lime_cairo_rel_curve_to = new CFFIFloat->Float->Float->Float->Float->Float->Void> ("lime", "lime_cairo_rel_curve_to"); - private static var lime_cairo_rel_line_to = new CFFIFloat->Float->Void> ("lime", "lime_cairo_rel_line_to"); - private static var lime_cairo_rel_move_to = new CFFIFloat->Float->Void> ("lime", "lime_cairo_rel_move_to"); - private static var lime_cairo_reset_clip = new CFFIVoid> ("lime", "lime_cairo_reset_clip"); - private static var lime_cairo_restore = new CFFIVoid> ("lime", "lime_cairo_restore"); - private static var lime_cairo_rotate = new CFFIFloat->Void> ("lime", "lime_cairo_rotate"); - private static var lime_cairo_save = new CFFIVoid> ("lime", "lime_cairo_save"); - private static var lime_cairo_scale = new CFFIFloat->Float->Void> ("lime", "lime_cairo_scale"); - private static var lime_cairo_set_antialias = new CFFIInt->Void> ("lime", "lime_cairo_set_antialias"); - private static var lime_cairo_set_dash = new CFFIDynamic->Void> ("lime", "lime_cairo_set_dash"); - private static var lime_cairo_set_font_face = new CFFIFloat->Void> ("lime", "lime_cairo_set_font_face"); - private static var lime_cairo_set_font_size = new CFFIFloat->Void> ("lime", "lime_cairo_set_font_size"); - private static var lime_cairo_set_fill_rule = new CFFIInt->Void> ("lime", "lime_cairo_set_fill_rule"); - private static var lime_cairo_set_font_options = new CFFIFloat->Void> ("lime", "lime_cairo_set_font_options"); - private static var lime_cairo_set_line_cap = new CFFIInt->Void> ("lime", "lime_cairo_set_line_cap"); - private static var lime_cairo_set_line_join = new CFFIInt->Void> ("lime", "lime_cairo_set_line_join"); - private static var lime_cairo_set_line_width = new CFFIFloat->Void> ("lime", "lime_cairo_set_line_width"); - private static var lime_cairo_set_matrix = new CFFIDynamic->Void> ("lime", "lime_cairo_set_matrix"); - private static var lime_cairo_set_miter_limit = new CFFIFloat->Void> ("lime", "lime_cairo_set_miter_limit"); - private static var lime_cairo_set_operator = new CFFIInt->Void> ("lime", "lime_cairo_set_operator"); - private static var lime_cairo_set_source = new CFFIFloat->Void> ("lime", "lime_cairo_set_source"); - private static var lime_cairo_set_source_rgb = new CFFIFloat->Float->Float->Void> ("lime", "lime_cairo_set_source_rgb"); - private static var lime_cairo_set_source_rgba = new CFFIFloat->Float->Float->Float->Void> ("lime", "lime_cairo_set_source_rgba"); - private static var lime_cairo_set_source_surface = new CFFIFloat->Float->Float->Void> ("lime", "lime_cairo_set_source_surface"); - private static var lime_cairo_set_tolerance = new CFFIFloat->Void> ("lime", "lime_cairo_set_tolerance"); - private static var lime_cairo_show_page = new CFFIVoid> ("lime", "lime_cairo_show_page"); - private static var lime_cairo_show_text = new CFFIString->Void> ("lime", "lime_cairo_show_text"); - private static var lime_cairo_status = new CFFIInt> ("lime", "lime_cairo_status"); - private static var lime_cairo_stroke = new CFFIVoid> ("lime", "lime_cairo_stroke"); - private static var lime_cairo_stroke_extents = new CFFIFloat->Float->Float->Float->Void> ("lime", "lime_cairo_stroke_extents"); - private static var lime_cairo_stroke_preserve = new CFFIVoid> ("lime", "lime_cairo_stroke_preserve"); - private static var lime_cairo_transform = new CFFIDynamic->Void> ("lime", "lime_cairo_transform"); - private static var lime_cairo_translate = new CFFIFloat->Float->Void> ("lime", "lime_cairo_translate"); - private static var lime_cairo_version = new CFFIInt> ("lime", "lime_cairo_version"); - private static var lime_cairo_version_string = new CFFIString> ("lime", "lime_cairo_version_string"); + @:cffi private static function lime_cairo_arc (handle:Float, xc:Float, yc:Float, radius:Float, angle1:Float, angle2:Float):Void; + @:cffi private static function lime_cairo_arc_negative (handle:Float, xc:Float, yc:Float, radius:Float, angle1:Float, angle2:Float):Void; + @:cffi private static function lime_cairo_clip (handle:Float):Void; + @:cffi private static function lime_cairo_clip_preserve (handle:Float):Void; + @:cffi private static function lime_cairo_clip_extents (handle:Float, x1:Float, y1:Float, x2:Float, y2:Float):Void; + @:cffi private static function lime_cairo_close_path (handle:Float):Void; + @:cffi private static function lime_cairo_copy_page (handle:Float):Void; + @:cffi private static function lime_cairo_create (handle:Float):Float; + @:cffi private static function lime_cairo_curve_to (handle:Float, x1:Float, y1:Float, x2:Float, y2:Float, x3:Float, y3:Float):Void; + @:cffi private static function lime_cairo_destroy (handle:Float):Void; + @:cffi private static function lime_cairo_fill (handle:Float):Void; + @:cffi private static function lime_cairo_fill_extents (handle:Float, x1:Float, y1:Float, x2:Float, y2:Float):Void; + @:cffi private static function lime_cairo_fill_preserve (handle:Float):Void; + @:cffi private static function lime_cairo_get_antialias (handle:Float):Int; + @:cffi private static function lime_cairo_get_current_point (handle:Float):Dynamic; + @:cffi private static function lime_cairo_get_dash (handle:Float):Dynamic; + @:cffi private static function lime_cairo_get_dash_count (handle:Float):Int; + @:cffi private static function lime_cairo_get_fill_rule (handle:Float):Int; + @:cffi private static function lime_cairo_get_font_face (handle:Float):Float; + @:cffi private static function lime_cairo_get_font_options (handle:Float):Float; + @:cffi private static function lime_cairo_get_group_target (handle:Float):Float; + @:cffi private static function lime_cairo_get_line_cap (handle:Float):Int; + @:cffi private static function lime_cairo_get_line_join (handle:Float):Int; + @:cffi private static function lime_cairo_get_line_width (handle:Float):Float; + @:cffi private static function lime_cairo_get_matrix (handle:Float):Dynamic; + @:cffi private static function lime_cairo_get_miter_limit (handle:Float):Float; + @:cffi private static function lime_cairo_get_operator (handle:Float):Int; + @:cffi private static function lime_cairo_get_reference_count (handle:Float):Int; + @:cffi private static function lime_cairo_get_source (handle:Float):Float; + @:cffi private static function lime_cairo_get_target (handle:Float):Float; + @:cffi private static function lime_cairo_get_tolerance (handle:Float):Float; + @:cffi private static function lime_cairo_has_current_point (handle:Float):Bool; + @:cffi private static function lime_cairo_identity_matrix (handle:Float):Void; + @:cffi private static function lime_cairo_in_clip (handle:Float, x:Float, y:Float):Bool; + @:cffi private static function lime_cairo_in_fill (handle:Float, x:Float, y:Float):Bool; + @:cffi private static function lime_cairo_in_stroke (handle:Float, x:Float, y:Float):Bool; + @:cffi private static function lime_cairo_line_to (handle:Float, x:Float, y:Float):Void; + @:cffi private static function lime_cairo_mask (handle:Float, pattern:Float):Void; + @:cffi private static function lime_cairo_mask_surface (handle:Float, surface:Float, x:Float, y:Float):Void; + @:cffi private static function lime_cairo_move_to (handle:Float, x:Float, y:Float):Void; + @:cffi private static function lime_cairo_new_path (handle:Float):Void; + @:cffi private static function lime_cairo_paint (handle:Float):Void; + @:cffi private static function lime_cairo_paint_with_alpha (handle:Float, alpha:Float):Void; + @:cffi private static function lime_cairo_pop_group (handle:Float):Float; + @:cffi private static function lime_cairo_pop_group_to_source (handle:Float):Void; + @:cffi private static function lime_cairo_push_group (handle:Float):Void; + @:cffi private static function lime_cairo_push_group_with_content (handle:Float, content:Int):Void; + @:cffi private static function lime_cairo_rectangle (handle:Float, x:Float, y:Float, width:Float, height:Float):Void; + @:cffi private static function lime_cairo_reference (handle:Float):Void; + @:cffi private static function lime_cairo_rel_curve_to (handle:Float, dx1:Float, dy1:Float, dx2:Float, dy2:Float, dx3:Float, dy3:Float):Void; + @:cffi private static function lime_cairo_rel_line_to (handle:Float, dx:Float, dy:Float):Void; + @:cffi private static function lime_cairo_rel_move_to (handle:Float, dx:Float, dy:Float):Void; + @:cffi private static function lime_cairo_reset_clip (handle:Float):Void; + @:cffi private static function lime_cairo_restore (handle:Float):Void; + @:cffi private static function lime_cairo_rotate (handle:Float, amount:Float):Void; + @:cffi private static function lime_cairo_save (handle:Float):Void; + @:cffi private static function lime_cairo_scale (handle:Float, x:Float, y:Float):Void; + @:cffi private static function lime_cairo_set_antialias (handle:Float, cap:Int):Void; + @:cffi private static function lime_cairo_set_dash (handle:Float, dash:Dynamic):Void; + @:cffi private static function lime_cairo_set_fill_rule (handle:Float, cap:Int):Void; + @:cffi private static function lime_cairo_set_font_face (handle:Float, face:Float):Void; + @:cffi private static function lime_cairo_set_font_options (handle:Float, options:Float):Void; + @:cffi private static function lime_cairo_set_font_size (handle:Float, size:Float):Void; + @:cffi private static function lime_cairo_set_line_cap (handle:Float, cap:Int):Void; + @:cffi private static function lime_cairo_set_line_join (handle:Float, join:Int):Void; + @:cffi private static function lime_cairo_set_line_width (handle:Float, width:Float):Void; + @:cffi private static function lime_cairo_set_matrix (handle:Float, matrix:Dynamic):Void; + @:cffi private static function lime_cairo_set_miter_limit (handle:Float, miterLimit:Float):Void; + @:cffi private static function lime_cairo_set_operator (handle:Float, op:Int):Void; + @:cffi private static function lime_cairo_set_source (handle:Float, pattern:Float):Void; + @:cffi private static function lime_cairo_set_source_rgb (handle:Float, r:Float, g:Float, b:Float):Void; + @:cffi private static function lime_cairo_set_source_rgba (handle:Float, r:Float, g:Float, b:Float, a:Float):Void; + @:cffi private static function lime_cairo_set_source_surface (handle:Float, surface:Float, x:Float, y:Float):Void; + @:cffi private static function lime_cairo_set_tolerance (handle:Float, tolerance:Float):Void; + @:cffi private static function lime_cairo_show_page (handle:Float):Void; + @:cffi private static function lime_cairo_show_text (handle:Float, text:String):Void; + @:cffi private static function lime_cairo_status (handle:Float):Int; + @:cffi private static function lime_cairo_stroke (handle:Float):Void; + @:cffi private static function lime_cairo_stroke_extents (handle:Float, x1:Float, y1:Float, x2:Float, y2:Float):Void; + @:cffi private static function lime_cairo_stroke_preserve (handle:Float):Void; + @:cffi private static function lime_cairo_transform (handle:Float, matrix:Dynamic):Void; + @:cffi private static function lime_cairo_translate (handle:Float, x:Float, y:Float):Void; + @:cffi private static function lime_cairo_version ():Int; + @:cffi private static function lime_cairo_version_string ():String; #end diff --git a/lime/graphics/cairo/CairoFTFontFace.hx b/lime/graphics/cairo/CairoFTFontFace.hx index d4647eedf..6ee9df1f3 100644 --- a/lime/graphics/cairo/CairoFTFontFace.hx +++ b/lime/graphics/cairo/CairoFTFontFace.hx @@ -1,9 +1,12 @@ package lime.graphics.cairo; -import lime.system.CFFI; import lime.text.Font; +#if !macro +@:build(lime.system.CFFI.build()) +#end + abstract CairoFTFontFace(CairoFontFace) from CairoFontFace to CairoFontFace { @@ -21,7 +24,7 @@ abstract CairoFTFontFace(CairoFontFace) from CairoFontFace to CairoFontFace { public static function create (face:Font, loadFlags:Int):CairoFTFontFace { #if lime_cairo - return lime_cairo_ft_font_face_create.call (face.src, loadFlags); + return lime_cairo_ft_font_face_create (face.src, loadFlags); #else return cast 0; #end @@ -37,7 +40,7 @@ abstract CairoFTFontFace(CairoFontFace) from CairoFontFace to CairoFontFace { #if (cpp || neko || nodejs) - private static var lime_cairo_ft_font_face_create = new CFFIInt->Float> ("lime", "lime_cairo_ft_font_face_create"); + @:cffi private static function lime_cairo_ft_font_face_create (face:Float, flags:Int):Float; #end diff --git a/lime/graphics/cairo/CairoFontFace.hx b/lime/graphics/cairo/CairoFontFace.hx index f72a5ab4b..038bf68b4 100644 --- a/lime/graphics/cairo/CairoFontFace.hx +++ b/lime/graphics/cairo/CairoFontFace.hx @@ -1,7 +1,9 @@ package lime.graphics.cairo; -import lime.system.CFFI; +#if !macro +@:build(lime.system.CFFI.build()) +#end abstract CairoFontFace(Dynamic) from Float to Float { @@ -20,7 +22,7 @@ abstract CairoFontFace(Dynamic) from Float to Float { public function destroy ():Void { #if lime_cairo - lime_cairo_font_face_destroy.call (this); + lime_cairo_font_face_destroy (this); #end } @@ -29,7 +31,7 @@ abstract CairoFontFace(Dynamic) from Float to Float { public function reference ():CairoFontFace { #if lime_cairo - lime_cairo_font_face_reference.call (this); + lime_cairo_font_face_reference (this); #end return this; @@ -40,7 +42,7 @@ abstract CairoFontFace(Dynamic) from Float to Float { public function status ():CairoStatus { #if lime_cairo - return lime_cairo_font_face_status.call (this); + return lime_cairo_font_face_status (this); #else return 0; #end @@ -58,7 +60,7 @@ abstract CairoFontFace(Dynamic) from Float to Float { @:noCompletion private function get_referenceCount ():Int { #if lime_cairo - return lime_cairo_font_face_get_reference_count.call (this); + return lime_cairo_font_face_get_reference_count (this); #else return 0; #end @@ -74,10 +76,10 @@ abstract CairoFontFace(Dynamic) from Float to Float { #if (cpp || neko || nodejs) - private static var lime_cairo_font_face_destroy = new CFFIVoid> ("lime", "lime_cairo_font_face_destroy"); - private static var lime_cairo_font_face_get_reference_count = new CFFIInt> ("lime", "lime_cairo_font_face_get_reference_count"); - private static var lime_cairo_font_face_reference = new CFFIVoid> ("lime", "lime_cairo_font_face_reference"); - private static var lime_cairo_font_face_status = new CFFIInt> ("lime", "lime_cairo_font_face_status"); + @:cffi private static function lime_cairo_font_face_destroy (handle:Float):Void; + @:cffi private static function lime_cairo_font_face_get_reference_count (handle:Float):Int; + @:cffi private static function lime_cairo_font_face_reference (handle:Float):Void; + @:cffi private static function lime_cairo_font_face_status (handle:Float):Int; #end diff --git a/lime/graphics/cairo/CairoFontOptions.hx b/lime/graphics/cairo/CairoFontOptions.hx index 83734feb7..0ee780b2a 100644 --- a/lime/graphics/cairo/CairoFontOptions.hx +++ b/lime/graphics/cairo/CairoFontOptions.hx @@ -1,9 +1,12 @@ package lime.graphics.cairo; -import lime.system.CFFI; import lime.text.Font; +#if !macro +@:build(lime.system.CFFI.build()) +#end + abstract CairoFontOptions(Dynamic) from Float to Float { @@ -17,7 +20,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { public function new () { #if lime_cairo - this = lime_cairo_font_options_create.call (); + this = lime_cairo_font_options_create (); #else this = cast 0; #end @@ -28,7 +31,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { public function destroy ():Void { #if lime_cairo - lime_cairo_font_options_destroy.call (this); + lime_cairo_font_options_destroy (this); #end } @@ -44,7 +47,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { @:noCompletion private function get_antialias ():CairoAntialias { #if lime_cairo - return lime_cairo_font_options_get_antialias.call (this); + return lime_cairo_font_options_get_antialias (this); #end return cast 0; @@ -55,7 +58,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { @:noCompletion private function set_antialias (value:CairoAntialias):CairoAntialias { #if lime_cairo - lime_cairo_font_options_set_antialias.call (this, value); + lime_cairo_font_options_set_antialias (this, value); #end return value; @@ -66,7 +69,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { @:noCompletion private function get_hintMetrics ():CairoHintMetrics { #if lime_cairo - return lime_cairo_font_options_get_hint_metrics.call (this); + return lime_cairo_font_options_get_hint_metrics (this); #end return cast 0; @@ -77,7 +80,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { @:noCompletion private function set_hintMetrics (value:CairoHintMetrics):CairoHintMetrics { #if lime_cairo - lime_cairo_font_options_set_hint_metrics.call (this, value); + lime_cairo_font_options_set_hint_metrics (this, value); #end return value; @@ -89,7 +92,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { @:noCompletion private function get_hintStyle ():CairoHintStyle { #if lime_cairo - return lime_cairo_font_options_get_hint_style.call (this); + return lime_cairo_font_options_get_hint_style (this); #end return cast 0; @@ -100,7 +103,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { @:noCompletion private function set_hintStyle (value:CairoHintStyle):CairoHintStyle { #if lime_cairo - lime_cairo_font_options_set_hint_style.call (this, value); + lime_cairo_font_options_set_hint_style (this, value); #end return value; @@ -111,7 +114,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { @:noCompletion private function get_subpixelOrder ():CairoSubpixelOrder { #if lime_cairo - return lime_cairo_font_options_get_subpixel_order.call (this); + return lime_cairo_font_options_get_subpixel_order (this); #end return cast 0; @@ -122,7 +125,7 @@ abstract CairoFontOptions(Dynamic) from Float to Float { @:noCompletion private function set_subpixelOrder (value:CairoSubpixelOrder):CairoSubpixelOrder { #if lime_cairo - lime_cairo_font_options_set_subpixel_order.call (this, value); + lime_cairo_font_options_set_subpixel_order (this, value); #end return value; @@ -138,16 +141,16 @@ abstract CairoFontOptions(Dynamic) from Float to Float { #if (cpp || neko || nodejs) - private static var lime_cairo_font_options_create = new CFFIFloat> ("lime", "lime_cairo_font_options_create"); - private static var lime_cairo_font_options_destroy = new CFFIVoid> ("lime", "lime_cairo_font_options_destroy"); - private static var lime_cairo_font_options_get_antialias = new CFFIInt> ("lime", "lime_cairo_font_options_get_antialias"); - private static var lime_cairo_font_options_get_hint_metrics = new CFFIInt> ("lime", "lime_cairo_font_options_get_hint_metrics"); - private static var lime_cairo_font_options_get_hint_style = new CFFIInt> ("lime", "lime_cairo_font_options_get_hint_style"); - private static var lime_cairo_font_options_get_subpixel_order = new CFFIInt> ("lime", "lime_cairo_font_options_get_subpixel_order"); - private static var lime_cairo_font_options_set_antialias = new CFFIInt->Void> ("lime", "lime_cairo_font_options_set_antialias"); - private static var lime_cairo_font_options_set_hint_metrics = new CFFIInt->Void> ("lime", "lime_cairo_font_options_set_hint_metrics"); - private static var lime_cairo_font_options_set_hint_style = new CFFIInt->Void> ("lime", "lime_cairo_font_options_set_hint_style"); - private static var lime_cairo_font_options_set_subpixel_order = new CFFIInt->Void> ("lime", "lime_cairo_font_options_set_subpixel_order"); + @:cffi private static function lime_cairo_font_options_create ():Float; + @:cffi private static function lime_cairo_font_options_destroy (handle:Float):Void; + @:cffi private static function lime_cairo_font_options_get_antialias (handle:Float):Int; + @:cffi private static function lime_cairo_font_options_get_hint_metrics (handle:Float):Int; + @:cffi private static function lime_cairo_font_options_get_hint_style (handle:Float):Int; + @:cffi private static function lime_cairo_font_options_get_subpixel_order (handle:Float):Int; + @:cffi private static function lime_cairo_font_options_set_antialias (handle:Float, v:Int):Void; + @:cffi private static function lime_cairo_font_options_set_hint_metrics (handle:Float, v:Int):Void; + @:cffi private static function lime_cairo_font_options_set_hint_style (handle:Float, v:Int):Void; + @:cffi private static function lime_cairo_font_options_set_subpixel_order (handle:Float, v:Int):Void; #end diff --git a/lime/graphics/cairo/CairoImageSurface.hx b/lime/graphics/cairo/CairoImageSurface.hx index 4ac291983..36a66fbff 100644 --- a/lime/graphics/cairo/CairoImageSurface.hx +++ b/lime/graphics/cairo/CairoImageSurface.hx @@ -1,8 +1,9 @@ package lime.graphics.cairo; -import lime.system.CFFI; -import lime.system.System; +#if !macro +@:build(lime.system.CFFI.build()) +#end @:forward abstract CairoImageSurface(CairoSurface) from CairoSurface to CairoSurface { @@ -18,7 +19,7 @@ import lime.system.System; public function new (format:CairoFormat, width:Int, height:Int):CairoSurface { #if lime_cairo - this = lime_cairo_image_surface_create.call (format, width, height); + this = lime_cairo_image_surface_create (format, width, height); #else this = cast 0; #end @@ -29,7 +30,7 @@ import lime.system.System; public static function create (data:Dynamic, format:CairoFormat, width:Int, height:Int, stride:Int):CairoSurface { #if lime_cairo - return lime_cairo_image_surface_create_for_data.call (data, format, width, height, stride); + return lime_cairo_image_surface_create_for_data (data, format, width, height, stride); #else return cast 0; #end @@ -40,7 +41,6 @@ import lime.system.System; public static function fromImage (image:Image):CairoSurface { #if lime_cairo - //return create (lime_bytes_get_data_pointer.call (#if nodejs image.data #else image.data.buffer #end), CairoFormat.ARGB32, image.width, image.height, image.buffer.stride); return create (lime_bytes_get_data_pointer (#if nodejs image.data #else image.data.buffer #end), CairoFormat.ARGB32, image.width, image.height, image.buffer.stride); #else return null; @@ -59,7 +59,7 @@ import lime.system.System; @:noCompletion private function get_data ():Dynamic { #if lime_cairo - return lime_cairo_image_surface_get_data.call (this); + return lime_cairo_image_surface_get_data (this); #else return null; #end @@ -70,7 +70,7 @@ import lime.system.System; @:noCompletion private function get_format ():CairoFormat { #if lime_cairo - return lime_cairo_image_surface_get_format.call (this); + return lime_cairo_image_surface_get_format (this); #else return 0; #end @@ -81,7 +81,7 @@ import lime.system.System; @:noCompletion private function get_height ():Int { #if lime_cairo - return lime_cairo_image_surface_get_height.call (this); + return lime_cairo_image_surface_get_height (this); #else return 0; #end @@ -92,7 +92,7 @@ import lime.system.System; @:noCompletion private function get_stride ():Int { #if lime_cairo - return lime_cairo_image_surface_get_stride.call (this); + return lime_cairo_image_surface_get_stride (this); #else return 0; #end @@ -103,7 +103,7 @@ import lime.system.System; @:noCompletion private function get_width ():Int { #if lime_cairo - return lime_cairo_image_surface_get_width.call (this); + return lime_cairo_image_surface_get_width (this); #else return 0; #end @@ -119,15 +119,14 @@ import lime.system.System; #if lime_cairo - //private static var lime_bytes_get_data_pointer = new CFFIFloat> ("lime", "lime_bytes_get_data_pointer"); - private static var lime_bytes_get_data_pointer = System.load ("lime", "lime_bytes_get_data_pointer", 1); - private static var lime_cairo_image_surface_create = new CFFIInt->Int->Float> ("lime", "lime_cairo_image_surface_create"); - private static var lime_cairo_image_surface_create_for_data = new CFFIInt->Int->Int->Int->Float> ("lime", "lime_cairo_image_surface_create_for_data"); - private static var lime_cairo_image_surface_get_data = new CFFIFloat> ("lime", "lime_cairo_image_surface_get_data"); - private static var lime_cairo_image_surface_get_format = new CFFIInt> ("lime", "lime_cairo_image_surface_get_format"); - private static var lime_cairo_image_surface_get_height = new CFFIInt> ("lime", "lime_cairo_image_surface_get_height"); - private static var lime_cairo_image_surface_get_stride = new CFFIInt> ("lime", "lime_cairo_image_surface_get_stride"); - private static var lime_cairo_image_surface_get_width = new CFFIInt> ("lime", "lime_cairo_image_surface_get_width"); + @:cffi private static function lime_bytes_get_data_pointer (handle:Dynamic):Float; + @:cffi private static function lime_cairo_image_surface_create (format:Int, width:Int, height:Int):Float; + @:cffi private static function lime_cairo_image_surface_create_for_data (data:Float, format:Int, width:Int, height:Int, stride:Int):Float; + @:cffi private static function lime_cairo_image_surface_get_data (handle:Float):Float; + @:cffi private static function lime_cairo_image_surface_get_format (handle:Float):Int; + @:cffi private static function lime_cairo_image_surface_get_height (handle:Float):Int; + @:cffi private static function lime_cairo_image_surface_get_stride (handle:Float):Int; + @:cffi private static function lime_cairo_image_surface_get_width (handle:Float):Int; #end diff --git a/lime/graphics/cairo/CairoPattern.hx b/lime/graphics/cairo/CairoPattern.hx index e6625649a..bc28432e3 100644 --- a/lime/graphics/cairo/CairoPattern.hx +++ b/lime/graphics/cairo/CairoPattern.hx @@ -2,7 +2,10 @@ package lime.graphics.cairo; import lime.math.Matrix3; -import lime.system.CFFI; + +#if !macro +@:build(lime.system.CFFI.build()) +#end abstract CairoPattern(Dynamic) from Float to Float { @@ -24,7 +27,7 @@ abstract CairoPattern(Dynamic) from Float to Float { public function addColorStopRGB (offset:Float, r:Float, g:Float, b:Float):Void { #if lime_cairo - lime_cairo_pattern_add_color_stop_rgb.call (this, offset, r, g, b); + lime_cairo_pattern_add_color_stop_rgb (this, offset, r, g, b); #end } @@ -33,7 +36,7 @@ abstract CairoPattern(Dynamic) from Float to Float { public function addColorStopRGBA (offset:Float, r:Float, g:Float, b:Float, a:Float):Void { #if lime_cairo - lime_cairo_pattern_add_color_stop_rgba.call (this, offset, r, g, b, a); + lime_cairo_pattern_add_color_stop_rgba (this, offset, r, g, b, a); #end } @@ -42,7 +45,7 @@ abstract CairoPattern(Dynamic) from Float to Float { public static function createForSurface (surface:CairoSurface):CairoPattern { #if lime_cairo - return lime_cairo_pattern_create_for_surface.call (surface); + return lime_cairo_pattern_create_for_surface (surface); #else return cast 0; #end @@ -53,7 +56,7 @@ abstract CairoPattern(Dynamic) from Float to Float { public static function createLinear (x0:Float, y0:Float, x1:Float, y1:Float):CairoPattern { #if lime_cairo - return lime_cairo_pattern_create_linear.call (x0, y0, x1, y1); + return lime_cairo_pattern_create_linear (x0, y0, x1, y1); #else return cast 0; #end @@ -64,7 +67,7 @@ abstract CairoPattern(Dynamic) from Float to Float { public static function createRadial (cx0:Float, cy0:Float, radius0:Float, cx1:Float, cy1:Float, radius1:Float):CairoPattern { #if lime_cairo - return lime_cairo_pattern_create_radial.call (cx0, cy0, radius0, cx1, cy1, radius1); + return lime_cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1); #else return cast 0; #end @@ -75,7 +78,7 @@ abstract CairoPattern(Dynamic) from Float to Float { public static function createRGB (r:Float, g:Float, b:Float):CairoPattern { #if lime_cairo - return lime_cairo_pattern_create_rgb.call (r, g, b); + return lime_cairo_pattern_create_rgb (r, g, b); #else return cast 0; #end @@ -86,7 +89,7 @@ abstract CairoPattern(Dynamic) from Float to Float { public static function createRGBA (r:Float, g:Float, b:Float, a:Float):CairoPattern { #if lime_cairo - return lime_cairo_pattern_create_rgba.call (r, g, b, a); + return lime_cairo_pattern_create_rgba (r, g, b, a); #else return cast 0; #end @@ -97,7 +100,7 @@ abstract CairoPattern(Dynamic) from Float to Float { public function destroy ():Void { #if lime_cairo - lime_cairo_pattern_destroy.call (this); + lime_cairo_pattern_destroy (this); #end } @@ -113,7 +116,7 @@ abstract CairoPattern(Dynamic) from Float to Float { @:noCompletion private function get_colorStopCount ():Int { #if lime_cairo - return lime_cairo_pattern_get_color_stop_count.call (this); + return lime_cairo_pattern_get_color_stop_count (this); #else return 0; #end @@ -124,7 +127,7 @@ abstract CairoPattern(Dynamic) from Float to Float { @:noCompletion private function get_extend ():CairoExtend { #if lime_cairo - return lime_cairo_pattern_get_extend.call (this); + return lime_cairo_pattern_get_extend (this); #else return 0; #end @@ -135,7 +138,7 @@ abstract CairoPattern(Dynamic) from Float to Float { @:noCompletion private function set_extend (value:CairoExtend):CairoExtend { #if lime_cairo - lime_cairo_pattern_set_extend.call (this, value); + lime_cairo_pattern_set_extend (this, value); #end return value; @@ -146,7 +149,7 @@ abstract CairoPattern(Dynamic) from Float to Float { @:noCompletion private function get_filter ():CairoFilter { #if lime_cairo - return lime_cairo_pattern_get_filter.call (this); + return lime_cairo_pattern_get_filter (this); #else return 0; #end @@ -157,7 +160,7 @@ abstract CairoPattern(Dynamic) from Float to Float { @:noCompletion private function set_filter (value:CairoFilter):CairoFilter { #if lime_cairo - lime_cairo_pattern_set_filter.call (this, value); + lime_cairo_pattern_set_filter (this, value); #end return value; @@ -168,7 +171,7 @@ abstract CairoPattern(Dynamic) from Float to Float { @:noCompletion private function get_matrix ():Matrix3 { #if lime_cairo - var m:Dynamic = lime_cairo_pattern_get_matrix.call (this); + var m:Dynamic = lime_cairo_pattern_get_matrix (this); return new Matrix3 (m.a, m.b, m.c, m.d, m.tx, m.ty); #else return null; @@ -180,7 +183,7 @@ abstract CairoPattern(Dynamic) from Float to Float { @:noCompletion private function set_matrix (value:Matrix3):Matrix3 { #if lime_cairo - lime_cairo_pattern_set_matrix.call (this, value); + lime_cairo_pattern_set_matrix (this, value); #end return value; @@ -196,21 +199,21 @@ abstract CairoPattern(Dynamic) from Float to Float { #if lime_cairo - private static var lime_cairo_pattern_add_color_stop_rgb = new CFFIFloat->Float->Float->Float->Void> ("lime", "lime_cairo_pattern_add_color_stop_rgb"); - private static var lime_cairo_pattern_add_color_stop_rgba = new CFFIFloat->Float->Float->Float->Float->Void> ("lime", "lime_cairo_pattern_add_color_stop_rgba"); - private static var lime_cairo_pattern_create_for_surface = new CFFIFloat> ("lime", "lime_cairo_pattern_create_for_surface"); - private static var lime_cairo_pattern_create_linear = new CFFIFloat->Float->Float->Float> ("lime", "lime_cairo_pattern_create_linear"); - private static var lime_cairo_pattern_create_radial = new CFFIFloat->Float->Float->Float->Float->Float> ("lime", "lime_cairo_pattern_create_radial"); - private static var lime_cairo_pattern_create_rgb = new CFFIFloat->Float->Float> ("lime", "lime_cairo_pattern_create_rgb"); - private static var lime_cairo_pattern_create_rgba = new CFFIFloat->Float->Float->Float> ("lime", "lime_cairo_pattern_create_rgba"); - private static var lime_cairo_pattern_destroy = new CFFIVoid> ("lime", "lime_cairo_pattern_destroy"); - private static var lime_cairo_pattern_get_color_stop_count = new CFFIInt> ("lime", "lime_cairo_pattern_get_color_stop_count"); - private static var lime_cairo_pattern_get_extend = new CFFIInt> ("lime", "lime_cairo_pattern_get_extend"); - private static var lime_cairo_pattern_get_filter = new CFFIInt> ("lime", "lime_cairo_pattern_get_filter"); - private static var lime_cairo_pattern_get_matrix = new CFFIDynamic> ("lime", "lime_cairo_pattern_get_matrix"); - private static var lime_cairo_pattern_set_extend = new CFFIInt->Void> ("lime", "lime_cairo_pattern_set_extend"); - private static var lime_cairo_pattern_set_filter = new CFFIInt->Void> ("lime", "lime_cairo_pattern_set_filter"); - private static var lime_cairo_pattern_set_matrix = new CFFIDynamic->Void> ("lime", "lime_cairo_pattern_set_matrix"); + @:cffi private static function lime_cairo_pattern_add_color_stop_rgb (handle:Float, offset:Float, red:Float, green:Float, blue:Float):Void; + @:cffi private static function lime_cairo_pattern_add_color_stop_rgba (handle:Float, offset:Float, red:Float, green:Float, blue:Float, alpha:Float):Void; + @:cffi private static function lime_cairo_pattern_create_for_surface (surface:Float):Float; + @:cffi private static function lime_cairo_pattern_create_linear (x0:Float, y0:Float, x1:Float, y1:Float):Float; + @:cffi private static function lime_cairo_pattern_create_radial (cx0:Float, cy0:Float, radius0:Float, cx1:Float, cy1:Float, radius1:Float):Float; + @:cffi private static function lime_cairo_pattern_create_rgb (r:Float, g:Float, b:Float):Float; + @:cffi private static function lime_cairo_pattern_create_rgba (r:Float, g:Float, b:Float, a:Float):Float; + @:cffi private static function lime_cairo_pattern_destroy (handle:Float):Void; + @:cffi private static function lime_cairo_pattern_get_color_stop_count (handle:Float):Int; + @:cffi private static function lime_cairo_pattern_get_extend (handle:Float):Int; + @:cffi private static function lime_cairo_pattern_get_filter (handle:Float):Int; + @:cffi private static function lime_cairo_pattern_get_matrix (handle:Float):Dynamic; + @:cffi private static function lime_cairo_pattern_set_extend (handle:Float, extend:Int):Void; + @:cffi private static function lime_cairo_pattern_set_filter (handle:Float, filter:Int):Void; + @:cffi private static function lime_cairo_pattern_set_matrix (handle:Float, matrix:Dynamic):Void; #end diff --git a/lime/graphics/cairo/CairoSurface.hx b/lime/graphics/cairo/CairoSurface.hx index 6fc7b9474..d01393730 100644 --- a/lime/graphics/cairo/CairoSurface.hx +++ b/lime/graphics/cairo/CairoSurface.hx @@ -1,7 +1,9 @@ -package lime.graphics.cairo; #if !macro +package lime.graphics.cairo; -import lime.system.CFFI; +#if !macro +@:build(lime.system.CFFI.build()) +#end abstract CairoSurface(Dynamic) from Float to Float { @@ -9,8 +11,8 @@ abstract CairoSurface(Dynamic) from Float to Float { public function destroy ():Void { - #if lime_cairo - lime_cairo_surface_destroy.call (this); + #if (lime_cairo && !macro) + lime_cairo_surface_destroy (this); #end } @@ -18,8 +20,8 @@ abstract CairoSurface(Dynamic) from Float to Float { public function flush ():Void { - #if lime_cairo - lime_cairo_surface_flush.call (this); + #if (lime_cairo && !macro) + lime_cairo_surface_flush (this); #end } @@ -32,13 +34,10 @@ abstract CairoSurface(Dynamic) from Float to Float { - #if lime_cairo - private static var lime_cairo_surface_destroy = new CFFIVoid> ("lime", "lime_cairo_surface_destroy"); - private static var lime_cairo_surface_flush = new CFFIVoid> ("lime", "lime_cairo_surface_flush"); + #if (lime_cairo && !macro) + @:cffi private static function lime_cairo_surface_destroy (surface:Float):Void; + @:cffi private static function lime_cairo_surface_flush (surface:Float):Void; #end -} - - -#end \ No newline at end of file +} \ No newline at end of file diff --git a/lime/graphics/format/JPEG.hx b/lime/graphics/format/JPEG.hx index a1fbb916d..0a592a629 100644 --- a/lime/graphics/format/JPEG.hx +++ b/lime/graphics/format/JPEG.hx @@ -7,6 +7,10 @@ import lime.graphics.ImageBuffer; import lime.system.CFFI; import lime.utils.ByteArray; +#if !macro +@:build(lime.system.CFFI.build()) +#end + class JPEG { @@ -15,7 +19,7 @@ class JPEG { #if (cpp || neko || nodejs) - var bufferData:Dynamic = lime_jpeg_decode_bytes.call (bytes, decodeData); + var bufferData:Dynamic = lime_jpeg_decode_bytes (bytes, decodeData); if (bufferData != null) { @@ -36,7 +40,7 @@ class JPEG { #if (cpp || neko || nodejs) - var bufferData:Dynamic = lime_jpeg_decode_file.call (path, decodeData); + var bufferData:Dynamic = lime_jpeg_decode_file (path, decodeData); if (bufferData != null) { @@ -69,7 +73,7 @@ class JPEG { #elseif (sys && (!disable_cffi || !format)) - var data:Dynamic = lime_image_encode.call (image.buffer, 1, quality); + var data:Dynamic = lime_image_encode (image.buffer, 1, quality); var bytes = @:privateAccess new Bytes (data.length, data.b); return ByteArray.fromBytes (bytes); @@ -88,9 +92,9 @@ class JPEG { #if (cpp || neko || nodejs) - private static var lime_jpeg_decode_bytes = new CFFIBool->Dynamic> ("lime", "lime_jpeg_decode_bytes"); - private static var lime_jpeg_decode_file = new CFFIBool->Dynamic> ("lime", "lime_jpeg_decode_file"); - private static var lime_image_encode = new CFFIInt->Int->Dynamic> ("lime", "lime_image_encode"); + @:cffi private static function lime_jpeg_decode_bytes (data:Dynamic, decodeData:Bool):Dynamic; + @:cffi private static function lime_jpeg_decode_file (path:String, decodeData:Bool):Dynamic; + @:cffi private static function lime_image_encode (data:Dynamic, type:Int, quality:Int):Dynamic; #end diff --git a/lime/graphics/format/PNG.hx b/lime/graphics/format/PNG.hx index 9b9e2d41f..13a0ebd2d 100644 --- a/lime/graphics/format/PNG.hx +++ b/lime/graphics/format/PNG.hx @@ -4,7 +4,6 @@ package lime.graphics.format; import haxe.io.Bytes; import lime.graphics.Image; import lime.system.CFFI; -import lime.system.System; import lime.utils.ByteArray; #if format @@ -15,6 +14,10 @@ import haxe.io.Bytes; import haxe.io.BytesOutput; #end +#if !macro +@:build(lime.system.CFFI.build()) +#end + class PNG { @@ -23,7 +26,7 @@ class PNG { #if (cpp || neko || nodejs) - var bufferData:Dynamic = lime_png_decode_bytes.call (bytes, decodeData); + var bufferData:Dynamic = lime_png_decode_bytes (bytes, decodeData); if (bufferData != null) { @@ -44,7 +47,7 @@ class PNG { #if (cpp || neko || nodejs) - var bufferData:Dynamic = lime_png_decode_file.call (path, decodeData); + var bufferData:Dynamic = lime_png_decode_file (path, decodeData); if (bufferData != null) { @@ -77,9 +80,9 @@ class PNG { #elseif (sys && (!disable_cffi || !format)) - if (!System.disableCFFI) { + if (!CFFI.enabled) { - var data:Dynamic = lime_image_encode.call (image.buffer, 0, 0); + var data:Dynamic = lime_image_encode (image.buffer, 0, 0); var bytes = @:privateAccess new Bytes (data.length, data.b); return ByteArray.fromBytes (bytes); @@ -146,9 +149,9 @@ class PNG { #if (cpp || neko || nodejs) - private static var lime_png_decode_bytes = new CFFIBool->Dynamic> ("lime", "lime_png_decode_bytes"); - private static var lime_png_decode_file = new CFFIBool->Dynamic> ("lime", "lime_png_decode_file"); - private static var lime_image_encode = new CFFIInt->Int->Dynamic> ("lime", "lime_image_encode"); + @:cffi private static function lime_png_decode_bytes (data:Dynamic, decodeData:Bool):Dynamic; + @:cffi private static function lime_png_decode_file (path:String, decodeData:Bool):Dynamic; + @:cffi private static function lime_image_encode (data:Dynamic, type:Int, quality:Int):Dynamic; #end diff --git a/lime/graphics/opengl/GL.hx b/lime/graphics/opengl/GL.hx index 97a1c7147..61af48647 100644 --- a/lime/graphics/opengl/GL.hx +++ b/lime/graphics/opengl/GL.hx @@ -21,6 +21,16 @@ import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL30; #end +#if cpp +import cpp.Float32; +#else +typedef Float32 = Float; +#end + +#if !macro +@:build(lime.system.CFFI.build()) +#end + @:allow(lime.ui.Window) @@ -388,7 +398,7 @@ class GL { #if (js && html5 && !display) context.activeTexture (texture); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_active_texture.call (texture); + lime_gl_active_texture (texture); #elseif java GL13.glActiveTexture (texture); #end @@ -402,7 +412,7 @@ class GL { context.attachShader (program, shader); #elseif ((cpp || neko || nodejs) && lime_opengl) program.attach (shader); - lime_gl_attach_shader.call (program.id, shader.id); + lime_gl_attach_shader (program.id, shader.id); #elseif java program.attach (shader); GL20.glAttachShader (program.id, shader.id); @@ -416,7 +426,7 @@ class GL { #if (js && html5 && !display) context.bindAttribLocation (program, index, name); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_bind_attrib_location.call (program.id, index, name); + lime_gl_bind_attrib_location (program.id, index, name); #elseif java GL20.glBindAttribLocation (program.id, index, name); #end @@ -429,7 +439,7 @@ class GL { #if (js && html5 && !display) context.bindBuffer (target, buffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_bind_buffer.call (target, buffer == null ? 0 : buffer.id); + lime_gl_bind_buffer (target, buffer == null ? 0 : buffer.id); #elseif java GL15.glBindBuffer (target, buffer == null ? 0 : buffer.id); #end @@ -442,7 +452,7 @@ class GL { #if (js && html5 && !display) context.bindFramebuffer (target, framebuffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_bind_framebuffer.call (target, framebuffer == null ? 0 : framebuffer.id); + lime_gl_bind_framebuffer (target, framebuffer == null ? 0 : framebuffer.id); #elseif java GL30.glBindFramebuffer (target, framebuffer == null ? 0 : framebuffer.id); #end @@ -455,7 +465,7 @@ class GL { #if (js && html5 && !display) context.bindRenderbuffer (target, renderbuffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_bind_renderbuffer.call (target, renderbuffer == null ? 0 : renderbuffer.id); + lime_gl_bind_renderbuffer (target, renderbuffer == null ? 0 : renderbuffer.id); #elseif java GL30.glBindRenderbuffer (target, renderbuffer == null ? 0 : renderbuffer.id); #end @@ -468,7 +478,7 @@ class GL { #if (js && html5 && !display) context.bindTexture (target, texture); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_bind_texture.call (target, texture == null ? 0 : texture.id); + lime_gl_bind_texture (target, texture == null ? 0 : texture.id); #elseif java GL11.glBindTexture (target, texture == null ? 0 : texture.id); #end @@ -481,7 +491,7 @@ class GL { #if (js && html5 && !display) context.blendColor (red, green, blue, alpha); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_blend_color.call (red, green, blue, alpha); + lime_gl_blend_color (red, green, blue, alpha); #elseif java EXTBlendColor.glBlendColorEXT (red, green, blue, alpha); #end @@ -494,7 +504,7 @@ class GL { #if (js && html5 && !display) context.blendEquation (mode); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_blend_equation.call (mode); + lime_gl_blend_equation (mode); #elseif java GL14.glBlendEquation (mode); #end @@ -507,7 +517,7 @@ class GL { #if (js && html5 && !display) context.blendEquationSeparate (modeRGB, modeAlpha); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_blend_equation_separate.call (modeRGB, modeAlpha); + lime_gl_blend_equation_separate (modeRGB, modeAlpha); #elseif java GL20.glBlendEquationSeparate (modeRGB, modeAlpha); #end @@ -520,7 +530,7 @@ class GL { #if (js && html5 && !display) context.blendFunc (sfactor, dfactor); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_blend_func.call (sfactor, dfactor); + lime_gl_blend_func (sfactor, dfactor); #elseif java GL11.glBlendFunc (sfactor, dfactor); #end @@ -533,7 +543,7 @@ class GL { #if (js && html5 && !display) context.blendFuncSeparate (srcRGB, dstRGB, srcAlpha, dstAlpha); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_blend_func_separate.call (srcRGB, dstRGB, srcAlpha, dstAlpha); + lime_gl_blend_func_separate (srcRGB, dstRGB, srcAlpha, dstAlpha); #elseif java GL14.glBlendFuncSeparate (srcRGB, dstRGB, srcAlpha, dstAlpha); #end @@ -546,9 +556,9 @@ class GL { #if (js && html5 && !display) context.bufferData (target, data, usage); #elseif ((cpp || neko) && lime_opengl) - lime_gl_buffer_data.call (target, data.buffer, data.byteOffset, data.byteLength, usage); + lime_gl_buffer_data (target, data.buffer, data.byteOffset, data.byteLength, usage); #elseif (nodejs && lime_opengl) - lime_gl_buffer_data.call (target, data, data.byteOffset, data.byteLength, usage); + lime_gl_buffer_data (target, data, data.byteOffset, data.byteLength, usage); #elseif java //GL15.glBufferData (target, data.buffer, data.byteOffset, data.byteLength, usage); #end @@ -561,9 +571,9 @@ class GL { #if (js && html5 && !display) context.bufferSubData (target, offset, data); #elseif ((cpp || neko) && lime_opengl) - lime_gl_buffer_sub_data.call (target, offset, data.buffer, data.byteOffset, data.byteLength); + lime_gl_buffer_sub_data (target, offset, data.buffer, data.byteOffset, data.byteLength); #elseif (nodejs && lime_opengl) - lime_gl_buffer_sub_data.call (target, offset, data, data.byteOffset, data.byteLength); + lime_gl_buffer_sub_data (target, offset, data, data.byteOffset, data.byteLength); #elseif java //GL15.glBufferSubData (target, offset, data.buffer, data.byteOffset, data.byteLength); #end @@ -576,7 +586,7 @@ class GL { #if (js && html5 && !display) return context.checkFramebufferStatus (target); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_check_framebuffer_status.call (target); + return lime_gl_check_framebuffer_status (target); #elseif java return GL30.glCheckFramebufferStatus (target); #else @@ -591,7 +601,7 @@ class GL { #if (js && html5 && !display) context.clear (mask); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_clear.call (mask); + lime_gl_clear (mask); #elseif java GL11.glClear (mask); #end @@ -604,7 +614,7 @@ class GL { #if (js && html5 && !display) context.clearColor (red, green, blue, alpha); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_clear_color.call (red, green, blue, alpha); + lime_gl_clear_color (red, green, blue, alpha); #elseif java GL11.glClearColor (red, green, blue, alpha); #end @@ -617,7 +627,7 @@ class GL { #if (js && html5 && !display) context.clearDepth (depth); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_clear_depth.call (depth); + lime_gl_clear_depth (depth); #elseif java GL11.glClearDepth (depth); #end @@ -630,7 +640,7 @@ class GL { #if (js && html5 && !display) context.clearStencil (s); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_clear_stencil.call (s); + lime_gl_clear_stencil (s); #elseif java GL11.glClearStencil (s); #end @@ -643,7 +653,7 @@ class GL { #if (js && html5 && !display) context.colorMask (red, green, blue, alpha); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_color_mask.call (red, green, blue, alpha); + lime_gl_color_mask (red, green, blue, alpha); #elseif java GL11.glColorMask (red, green, blue, alpha); #end @@ -656,7 +666,7 @@ class GL { #if (js && html5 && !display) context.compileShader (shader); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_compile_shader.call (shader.id); + lime_gl_compile_shader (shader.id); #elseif java GL20.glCompileShader (shader.id); #end @@ -670,9 +680,9 @@ class GL { context.compressedTexImage2D (target, level, internalformat, width, height, border, data); #elseif ((cpp || neko) && lime_opengl) var buffer = data == null ? null : data.buffer; - lime_gl_compressed_tex_image_2d.call (target, level, internalformat, width, height, border, buffer, data == null ? 0 : data.byteOffset); + lime_gl_compressed_tex_image_2d (target, level, internalformat, width, height, border, buffer, data == null ? 0 : data.byteOffset); #elseif (nodejs && lime_opengl) - lime_gl_compressed_tex_image_2d.call (target, level, internalformat, width, height, border, data == null ? null : data , data == null ? null : data.byteOffset); + lime_gl_compressed_tex_image_2d (target, level, internalformat, width, height, border, data == null ? null : data , data == null ? null : data.byteOffset); #elseif java //GL13.glCompressedTexImage2D (target, level, internalformat, width, height, border, data == null ? null : data.buffer, data == null ? null : data.byteOffset); #end @@ -686,9 +696,9 @@ class GL { context.compressedTexSubImage2D (target, level, xoffset, yoffset, width, height, format, data); #elseif ((cpp || neko) && lime_opengl) var buffer = data == null ? null : data.buffer; - lime_gl_compressed_tex_sub_image_2d.call (target, level, xoffset, yoffset, width, height, format, buffer, data == null ? 0 : data.byteOffset); + lime_gl_compressed_tex_sub_image_2d (target, level, xoffset, yoffset, width, height, format, buffer, data == null ? 0 : data.byteOffset); #elseif (nodejs && lime_opengl) - lime_gl_compressed_tex_sub_image_2d.call (target, level, xoffset, yoffset, width, height, format, data == null ? null : data, data == null ? null : data.byteOffset); + lime_gl_compressed_tex_sub_image_2d (target, level, xoffset, yoffset, width, height, format, data == null ? null : data, data == null ? null : data.byteOffset); #elseif java //GL13.glCompressedTexSubImage2D (target, level, xoffset, yoffset, width, height, format, data == null ? null : data.buffer, data == null ? null : data.byteOffset); #end @@ -701,7 +711,7 @@ class GL { #if (js && html5 && !display) context.copyTexImage2D (target, level, internalformat, x, y, width, height, border); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_copy_tex_image_2d.call (target, level, internalformat, x, y, width, height, border); + lime_gl_copy_tex_image_2d (target, level, internalformat, x, y, width, height, border); #elseif java GL11.glCopyTexImage2D (target, level, internalformat, x, y, width, height, border); #end @@ -714,7 +724,7 @@ class GL { #if (js && html5 && !display) context.copyTexSubImage2D (target, level, xoffset, yoffset, x, y, width, height); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_copy_tex_sub_image_2d.call (target, level, xoffset, yoffset, x, y, width, height); + lime_gl_copy_tex_sub_image_2d (target, level, xoffset, yoffset, x, y, width, height); #elseif java GL11.glCopyTexSubImage2D (target, level, xoffset, yoffset, x, y, width, height); #end @@ -727,7 +737,7 @@ class GL { #if (js && html5 && !display) return context.createBuffer (); #elseif ((cpp || neko || nodejs) && lime_opengl) - return new GLBuffer (version, lime_gl_create_buffer.call ()); + return new GLBuffer (version, lime_gl_create_buffer ()); #elseif java //return new GLBuffer (version, GL15.glGenBuffers (1)); return null; @@ -743,7 +753,7 @@ class GL { #if (js && html5 && !display) return context.createFramebuffer (); #elseif ((cpp || neko || nodejs) && lime_opengl) - return new GLFramebuffer (version, lime_gl_create_framebuffer.call ()); + return new GLFramebuffer (version, lime_gl_create_framebuffer ()); #elseif java //return new GLFramebuffer (version, GL30.glGenFramebuffers (1)); return null; @@ -759,7 +769,7 @@ class GL { #if (js && html5 && !display) return context.createProgram (); #elseif ((cpp || neko || nodejs) && lime_opengl) - return new GLProgram (version, lime_gl_create_program.call ()); + return new GLProgram (version, lime_gl_create_program ()); #elseif java return new GLProgram (version, GL20.glCreateProgram ()); #else @@ -774,7 +784,7 @@ class GL { #if (js && html5 && !display) return context.createRenderbuffer (); #elseif ((cpp || neko || nodejs) && lime_opengl) - return new GLRenderbuffer (version, lime_gl_create_render_buffer.call ()); + return new GLRenderbuffer (version, lime_gl_create_render_buffer ()); #elseif java //return new GLRenderbuffer (version, GL30.glGenRenderbuffers (1)); return null; @@ -790,7 +800,7 @@ class GL { #if (js && html5 && !display) return context.createShader (type); #elseif ((cpp || neko || nodejs) && lime_opengl) - return new GLShader (version, lime_gl_create_shader.call (type)); + return new GLShader (version, lime_gl_create_shader (type)); #elseif java return new GLShader (version, GL20.glCreateShader (type)); #else @@ -805,7 +815,7 @@ class GL { #if (js && html5 && !display) return context.createTexture (); #elseif ((cpp || neko || nodejs) && lime_opengl) - return new GLTexture (version, lime_gl_create_texture.call ()); + return new GLTexture (version, lime_gl_create_texture ()); #elseif java //return new GLTexture (version, GL11.glGenTextures (1)); return null; @@ -821,7 +831,7 @@ class GL { #if (js && html5 && !display) context.cullFace (mode); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_cull_face.call (mode); + lime_gl_cull_face (mode); #elseif java GL11.glCullFace (mode); #end @@ -834,7 +844,7 @@ class GL { #if (js && html5 && !display) context.deleteBuffer (buffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_delete_buffer.call (buffer.id); + lime_gl_delete_buffer (buffer.id); buffer.invalidate (); #elseif java GL15.glDeleteBuffers (buffer.id); @@ -849,7 +859,7 @@ class GL { #if (js && html5 && !display) context.deleteFramebuffer (framebuffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_delete_framebuffer.call (framebuffer.id); + lime_gl_delete_framebuffer (framebuffer.id); framebuffer.invalidate (); #elseif GL30.glDeleteFramebuffers (framebuffer.id); @@ -864,7 +874,7 @@ class GL { #if (js && html5 && !display) context.deleteProgram (program); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_delete_program.call (program.id); + lime_gl_delete_program (program.id); program.invalidate (); #elseif java GL20.glDeleteProgram (program.id); @@ -879,7 +889,7 @@ class GL { #if (js && html5 && !display) context.deleteRenderbuffer (renderbuffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_delete_render_buffer.call (renderbuffer.id); + lime_gl_delete_render_buffer (renderbuffer.id); renderbuffer.invalidate (); #elseif java GL30.glDeleteRenderbuffers (renderbuffer.id); @@ -894,7 +904,7 @@ class GL { #if (js && html5 && !display) context.deleteShader (shader); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_delete_shader.call (shader.id); + lime_gl_delete_shader (shader.id); shader.invalidate (); #elseif java GL20.glDeleteShader (shader.id); @@ -909,7 +919,7 @@ class GL { #if (js && html5 && !display) context.deleteTexture (texture); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_delete_texture.call (texture.id); + lime_gl_delete_texture (texture.id); texture.invalidate (); #elseif java GL11.glDeleteTextures (texture.id); @@ -924,7 +934,7 @@ class GL { #if (js && html5 && !display) context.depthFunc (func); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_depth_func.call (func); + lime_gl_depth_func (func); #elseif java GL11.glDepthFunc (func); #end @@ -937,7 +947,7 @@ class GL { #if (js && html5 && !display) context.depthMask (flag); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_depth_mask.call (flag); + lime_gl_depth_mask (flag); #elseif java GL11.glDepthMask (flag); #end @@ -950,7 +960,7 @@ class GL { #if (js && html5 && !display) context.depthRange (zNear, zFar); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_depth_range.call (zNear, zFar); + lime_gl_depth_range (zNear, zFar); #elseif java GL11.glDepthRange (zNear, zFar); #end @@ -963,7 +973,7 @@ class GL { #if (js && html5 && !display) context.detachShader (program, shader); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_detach_shader.call (program.id, shader.id); + lime_gl_detach_shader (program.id, shader.id); #elseif java GL20.glDetachShader (program.id, shader.id); #end @@ -976,7 +986,7 @@ class GL { #if (js && html5 && !display) context.disable (cap); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_disable.call (cap); + lime_gl_disable (cap); #elseif java GL11.glDisable (cap); #end @@ -989,7 +999,7 @@ class GL { #if (js && html5 && !display) context.disableVertexAttribArray (index); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_disable_vertex_attrib_array.call (index); + lime_gl_disable_vertex_attrib_array (index); #elseif java GL20.glDisableVertexAttribArray (index); #end @@ -1002,7 +1012,7 @@ class GL { #if (js && html5 && !display) context.drawArrays (mode, first, count); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_draw_arrays.call (mode, first, count); + lime_gl_draw_arrays (mode, first, count); #elseif java GL11.glDrawArrays (mode, first, count); #end @@ -1015,7 +1025,7 @@ class GL { #if (js && html5 && !display) context.drawElements (mode, count, type, offset); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_draw_elements.call (mode, count, type, offset); + lime_gl_draw_elements (mode, count, type, offset); #elseif java //GL11.glDrawElements (mode, count, type, offset); #end @@ -1028,7 +1038,7 @@ class GL { #if (js && html5 && !display) context.enable (cap); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_enable.call (cap); + lime_gl_enable (cap); #elseif java GL11.glEnable (cap); #end @@ -1041,7 +1051,7 @@ class GL { #if (js && html5 && !display) context.enableVertexAttribArray (index); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_enable_vertex_attrib_array.call (index); + lime_gl_enable_vertex_attrib_array (index); #elseif java GL20.glEnableVertexAttribArray (index); #end @@ -1054,7 +1064,7 @@ class GL { #if (js && html5 && !display) context.finish (); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_finish.call (); + lime_gl_finish (); #elseif java GL11.glFinish (); #end @@ -1067,7 +1077,7 @@ class GL { #if (js && html5 && !display) context.flush (); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_flush.call (); + lime_gl_flush (); #elseif java GL11.glFlush (); #end @@ -1080,7 +1090,7 @@ class GL { #if (js && html5 && !display) context.framebufferRenderbuffer (target, attachment, renderbuffertarget, renderbuffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_framebuffer_renderbuffer.call (target, attachment, renderbuffertarget, renderbuffer.id); + lime_gl_framebuffer_renderbuffer (target, attachment, renderbuffertarget, renderbuffer.id); #elseif java GL30.glFramebufferRenderbuffer (target, attachment, renderbuffertarget, renderbuffer.id); #end @@ -1093,7 +1103,7 @@ class GL { #if (js && html5 && !display) context.framebufferTexture2D (target, attachment, textarget, texture, level); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_framebuffer_texture2D.call (target, attachment, textarget, texture.id, level); + lime_gl_framebuffer_texture2D (target, attachment, textarget, texture.id, level); #elseif java GL30.glFramebufferTexture2D (target, attachment, textarget, texture.id, level); #end @@ -1106,7 +1116,7 @@ class GL { #if (js && html5 && !display) context.frontFace (mode); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_front_face.call (mode); + lime_gl_front_face (mode); #elseif java GL11.glFrontFace (mode); #end @@ -1119,7 +1129,7 @@ class GL { #if (js && html5 && !display) context.generateMipmap (target); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_generate_mipmap.call (target); + lime_gl_generate_mipmap (target); #elseif java GL30.glGenerateMipmap (target); #end @@ -1132,7 +1142,7 @@ class GL { #if (js && html5 && !display) return context.getActiveAttrib (program, index); #elseif ((cpp || neko || nodejs) && lime_opengl) - var result:Dynamic = lime_gl_get_active_attrib.call (program.id, index); + var result:Dynamic = lime_gl_get_active_attrib (program.id, index); return result; #elseif java //return GL20.glGetActiveAttrib (program.id, index); @@ -1149,7 +1159,7 @@ class GL { #if (js && html5 && !display) return context.getActiveUniform (program, index); #elseif ((cpp || neko || nodejs) && lime_opengl) - var result:Dynamic = lime_gl_get_active_uniform.call (program.id, index); + var result:Dynamic = lime_gl_get_active_uniform (program.id, index); return result; #elseif java //return GL20.glGetActiveUniform (program.id, index); @@ -1181,7 +1191,7 @@ class GL { #if (js && html5 && !display) return context.getAttribLocation (program, name); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_attrib_location.call (program.id, name); + return lime_gl_get_attrib_location (program.id, name); #elseif java return GL20.glGetAttribLocation (program.id, name); #else @@ -1196,7 +1206,7 @@ class GL { #if (js && html5 && !display) return context.getBufferParameter (target, pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_buffer_parameter.call (target, pname); + return lime_gl_get_buffer_parameter (target, pname); #elseif java //return GL15.glGetBufferParameter (target, pname); return 0; @@ -1212,7 +1222,7 @@ class GL { #if (js && html5 && !display) return context.getContextAttributes (); #elseif ((cpp || neko || nodejs) && lime_opengl) - var base:Dynamic = lime_gl_get_context_attributes.call (); + var base:Dynamic = lime_gl_get_context_attributes (); base.premultipliedAlpha = false; base.preserveDrawingBuffer = false; return base; @@ -1234,7 +1244,7 @@ class GL { #if (js && html5 && !display) return context.getError (); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_error.call (); + return lime_gl_get_error (); #elseif java return GL11.glGetError (); #else @@ -1249,7 +1259,7 @@ class GL { #if (js && html5 && !display) return context.getExtension (name); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_extension.call (name); + return lime_gl_get_extension (name); #else return null; #end @@ -1262,7 +1272,7 @@ class GL { #if (js && html5 && !display) return context.getFramebufferAttachmentParameter (target, attachment, pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_framebuffer_attachment_parameter.call (target, attachment, pname); + return lime_gl_get_framebuffer_attachment_parameter (target, attachment, pname); #elseif java //return GL30.glGetFramebufferAttachmentParameter (target, attachment, pname); return 0; @@ -1278,7 +1288,7 @@ class GL { #if (js && html5 && !display) return context.getParameter (pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_parameter.call (pname); + return lime_gl_get_parameter (pname); #elseif java return null; #else @@ -1293,7 +1303,7 @@ class GL { #if (js && html5 && !display) return context.getProgramInfoLog (program); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_program_info_log.call (program.id); + return lime_gl_get_program_info_log (program.id); #elseif java return GL20.glGetProgramInfoLog (program.id); #else @@ -1308,7 +1318,7 @@ class GL { #if (js && html5 && !display) return context.getProgramParameter (program, pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_program_parameter.call (program.id, pname); + return lime_gl_get_program_parameter (program.id, pname); #elseif java //return GL20.glGetProgramParameter (program.id, pname); return 0; @@ -1324,7 +1334,7 @@ class GL { #if (js && html5 && !display) return context.getRenderbufferParameter (target, pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_render_buffer_parameter.call (target, pname); + return lime_gl_get_render_buffer_parameter (target, pname); #elseif java //return GL30.glGetRenderbufferParameter (target, pname); return 0; @@ -1340,7 +1350,7 @@ class GL { #if (js && html5 && !display) return context.getShaderInfoLog (shader); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_shader_info_log.call (shader.id); + return lime_gl_get_shader_info_log (shader.id); #elseif java return GL20.glGetShaderInfoLog (shader.id); #else @@ -1355,7 +1365,7 @@ class GL { #if (js && html5 && !display) return context.getShaderParameter (shader, pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_shader_parameter.call (shader.id, pname); + return lime_gl_get_shader_parameter (shader.id, pname); #elseif java //return GL20.glGetShaderParameter (shader.id, pname); return 0; @@ -1371,7 +1381,7 @@ class GL { #if (js && html5 && !display) return context.getShaderPrecisionFormat (shadertype, precisiontype); #elseif ((cpp || neko || nodejs) && lime_opengl) - var result:Dynamic = lime_gl_get_shader_precision_format.call (shadertype, precisiontype); + var result:Dynamic = lime_gl_get_shader_precision_format (shadertype, precisiontype); return result; #elseif java //return GL20.glGetShaderPrecisionFormat (shadertype, precisiontype); @@ -1388,7 +1398,7 @@ class GL { #if (js && html5 && !display) return context.getShaderSource (shader); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_shader_source.call (shader.id); + return lime_gl_get_shader_source (shader.id); #elseif java return GL20.glGetShaderSource (shader.id); #else @@ -1404,7 +1414,7 @@ class GL { return context.getSupportedExtensions (); #elseif ((cpp || neko || nodejs) && lime_opengl) var result = new Array (); - lime_gl_get_supported_extensions.call (result); + lime_gl_get_supported_extensions (result); return result; #elseif java return null; @@ -1420,7 +1430,7 @@ class GL { #if (js && html5 && !display) return context.getTexParameter (target, pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_tex_parameter.call (target, pname); + return lime_gl_get_tex_parameter (target, pname); #elseif java //return GL11.nglGetTexParameteriv (target, pname); return 0; @@ -1436,7 +1446,7 @@ class GL { #if (js && html5 && !display) return context.getUniform (program, location); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_uniform.call (program.id, location); + return lime_gl_get_uniform (program.id, location); #elseif java //return GL20.glGetUniform (program.id, location); return null; @@ -1452,7 +1462,7 @@ class GL { #if (js && html5 && !display) return context.getUniformLocation (program, name); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_uniform_location.call (program.id, name); + return lime_gl_get_uniform_location (program.id, name); #elseif java return GL20.glGetUniformLocation (program.id, name); #else @@ -1467,7 +1477,7 @@ class GL { #if (js && html5 && !display) return context.getVertexAttrib (index, pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_vertex_attrib.call (index, pname); + return lime_gl_get_vertex_attrib (index, pname); #elseif java return 0; #else @@ -1482,7 +1492,7 @@ class GL { #if (js && html5 && !display) return context.getVertexAttribOffset (index, pname); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_get_vertex_attrib_offset.call (index, pname); + return lime_gl_get_vertex_attrib_offset (index, pname); #elseif java return 0; #else @@ -1497,7 +1507,7 @@ class GL { #if (js && html5 && !display) context.hint (target, mode); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_hint.call (target, mode); + lime_gl_hint (target, mode); #end } @@ -1508,7 +1518,7 @@ class GL { #if (js && html5 && !display) return context.isBuffer (buffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - return buffer != null && buffer.id > 0 && lime_gl_is_buffer.call (buffer.id); + return buffer != null && buffer.id > 0 && lime_gl_is_buffer (buffer.id); #else return false; #end @@ -1532,7 +1542,7 @@ class GL { #if (js && html5 && !display) return context.isEnabled (cap); #elseif ((cpp || neko || nodejs) && lime_opengl) - return lime_gl_is_enabled.call (cap); + return lime_gl_is_enabled (cap); #else return false; #end @@ -1545,7 +1555,7 @@ class GL { #if (js && html5 && !display) return context.isFramebuffer (framebuffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - return framebuffer != null && framebuffer.id > 0 && lime_gl_is_framebuffer.call (framebuffer.id); + return framebuffer != null && framebuffer.id > 0 && lime_gl_is_framebuffer (framebuffer.id); #else return false; #end @@ -1558,7 +1568,7 @@ class GL { #if (js && html5 && !display) return context.isProgram (program); #elseif ((cpp || neko || nodejs) && lime_opengl) - return program != null && program.id > 0 && lime_gl_is_program.call (program.id); + return program != null && program.id > 0 && lime_gl_is_program (program.id); #else return false; #end @@ -1571,7 +1581,7 @@ class GL { #if (js && html5 && !display) return context.isRenderbuffer (renderbuffer); #elseif ((cpp || neko || nodejs) && lime_opengl) - return renderbuffer != null && renderbuffer.id > 0 && lime_gl_is_renderbuffer.call (renderbuffer.id); + return renderbuffer != null && renderbuffer.id > 0 && lime_gl_is_renderbuffer (renderbuffer.id); #else return false; #end @@ -1584,7 +1594,7 @@ class GL { #if (js && html5 && !display) return context.isShader (shader); #elseif ((cpp || neko || nodejs) && lime_opengl) - return shader != null && shader.id > 0 && lime_gl_is_shader.call (shader.id); + return shader != null && shader.id > 0 && lime_gl_is_shader (shader.id); #else return false; #end @@ -1597,7 +1607,7 @@ class GL { #if (js && html5 && !display) return context.isTexture (texture); #elseif ((cpp || neko || nodejs) && lime_opengl) - return texture != null && texture.id > 0 && lime_gl_is_texture.call (texture.id); + return texture != null && texture.id > 0 && lime_gl_is_texture (texture.id); #else return false; #end @@ -1610,7 +1620,7 @@ class GL { #if (js && html5 && !display) context.lineWidth (width); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_line_width.call (width); + lime_gl_line_width (width); #end } @@ -1621,7 +1631,7 @@ class GL { #if (js && html5 && !display) context.linkProgram (program); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_link_program.call (program.id); + lime_gl_link_program (program.id); #end } @@ -1632,7 +1642,7 @@ class GL { #if (js && html5 && !display) context.pixelStorei (pname, param); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_pixel_storei.call (pname, param); + lime_gl_pixel_storei (pname, param); #end } @@ -1643,7 +1653,7 @@ class GL { #if (js && html5 && !display) context.polygonOffset (factor, units); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_polygon_offset.call (factor, units); + lime_gl_polygon_offset (factor, units); #end } @@ -1655,9 +1665,9 @@ class GL { context.readPixels (x, y, width, height, format, type, pixels); #elseif ((cpp || neko) && lime_opengl) var buffer = pixels == null ? null : pixels.buffer; - lime_gl_read_pixels.call (x, y, width, height, format, type, buffer, pixels == null ? 0 : pixels.byteOffset); + lime_gl_read_pixels (x, y, width, height, format, type, buffer, pixels == null ? 0 : pixels.byteOffset); #elseif (nodejs && lime_opengl) - lime_gl_read_pixels.call (x, y, width, height, format, type, pixels == null ? null : pixels, pixels == null ? null : pixels.byteOffset); + lime_gl_read_pixels (x, y, width, height, format, type, pixels == null ? null : pixels, pixels == null ? null : pixels.byteOffset); #end } @@ -1668,7 +1678,7 @@ class GL { #if (js && html5 && !display) context.renderbufferStorage (target, internalformat, width, height); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_renderbuffer_storage.call (target, internalformat, width, height); + lime_gl_renderbuffer_storage (target, internalformat, width, height); #end } @@ -1679,7 +1689,7 @@ class GL { #if (js && html5 && !display) context.sampleCoverage (value, invert); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_sample_coverage.call (value, invert); + lime_gl_sample_coverage (value, invert); #end } @@ -1690,7 +1700,7 @@ class GL { #if (js && html5 && !display) context.scissor (x, y, width, height); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_scissor.call (x, y, width, height); + lime_gl_scissor (x, y, width, height); #end } @@ -1701,7 +1711,7 @@ class GL { #if (js && html5 && !display) context.shaderSource (shader, source); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_shader_source.call (shader.id, source); + lime_gl_shader_source (shader.id, source); #end } @@ -1712,7 +1722,7 @@ class GL { #if (js && html5 && !display) context.stencilFunc (func, ref, mask); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_stencil_func.call (func, ref, mask); + lime_gl_stencil_func (func, ref, mask); #end } @@ -1723,7 +1733,7 @@ class GL { #if (js && html5 && !display) context.stencilFuncSeparate (face, func, ref, mask); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_stencil_func_separate.call (face, func, ref, mask); + lime_gl_stencil_func_separate (face, func, ref, mask); #end } @@ -1734,7 +1744,7 @@ class GL { #if (js && html5 && !display) context.stencilMask (mask); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_stencil_mask.call (mask); + lime_gl_stencil_mask (mask); #end } @@ -1745,7 +1755,7 @@ class GL { #if (js && html5 && !display) context.stencilMaskSeparate (face, mask); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_stencil_mask_separate.call (face, mask); + lime_gl_stencil_mask_separate (face, mask); #end } @@ -1756,7 +1766,7 @@ class GL { #if (js && html5 && !display) context.stencilOp (fail, zfail, zpass); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_stencil_op.call (fail, zfail, zpass); + lime_gl_stencil_op (fail, zfail, zpass); #end } @@ -1767,7 +1777,7 @@ class GL { #if (js && html5 && !display) context.stencilOpSeparate (face, fail, zfail, zpass); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_stencil_op_separate.call (face, fail, zfail, zpass); + lime_gl_stencil_op_separate (face, fail, zfail, zpass); #end } @@ -1779,9 +1789,9 @@ class GL { context.texImage2D (target, level, internalformat, width, height, border, format, type, pixels); #elseif ((cpp || neko) && lime_opengl) var buffer = pixels == null ? null : pixels.buffer; - lime_gl_tex_image_2d.call (target, level, internalformat, width, height, border, format, type, buffer, pixels == null ? 0 : pixels.byteOffset); + lime_gl_tex_image_2d (target, level, internalformat, width, height, border, format, type, buffer, pixels == null ? 0 : pixels.byteOffset); #elseif (nodejs && lime_opengl) - lime_gl_tex_image_2d.call (target, level, internalformat, width, height, border, format, type, pixels == null ? null : pixels, pixels == null ? null : pixels.byteOffset); + lime_gl_tex_image_2d (target, level, internalformat, width, height, border, format, type, pixels == null ? null : pixels, pixels == null ? null : pixels.byteOffset); #end } @@ -1792,7 +1802,7 @@ class GL { #if (js && html5 && !display) context.texParameterf (target, pname, param); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_tex_parameterf.call (target, pname, param); + lime_gl_tex_parameterf (target, pname, param); #end } @@ -1803,7 +1813,7 @@ class GL { #if (js && html5 && !display) context.texParameteri (target, pname, param); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_tex_parameteri.call (target, pname, param); + lime_gl_tex_parameteri (target, pname, param); #end } @@ -1815,9 +1825,9 @@ class GL { context.texSubImage2D (target, level, xoffset, yoffset, width, height, format, type, pixels); #elseif ((cpp || neko) && lime_opengl) var buffer = pixels == null ? null : pixels.buffer; - lime_gl_tex_sub_image_2d.call (target, level, xoffset, yoffset, width, height, format, type, buffer, pixels == null ? 0 : pixels.byteOffset); + lime_gl_tex_sub_image_2d (target, level, xoffset, yoffset, width, height, format, type, buffer, pixels == null ? 0 : pixels.byteOffset); #elseif (nodejs && lime_opengl) - lime_gl_tex_sub_image_2d.call (target, level, xoffset, yoffset, width, height, format, type, pixels == null ? null : pixels, pixels == null ? null : pixels.byteOffset); + lime_gl_tex_sub_image_2d (target, level, xoffset, yoffset, width, height, format, type, pixels == null ? null : pixels, pixels == null ? null : pixels.byteOffset); #end } @@ -1828,7 +1838,7 @@ class GL { #if (js && html5 && !display) context.uniform1f (location, x); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_uniform1f.call (location, x); + lime_gl_uniform1f (location, x); #end } @@ -1839,9 +1849,9 @@ class GL { #if (js && html5 && !display) context.uniform1fv (location, x); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform1fv.call (location, x.buffer); + lime_gl_uniform1fv (location, x.buffer); #elseif (nodejs && lime_opengl) - lime_gl_uniform1fv.call (location, x); + lime_gl_uniform1fv (location, x); #end } @@ -1852,7 +1862,7 @@ class GL { #if (js && html5 && !display) context.uniform1i (location, x); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_uniform1i.call (location, x); + lime_gl_uniform1i (location, x); #end } @@ -1863,9 +1873,9 @@ class GL { #if (js && html5 && !display) context.uniform1iv (location, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform1iv.call (location, v.buffer); + lime_gl_uniform1iv (location, v.buffer); #elseif (nodejs && lime_opengl) - lime_gl_uniform1iv.call (location, v); + lime_gl_uniform1iv (location, v); #end } @@ -1876,7 +1886,7 @@ class GL { #if (js && html5 && !display) context.uniform2f (location, x, y); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_uniform2f.call (location, x, y); + lime_gl_uniform2f (location, x, y); #end } @@ -1887,9 +1897,9 @@ class GL { #if (js && html5 && !display) context.uniform2fv (location, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform2fv.call (location, v.buffer); + lime_gl_uniform2fv (location, v.buffer); #elseif (nodejs && lime_opengl) - lime_gl_uniform2fv.call (location, v); + lime_gl_uniform2fv (location, v); #end } @@ -1900,7 +1910,7 @@ class GL { #if (js && html5 && !display) context.uniform2i (location, x, y); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_uniform2i.call (location, x, y); + lime_gl_uniform2i (location, x, y); #end } @@ -1911,9 +1921,9 @@ class GL { #if (js && html5 && !display) context.uniform2iv (location, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform2iv.call (location, v.buffer); + lime_gl_uniform2iv (location, v.buffer); #elseif (nodejs && lime_opengl) - lime_gl_uniform2iv.call (location, v); + lime_gl_uniform2iv (location, v); #end } @@ -1924,7 +1934,7 @@ class GL { #if (js && html5 && !display) context.uniform3f (location, x, y, z); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_uniform3f.call (location, x, y, z); + lime_gl_uniform3f (location, x, y, z); #end } @@ -1935,9 +1945,9 @@ class GL { #if (js && html5 && !display) context.uniform3fv (location, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform3fv.call (location, v.buffer); + lime_gl_uniform3fv (location, v.buffer); #elseif (nodejs && lime_opengl) - lime_gl_uniform3fv.call (location, v); + lime_gl_uniform3fv (location, v); #end } @@ -1948,7 +1958,7 @@ class GL { #if (js && html5 && !display) context.uniform3i (location, x, y, z); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_uniform3i.call (location, x, y, z); + lime_gl_uniform3i (location, x, y, z); #end } @@ -1959,9 +1969,9 @@ class GL { #if (js && html5 && !display) context.uniform3iv (location, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform3iv.call (location, v.buffer); + lime_gl_uniform3iv (location, v.buffer); #elseif (nodejs && lime_opengl) - lime_gl_uniform3iv.call (location, v); + lime_gl_uniform3iv (location, v); #end } @@ -1972,7 +1982,7 @@ class GL { #if (js && html5 && !display) context.uniform4f (location, x, y, z, w); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_uniform4f.call (location, x, y, z, w); + lime_gl_uniform4f (location, x, y, z, w); #end } @@ -1983,9 +1993,9 @@ class GL { #if (js && html5 && !display) context.uniform4fv (location, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform4fv.call (location, v.buffer); + lime_gl_uniform4fv (location, v.buffer); #elseif (nodejs && lime_opengl) - lime_gl_uniform4fv.call (location, v); + lime_gl_uniform4fv (location, v); #end } @@ -1996,7 +2006,7 @@ class GL { #if (js && html5 && !display) context.uniform4i (location, x, y, z, w); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_uniform4i.call (location, x, y, z, w); + lime_gl_uniform4i (location, x, y, z, w); #end } @@ -2007,9 +2017,9 @@ class GL { #if (js && html5 && !display) context.uniform4iv (location, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform4iv.call (location, v.buffer); + lime_gl_uniform4iv (location, v.buffer); #elseif (nodejs && lime_opengl) - lime_gl_uniform4iv.call (location, v); + lime_gl_uniform4iv (location, v); #end } @@ -2020,9 +2030,9 @@ class GL { #if (js && html5 && !display) context.uniformMatrix2fv (location, transpose, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform_matrix.call (location, transpose, v.buffer, 2); + lime_gl_uniform_matrix (location, transpose, v.buffer, 2); #elseif (nodejs && lime_opengl) - lime_gl_uniform_matrix.call (location, transpose, v, 2); + lime_gl_uniform_matrix (location, transpose, v, 2); #end } @@ -2033,9 +2043,9 @@ class GL { #if (js && html5 && !display) context.uniformMatrix3fv (location, transpose, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform_matrix.call (location, transpose, v.buffer, 3); + lime_gl_uniform_matrix (location, transpose, v.buffer, 3); #elseif (nodejs && lime_opengl) - lime_gl_uniform_matrix.call (location, transpose, v, 3); + lime_gl_uniform_matrix (location, transpose, v, 3); #end } @@ -2046,9 +2056,9 @@ class GL { #if (js && html5 && !display) context.uniformMatrix4fv (location, transpose, v); #elseif ((cpp || neko) && lime_opengl) - lime_gl_uniform_matrix.call (location, transpose, v.buffer, 4); + lime_gl_uniform_matrix (location, transpose, v.buffer, 4); #elseif (nodejs && lime_opengl) - lime_gl_uniform_matrix.call (location, transpose, v, 4); + lime_gl_uniform_matrix (location, transpose, v, 4); #end } @@ -2066,7 +2076,7 @@ class GL { #if (js && html5 && !display) context.useProgram (program); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_use_program.call (program == null ? 0 : program.id); + lime_gl_use_program (program == null ? 0 : program.id); #end } @@ -2077,7 +2087,7 @@ class GL { #if (js && html5 && !display) context.validateProgram (program); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_validate_program.call (program.id); + lime_gl_validate_program (program.id); #end } @@ -2088,7 +2098,7 @@ class GL { #if (js && html5 && !display) context.vertexAttrib1f (indx, x); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_vertex_attrib1f.call (indx, x); + lime_gl_vertex_attrib1f (indx, x); #end } @@ -2099,9 +2109,9 @@ class GL { #if (js && html5 && !display) context.vertexAttrib1fv (indx, values); #elseif ((cpp || neko) && lime_opengl) - lime_gl_vertex_attrib1fv.call (indx, values.buffer); + lime_gl_vertex_attrib1fv (indx, values.buffer); #elseif (nodejs && lime_opengl) - lime_gl_vertex_attrib1fv.call (indx, values); + lime_gl_vertex_attrib1fv (indx, values); #end } @@ -2112,7 +2122,7 @@ class GL { #if (js && html5 && !display) context.vertexAttrib2f (indx, x, y); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_vertex_attrib2f.call (indx, x, y); + lime_gl_vertex_attrib2f (indx, x, y); #end } @@ -2123,9 +2133,9 @@ class GL { #if (js && html5 && !display) context.vertexAttrib2fv (indx, values); #elseif ((cpp || neko) && lime_opengl) - lime_gl_vertex_attrib2fv.call (indx, values.buffer); + lime_gl_vertex_attrib2fv (indx, values.buffer); #elseif (nodejs && lime_opengl) - lime_gl_vertex_attrib2fv.call (indx, values); + lime_gl_vertex_attrib2fv (indx, values); #end } @@ -2136,7 +2146,7 @@ class GL { #if (js && html5 && !display) context.vertexAttrib3f (indx, x, y, z); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_vertex_attrib3f.call (indx, x, y, z); + lime_gl_vertex_attrib3f (indx, x, y, z); #end } @@ -2147,9 +2157,9 @@ class GL { #if (js && html5 && !display) context.vertexAttrib3fv (indx, values); #elseif ((cpp || neko) && lime_opengl) - lime_gl_vertex_attrib3fv.call (indx, values.buffer); + lime_gl_vertex_attrib3fv (indx, values.buffer); #elseif (nodejs && lime_opengl) - lime_gl_vertex_attrib3fv.call (indx, values); + lime_gl_vertex_attrib3fv (indx, values); #end } @@ -2160,7 +2170,7 @@ class GL { #if (js && html5 && !display) context.vertexAttrib4f (indx, x, y, z, w); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_vertex_attrib4f.call (indx, x, y, z, w); + lime_gl_vertex_attrib4f (indx, x, y, z, w); #end } @@ -2171,9 +2181,9 @@ class GL { #if (js && html5 && !display) context.vertexAttrib4fv (indx, values); #elseif ((cpp || neko) && lime_opengl) - lime_gl_vertex_attrib4fv.call (indx, values.buffer); + lime_gl_vertex_attrib4fv (indx, values.buffer); #elseif (nodejs && lime_opengl) - lime_gl_vertex_attrib4fv.call (indx, values); + lime_gl_vertex_attrib4fv (indx, values); #end } @@ -2184,7 +2194,7 @@ class GL { #if (js && html5 && !display) context.vertexAttribPointer (indx, size, type, normalized, stride, offset); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_vertex_attrib_pointer.call (indx, size, type, normalized, stride, offset); + lime_gl_vertex_attrib_pointer (indx, size, type, normalized, stride, offset); #end } @@ -2195,7 +2205,7 @@ class GL { #if (js && html5 && !display) context.viewport (x, y, width, height); #elseif ((cpp || neko || nodejs) && lime_opengl) - lime_gl_viewport.call (x, y, width, height); + lime_gl_viewport (x, y, width, height); #end } @@ -2205,141 +2215,140 @@ class GL { #if ((cpp || neko || nodejs) && lime_opengl) - - private static var lime_gl_active_texture = System.loadPrime ("lime", "lime_gl_active_texture", "iv"); - private static var lime_gl_attach_shader = System.loadPrime ("lime", "lime_gl_attach_shader", "iiv"); - private static var lime_gl_bind_attrib_location = System.loadPrime ("lime", "lime_gl_bind_attrib_location", "iisv"); - private static var lime_gl_bind_buffer = System.loadPrime ("lime", "lime_gl_bind_buffer", "iiv"); - private static var lime_gl_bind_framebuffer = System.loadPrime ("lime", "lime_gl_bind_framebuffer", "iiv"); - private static var lime_gl_bind_renderbuffer = System.loadPrime ("lime", "lime_gl_bind_renderbuffer", "iiv"); - private static var lime_gl_bind_texture = System.loadPrime ("lime", "lime_gl_bind_texture", "iiv"); - private static var lime_gl_blend_color = System.loadPrime ("lime", "lime_gl_blend_color", "ffffv"); - private static var lime_gl_blend_equation = System.loadPrime ("lime", "lime_gl_blend_equation", "iv"); - private static var lime_gl_blend_equation_separate = System.loadPrime ("lime", "lime_gl_blend_equation_separate", "iiv"); - private static var lime_gl_blend_func = System.loadPrime ("lime", "lime_gl_blend_func", "iiv"); - private static var lime_gl_blend_func_separate = System.loadPrime ("lime", "lime_gl_blend_func_separate", "iiiiv"); - private static var lime_gl_buffer_data = System.loadPrime ("lime", "lime_gl_buffer_data", "ioiiiv"); - private static var lime_gl_buffer_sub_data = System.loadPrime ("lime", "lime_gl_buffer_sub_data", "iioiiv"); - private static var lime_gl_check_framebuffer_status = System.loadPrime ("lime", "lime_gl_check_framebuffer_status", "ii"); - private static var lime_gl_clear = System.loadPrime ("lime", "lime_gl_clear", "iv"); - private static var lime_gl_clear_color = System.loadPrime ("lime", "lime_gl_clear_color", "ffffv"); - private static var lime_gl_clear_depth = System.loadPrime ("lime", "lime_gl_clear_depth", "fv"); - private static var lime_gl_clear_stencil = System.loadPrime ("lime", "lime_gl_clear_stencil", "iv"); - private static var lime_gl_color_mask = System.loadPrime ("lime", "lime_gl_color_mask", "bbbbv"); - private static var lime_gl_compile_shader = System.loadPrime ("lime", "lime_gl_compile_shader", "iv"); - private static var lime_gl_compressed_tex_image_2d = System.loadPrime ("lime", "lime_gl_compressed_tex_image_2d", "iiiiiioiv"); - private static var lime_gl_compressed_tex_sub_image_2d = System.loadPrime ("lime", "lime_gl_compressed_tex_sub_image_2d", "iiiiiiioiv"); - private static var lime_gl_copy_tex_image_2d = System.loadPrime ("lime", "lime_gl_copy_tex_image_2d", "iiiiiiiiv"); - private static var lime_gl_copy_tex_sub_image_2d = System.loadPrime ("lime", "lime_gl_copy_tex_sub_image_2d", "iiiiiiiiv"); - private static var lime_gl_create_buffer = System.loadPrime ("lime", "lime_gl_create_buffer", "i"); - private static var lime_gl_create_framebuffer = System.loadPrime ("lime", "lime_gl_create_framebuffer", "i"); - private static var lime_gl_create_program = System.loadPrime ("lime", "lime_gl_create_program", "i"); - private static var lime_gl_create_render_buffer = System.loadPrime ("lime", "lime_gl_create_render_buffer", "i"); - private static var lime_gl_create_shader = System.loadPrime ("lime", "lime_gl_create_shader", "ii"); - private static var lime_gl_create_texture = System.loadPrime ("lime", "lime_gl_create_texture", "i"); - private static var lime_gl_cull_face = System.loadPrime ("lime", "lime_gl_cull_face", "iv"); - private static var lime_gl_delete_buffer = System.loadPrime ("lime", "lime_gl_delete_buffer", "iv"); - private static var lime_gl_delete_framebuffer = System.loadPrime ("lime", "lime_gl_delete_framebuffer", "iv"); - private static var lime_gl_delete_program = System.loadPrime ("lime", "lime_gl_delete_program", "iv"); - private static var lime_gl_delete_render_buffer = System.loadPrime ("lime", "lime_gl_delete_render_buffer", "iv"); - private static var lime_gl_delete_shader = System.loadPrime ("lime", "lime_gl_delete_shader", "iv"); - private static var lime_gl_delete_texture = System.loadPrime ("lime", "lime_gl_delete_texture", "iv"); - private static var lime_gl_depth_func = System.loadPrime ("lime", "lime_gl_depth_func", "iv"); - private static var lime_gl_depth_mask = System.loadPrime ("lime", "lime_gl_depth_mask", "bv"); - private static var lime_gl_depth_range = System.loadPrime ("lime", "lime_gl_depth_range", "ffv"); - private static var lime_gl_detach_shader = System.loadPrime ("lime", "lime_gl_detach_shader", "iiv"); - private static var lime_gl_disable = System.loadPrime ("lime", "lime_gl_disable", "iv"); - private static var lime_gl_disable_vertex_attrib_array = System.loadPrime ("lime", "lime_gl_disable_vertex_attrib_array", "iv"); - private static var lime_gl_draw_arrays = System.loadPrime ("lime", "lime_gl_draw_arrays", "iiiv"); - private static var lime_gl_draw_elements = System.loadPrime ("lime", "lime_gl_draw_elements", "iiiiv"); - private static var lime_gl_enable = System.loadPrime ("lime", "lime_gl_enable", "iv"); - private static var lime_gl_enable_vertex_attrib_array = System.loadPrime ("lime", "lime_gl_enable_vertex_attrib_array", "iv"); - private static var lime_gl_finish = System.loadPrime ("lime", "lime_gl_finish", "v"); - private static var lime_gl_flush = System.loadPrime ("lime", "lime_gl_flush", "v"); - private static var lime_gl_framebuffer_renderbuffer = System.loadPrime ("lime", "lime_gl_framebuffer_renderbuffer", "iiiiv"); - private static var lime_gl_framebuffer_texture2D = System.loadPrime ("lime", "lime_gl_framebuffer_texture2D", "iiiiiv"); - private static var lime_gl_front_face = System.loadPrime ("lime", "lime_gl_front_face", "iv"); - private static var lime_gl_generate_mipmap = System.loadPrime ("lime", "lime_gl_generate_mipmap", "iv"); - private static var lime_gl_get_active_attrib = System.loadPrime ("lime", "lime_gl_get_active_attrib", "iio"); - private static var lime_gl_get_active_uniform = System.loadPrime ("lime", "lime_gl_get_active_uniform", "iio"); - private static var lime_gl_get_attrib_location = System.loadPrime ("lime", "lime_gl_get_attrib_location", "isi"); - private static var lime_gl_get_buffer_parameter = System.loadPrime ("lime", "lime_gl_get_buffer_parameter", "iii"); - private static var lime_gl_get_context_attributes = System.loadPrime ("lime", "lime_gl_get_context_attributes", "o"); - private static var lime_gl_get_error = System.loadPrime ("lime", "lime_gl_get_error", "i"); - private static var lime_gl_get_extension = System.loadPrime ("lime", "lime_gl_get_extension", "so"); - private static var lime_gl_get_framebuffer_attachment_parameter = System.loadPrime ("lime", "lime_gl_get_framebuffer_attachment_parameter", "iiii"); - private static var lime_gl_get_parameter = System.loadPrime ("lime", "lime_gl_get_parameter", "io"); - private static var lime_gl_get_program_info_log = System.loadPrime ("lime", "lime_gl_get_program_info_log", "is"); - private static var lime_gl_get_program_parameter = System.loadPrime ("lime", "lime_gl_get_program_parameter", "iii"); - private static var lime_gl_get_render_buffer_parameter = System.loadPrime ("lime", "lime_gl_get_render_buffer_parameter", "iii"); - private static var lime_gl_get_shader_info_log = System.loadPrime ("lime", "lime_gl_get_shader_info_log", "is"); - private static var lime_gl_get_shader_parameter = System.loadPrime ("lime", "lime_gl_get_shader_parameter", "iii"); - private static var lime_gl_get_shader_precision_format = System.loadPrime ("lime", "lime_gl_get_shader_precision_format", "iio"); - private static var lime_gl_get_shader_source = System.loadPrime ("lime", "lime_gl_get_shader_source", "is"); - private static var lime_gl_get_supported_extensions = System.loadPrime ("lime", "lime_gl_get_supported_extensions", "ov"); - private static var lime_gl_get_tex_parameter = System.loadPrime ("lime", "lime_gl_get_tex_parameter", "iii"); - private static var lime_gl_get_uniform = System.loadPrime ("lime", "lime_gl_get_uniform", "iio"); - private static var lime_gl_get_uniform_location = System.loadPrime ("lime", "lime_gl_get_uniform_location", "isi"); - private static var lime_gl_get_vertex_attrib = System.loadPrime ("lime", "lime_gl_get_vertex_attrib", "iii"); - private static var lime_gl_get_vertex_attrib_offset = System.loadPrime ("lime", "lime_gl_get_vertex_attrib_offset", "iii"); - private static var lime_gl_hint = System.loadPrime ("lime", "lime_gl_hint", "iiv"); - private static var lime_gl_is_buffer = System.loadPrime ("lime", "lime_gl_is_buffer", "ib"); - private static var lime_gl_is_enabled = System.loadPrime ("lime", "lime_gl_is_enabled", "ib"); - private static var lime_gl_is_framebuffer = System.loadPrime ("lime", "lime_gl_is_framebuffer", "ib"); - private static var lime_gl_is_program = System.loadPrime ("lime", "lime_gl_is_program", "ib"); - private static var lime_gl_is_renderbuffer = System.loadPrime ("lime", "lime_gl_is_renderbuffer", "ib"); - private static var lime_gl_is_shader = System.loadPrime ("lime", "lime_gl_is_shader", "ib"); - private static var lime_gl_is_texture = System.loadPrime ("lime", "lime_gl_is_texture", "ib"); - private static var lime_gl_line_width = System.loadPrime ("lime", "lime_gl_line_width", "fv"); - private static var lime_gl_link_program = System.loadPrime ("lime", "lime_gl_link_program", "iv"); - private static var lime_gl_pixel_storei = System.loadPrime ("lime", "lime_gl_pixel_storei", "iiv"); - private static var lime_gl_polygon_offset = System.loadPrime ("lime", "lime_gl_polygon_offset", "ffv"); - private static var lime_gl_read_pixels = System.loadPrime ("lime", "lime_gl_read_pixels", "iiiiiioiv"); - private static var lime_gl_renderbuffer_storage = System.loadPrime ("lime", "lime_gl_renderbuffer_storage", "iiiiv"); - private static var lime_gl_sample_coverage = System.loadPrime ("lime", "lime_gl_sample_coverage", "fbv"); - private static var lime_gl_scissor = System.loadPrime ("lime", "lime_gl_scissor", "iiiiv"); - private static var lime_gl_shader_source = System.loadPrime ("lime", "lime_gl_shader_source", "isv"); - private static var lime_gl_stencil_func = System.loadPrime ("lime", "lime_gl_stencil_func", "iiiv"); - private static var lime_gl_stencil_func_separate = System.loadPrime ("lime", "lime_gl_stencil_func_separate", "iiiiv"); - private static var lime_gl_stencil_mask = System.loadPrime ("lime", "lime_gl_stencil_mask", "iv"); - private static var lime_gl_stencil_mask_separate = System.loadPrime ("lime", "lime_gl_stencil_mask_separate", "iiv"); - private static var lime_gl_stencil_op = System.loadPrime ("lime", "lime_gl_stencil_op", "iiiv"); - private static var lime_gl_stencil_op_separate = System.loadPrime ("lime", "lime_gl_stencil_op_separate", "iiiiv"); - private static var lime_gl_tex_image_2d = System.loadPrime ("lime", "lime_gl_tex_image_2d", "iiiiiiiioiv"); - private static var lime_gl_tex_parameterf = System.loadPrime ("lime", "lime_gl_tex_parameterf", "iifv"); - private static var lime_gl_tex_parameteri = System.loadPrime ("lime", "lime_gl_tex_parameteri", "iiiv"); - private static var lime_gl_tex_sub_image_2d = System.loadPrime ("lime", "lime_gl_tex_sub_image_2d", "iiiiiiiioiv"); - private static var lime_gl_uniform1f = System.loadPrime ("lime", "lime_gl_uniform1f", "ifv"); - private static var lime_gl_uniform1fv = System.loadPrime ("lime", "lime_gl_uniform1fv", "iov"); - private static var lime_gl_uniform1i = System.loadPrime ("lime", "lime_gl_uniform1i", "iiv"); - private static var lime_gl_uniform1iv = System.loadPrime ("lime", "lime_gl_uniform1iv", "iov"); - private static var lime_gl_uniform2f = System.loadPrime ("lime", "lime_gl_uniform2f", "iffv"); - private static var lime_gl_uniform2fv = System.loadPrime ("lime", "lime_gl_uniform2fv", "iov"); - private static var lime_gl_uniform2i = System.loadPrime ("lime", "lime_gl_uniform2i", "iiiv"); - private static var lime_gl_uniform2iv = System.loadPrime ("lime", "lime_gl_uniform2iv", "iov"); - private static var lime_gl_uniform3f = System.loadPrime ("lime", "lime_gl_uniform3f", "ifffv"); - private static var lime_gl_uniform3fv = System.loadPrime ("lime", "lime_gl_uniform3fv", "iov"); - private static var lime_gl_uniform3i = System.loadPrime ("lime", "lime_gl_uniform3i", "iiiiv"); - private static var lime_gl_uniform3iv = System.loadPrime ("lime", "lime_gl_uniform3iv", "iov"); - private static var lime_gl_uniform4f = System.loadPrime ("lime", "lime_gl_uniform4f", "iffffv"); - private static var lime_gl_uniform4fv = System.loadPrime ("lime", "lime_gl_uniform4fv", "iov"); - private static var lime_gl_uniform4i = System.loadPrime ("lime", "lime_gl_uniform4i", "iiiiiv"); - private static var lime_gl_uniform4iv = System.loadPrime ("lime", "lime_gl_uniform4iv", "iov"); - private static var lime_gl_uniform_matrix = System.loadPrime ("lime", "lime_gl_uniform_matrix", "iboiv"); - private static var lime_gl_use_program = System.loadPrime ("lime", "lime_gl_use_program", "iv"); - private static var lime_gl_validate_program = System.loadPrime ("lime", "lime_gl_validate_program", "iv"); - private static var lime_gl_version = System.loadPrime ("lime", "lime_gl_version", "s"); - private static var lime_gl_vertex_attrib1f = System.loadPrime ("lime", "lime_gl_vertex_attrib1f", "ifv"); - private static var lime_gl_vertex_attrib1fv = System.loadPrime ("lime", "lime_gl_vertex_attrib1fv", "iov"); - private static var lime_gl_vertex_attrib2f = System.loadPrime ("lime", "lime_gl_vertex_attrib2f", "iffv"); - private static var lime_gl_vertex_attrib2fv = System.loadPrime ("lime", "lime_gl_vertex_attrib2fv", "iov"); - private static var lime_gl_vertex_attrib3f = System.loadPrime ("lime", "lime_gl_vertex_attrib3f", "ifffv"); - private static var lime_gl_vertex_attrib3fv = System.loadPrime ("lime", "lime_gl_vertex_attrib3fv", "iov"); - private static var lime_gl_vertex_attrib4f = System.loadPrime ("lime", "lime_gl_vertex_attrib4f", "iffffv"); - private static var lime_gl_vertex_attrib4fv = System.loadPrime ("lime", "lime_gl_vertex_attrib4fv", "iov"); - private static var lime_gl_vertex_attrib_pointer = System.loadPrime ("lime", "lime_gl_vertex_attrib_pointer", "iiibiiv"); - private static var lime_gl_viewport = System.loadPrime ("lime", "lime_gl_viewport", "iiiiv"); - + @:cffi private static function lime_gl_active_texture (texture:Int):Void; + @:cffi private static function lime_gl_attach_shader (program:Int, shader:Int):Void; + @:cffi private static function lime_gl_bind_attrib_location (program:Int, index:Int, name:String):Void; + @:cffi private static function lime_gl_bind_buffer (target:Int, buffer:Int):Void; + @:cffi private static function lime_gl_bind_framebuffer (target:Int, framebuffer:Int):Void; + @:cffi private static function lime_gl_bind_renderbuffer (target:Int, renderbuffer:Int):Void; + @:cffi private static function lime_gl_bind_texture (target:Int, texture:Int):Void; + @:cffi private static function lime_gl_blend_color (red:Float32, green:Float32, blue:Float32, alpha:Float32):Void; + @:cffi private static function lime_gl_blend_equation (mode:Int):Void; + @:cffi private static function lime_gl_blend_equation_separate (modeRGB:Int, modeAlpha:Int):Void; + @:cffi private static function lime_gl_blend_func (sfactor:Int, dfactor:Int):Void; + @:cffi private static function lime_gl_blend_func_separate (srcRGB:Int, dstRGB:Int, srcAlpha:Int, dstAlpha:Int):Void; + @:cffi private static function lime_gl_buffer_data (target:Int, buffer:Dynamic, byteOffset:Int, size:Int, usage:Int):Void; + @:cffi private static function lime_gl_buffer_sub_data (target:Int, offset:Int, buffer:Dynamic, byteOffset:Int, size:Int):Void; + @:cffi private static function lime_gl_check_framebuffer_status (target:Int):Int; + @:cffi private static function lime_gl_clear (mask:Int):Void; + @:cffi private static function lime_gl_clear_color (red:Float32, green:Float32, blue:Float32, alpha:Float32):Void; + @:cffi private static function lime_gl_clear_depth (depth:Float32):Void; + @:cffi private static function lime_gl_clear_stencil (s:Int):Void; + @:cffi private static function lime_gl_color_mask (red:Bool, green:Bool, blue:Bool, alpha:Bool):Void; + @:cffi private static function lime_gl_compile_shader (shader:Int):Void; + @:cffi private static function lime_gl_compressed_tex_image_2d (target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, buffer:Dynamic, byteOffset:Int):Void; + @:cffi private static function lime_gl_compressed_tex_sub_image_2d (target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, buffer:Dynamic, byteOffset:Int):Void; + @:cffi private static function lime_gl_copy_tex_image_2d (target:Int, level:Int, internalformat:Int, x:Int, y:Int, width:Int, height:Int, border:Int):Void; + @:cffi private static function lime_gl_copy_tex_sub_image_2d (target:Int, level:Int, xoffset:Int, yoffset:Int, x:Int, y:Int, width:Int, height:Int):Void; + @:cffi private static function lime_gl_create_buffer ():Int; + @:cffi private static function lime_gl_create_framebuffer ():Int; + @:cffi private static function lime_gl_create_program ():Int; + @:cffi private static function lime_gl_create_render_buffer ():Int; + @:cffi private static function lime_gl_create_shader (type:Int):Int; + @:cffi private static function lime_gl_create_texture ():Int; + @:cffi private static function lime_gl_cull_face (mode:Int):Void; + @:cffi private static function lime_gl_delete_buffer (buffer:Int):Void; + @:cffi private static function lime_gl_delete_framebuffer (framebuffer:Int):Void; + @:cffi private static function lime_gl_delete_program (program:Int):Void; + @:cffi private static function lime_gl_delete_render_buffer (renderbuffer:Int):Void; + @:cffi private static function lime_gl_delete_shader (shader:Int):Void; + @:cffi private static function lime_gl_delete_texture (texture:Int):Void; + @:cffi private static function lime_gl_depth_func (func:Int):Void; + @:cffi private static function lime_gl_depth_mask (flag:Bool):Void; + @:cffi private static function lime_gl_depth_range (zNear:Float32, zFar:Float32):Void; + @:cffi private static function lime_gl_detach_shader (program:Int, shader:Int):Void; + @:cffi private static function lime_gl_disable (cap:Int):Void; + @:cffi private static function lime_gl_disable_vertex_attrib_array (index:Int):Void; + @:cffi private static function lime_gl_draw_arrays (mode:Int, first:Int, count:Int):Void; + @:cffi private static function lime_gl_draw_elements (mode:Int, count:Int, type:Int, offset:Int):Void; + @:cffi private static function lime_gl_enable (cap:Int):Void; + @:cffi private static function lime_gl_enable_vertex_attrib_array (index:Int):Void; + @:cffi private static function lime_gl_finish ():Void; + @:cffi private static function lime_gl_flush ():Void; + @:cffi private static function lime_gl_framebuffer_renderbuffer (target:Int, attachment:Int, renderbuffertarget:Int, renderbuffer:Int):Void; + @:cffi private static function lime_gl_framebuffer_texture2D (target:Int, attachment:Int, textarget:Int, texture:Int, level:Int):Void; + @:cffi private static function lime_gl_front_face (mode:Int):Void; + @:cffi private static function lime_gl_generate_mipmap (target:Int):Void; + @:cffi private static function lime_gl_get_active_attrib (program:Int, index:Int):Dynamic; + @:cffi private static function lime_gl_get_active_uniform (program:Int, index:Int):Dynamic; + @:cffi private static function lime_gl_get_attrib_location (program:Int, name:String):Int; + @:cffi private static function lime_gl_get_buffer_parameter (target:Int, pname:Int):Int; + @:cffi private static function lime_gl_get_context_attributes ():Dynamic; + @:cffi private static function lime_gl_get_error ():Int; + @:cffi private static function lime_gl_get_extension (name:String):Dynamic; + @:cffi private static function lime_gl_get_framebuffer_attachment_parameter (target:Int, attachment:Int, pname:Int):Int; + @:cffi private static function lime_gl_get_parameter (pname:Int):Dynamic; + @:cffi private static function lime_gl_get_program_info_log (program:Int):String; + @:cffi private static function lime_gl_get_program_parameter (program:Int, pname:Int):Int; + @:cffi private static function lime_gl_get_render_buffer_parameter (target:Int, pname:Int):Int; + @:cffi private static function lime_gl_get_shader_info_log (shader:Int):String; + @:cffi private static function lime_gl_get_shader_parameter (shader:Int, pname:Int):Int; + @:cffi private static function lime_gl_get_shader_precision_format (shadertype:Int, precisiontype:Int):Dynamic; + @:cffi private static function lime_gl_get_shader_source (shader:Int):String; + @:cffi private static function lime_gl_get_supported_extensions (result:Dynamic):Void; + @:cffi private static function lime_gl_get_tex_parameter (target:Int, pname:Int):Int; + @:cffi private static function lime_gl_get_uniform (program:Int, location:Int):Dynamic; + @:cffi private static function lime_gl_get_uniform_location (program:Int, name:String):Int; + @:cffi private static function lime_gl_get_vertex_attrib (index:Int, pname:Int):Int; + @:cffi private static function lime_gl_get_vertex_attrib_offset (index:Int, pname:Int):Int; + @:cffi private static function lime_gl_hint (target:Int, mode:Int):Void; + @:cffi private static function lime_gl_is_buffer (buffer:Int):Bool; + @:cffi private static function lime_gl_is_enabled (cap:Int):Bool; + @:cffi private static function lime_gl_is_framebuffer (framebuffer:Int):Bool; + @:cffi private static function lime_gl_is_program (program:Int):Bool; + @:cffi private static function lime_gl_is_renderbuffer (renderbuffer:Int):Bool; + @:cffi private static function lime_gl_is_shader (shader:Int):Bool; + @:cffi private static function lime_gl_is_texture (texture:Int):Bool; + @:cffi private static function lime_gl_line_width (width:Float32):Void; + @:cffi private static function lime_gl_link_program (program:Int):Void; + @:cffi private static function lime_gl_pixel_storei (pname:Int, param:Int):Void; + @:cffi private static function lime_gl_polygon_offset (factor:Float32, units:Float32):Void; + @:cffi private static function lime_gl_read_pixels (x:Int, y:Int, width:Int, height:Int, format:Int, type:Int, buffer:Dynamic, byteOffset:Int):Void; + @:cffi private static function lime_gl_renderbuffer_storage (target:Int, internalformat:Int, width:Int, height:Int):Void; + @:cffi private static function lime_gl_sample_coverage (value:Float32, invert:Bool):Void; + @:cffi private static function lime_gl_scissor (x:Int, y:Int, width:Int, height:Int):Void; + @:cffi private static function lime_gl_shader_source (shader:Int, source:String):Void; + @:cffi private static function lime_gl_stencil_func (func:Int, ref:Int, mask:Int):Void; + @:cffi private static function lime_gl_stencil_func_separate (face:Int, func:Int, ref:Int, mask:Int):Void; + @:cffi private static function lime_gl_stencil_mask (mask:Int):Void; + @:cffi private static function lime_gl_stencil_mask_separate (face:Int, mask:Int):Void; + @:cffi private static function lime_gl_stencil_op (fail:Int, zfail:Int, zpass:Int):Void; + @:cffi private static function lime_gl_stencil_op_separate (face:Int, fail:Int, zfail:Int, zpass:Int):Void; + @:cffi private static function lime_gl_tex_image_2d (target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, buffer:Dynamic, byteOffset:Int):Void; + @:cffi private static function lime_gl_tex_parameterf (target:Int, pname:Int, param:Float32):Void; + @:cffi private static function lime_gl_tex_parameteri (target:Int, pname:Int, param:Int):Void; + @:cffi private static function lime_gl_tex_sub_image_2d (target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, buffer:Dynamic, byteOffset:Int):Void; + @:cffi private static function lime_gl_uniform1f (location:Int, x:Float32):Void; + @:cffi private static function lime_gl_uniform1fv (location:Int, v:Dynamic):Void; + @:cffi private static function lime_gl_uniform1i (location:Int, x:Int):Void; + @:cffi private static function lime_gl_uniform1iv (location:Int, v:Dynamic):Void; + @:cffi private static function lime_gl_uniform2f (location:Int, x:Float32, y:Float32):Void; + @:cffi private static function lime_gl_uniform2fv (location:Int, v:Dynamic):Void; + @:cffi private static function lime_gl_uniform2i (location:Int, x:Int, y:Int):Void; + @:cffi private static function lime_gl_uniform2iv (location:Int, v:Dynamic):Void; + @:cffi private static function lime_gl_uniform3f (location:Int, x:Float32, y:Float32, z:Float32):Void; + @:cffi private static function lime_gl_uniform3fv (location:Int, v:Dynamic):Void; + @:cffi private static function lime_gl_uniform3i (location:Int, x:Int, y:Int, z:Int):Void; + @:cffi private static function lime_gl_uniform3iv (location:Int, v:Dynamic):Void; + @:cffi private static function lime_gl_uniform4f (location:Int, x:Float32, y:Float32, z:Float32, w:Float32):Void; + @:cffi private static function lime_gl_uniform4fv (location:Int, v:Dynamic):Void; + @:cffi private static function lime_gl_uniform4i (location:Int, x:Int, y:Int, z:Int, w:Int):Void; + @:cffi private static function lime_gl_uniform4iv (location:Int, v:Dynamic):Void; + @:cffi private static function lime_gl_uniform_matrix (location:Int, transpose:Bool, buffer:Dynamic, count:Int):Void; + @:cffi private static function lime_gl_use_program (program:Int):Void; + @:cffi private static function lime_gl_validate_program (program:Int):Void; + @:cffi private static function lime_gl_version ():String; + @:cffi private static function lime_gl_vertex_attrib1f (indx:Int, x:Float32):Void; + @:cffi private static function lime_gl_vertex_attrib1fv (indx:Int, values:Dynamic):Void; + @:cffi private static function lime_gl_vertex_attrib2f (indx:Int, x:Float32, y:Float32):Void; + @:cffi private static function lime_gl_vertex_attrib2fv (indx:Int, values:Dynamic):Void; + @:cffi private static function lime_gl_vertex_attrib3f (indx:Int, x:Float32, y:Float32, z:Float32):Void; + @:cffi private static function lime_gl_vertex_attrib3fv (indx:Int, values:Dynamic):Void; + @:cffi private static function lime_gl_vertex_attrib4f (indx:Int, x:Float32, y:Float32, z:Float32, w:Float32):Void; + @:cffi private static function lime_gl_vertex_attrib4fv (indx:Int, values:Dynamic):Void; + @:cffi private static function lime_gl_vertex_attrib_pointer (indx:Int, size:Int, type:Int, normalized:Bool, stride:Int, offset:Int):Void; + @:cffi private static function lime_gl_viewport (x:Int, y:Int, width:Int, height:Int):Void; #end + } \ No newline at end of file diff --git a/lime/graphics/utils/ImageDataUtil.hx b/lime/graphics/utils/ImageDataUtil.hx index 56e65ac9b..8375d08e8 100644 --- a/lime/graphics/utils/ImageDataUtil.hx +++ b/lime/graphics/utils/ImageDataUtil.hx @@ -13,10 +13,14 @@ import lime.math.color.RGBA; import lime.math.ColorMatrix; import lime.math.Rectangle; import lime.math.Vector2; -import lime.system.System; +import lime.system.CFFI; import lime.utils.ByteArray; import lime.utils.UInt8Array; +#if !macro +@:build(lime.system.CFFI.build()) +#end + @:access(lime.math.color.RGBA) @@ -29,7 +33,7 @@ class ImageDataUtil { if (data == null) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_color_transform.call (image, rect, colorMatrix); else + if (CFFI.enabled) lime_image_data_util_color_transform (image, rect, colorMatrix); else #end { @@ -94,7 +98,7 @@ class ImageDataUtil { if (srcData == null || destData == null) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_copy_channel.call (image, sourceImage, sourceRect, destPoint, srcIdx, destIdx); else + if (CFFI.enabled) lime_image_data_util_copy_channel (image, sourceImage, sourceRect, destPoint, srcIdx, destIdx); else #end { @@ -155,7 +159,7 @@ class ImageDataUtil { public static function copyPixels (image:Image, sourceImage:Image, sourceRect:Rectangle, destPoint:Vector2, alphaImage:Image = null, alphaPoint:Vector2 = null, mergeAlpha:Bool = false):Void { #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_copy_pixels.call (image, sourceImage, sourceRect, destPoint, alphaImage, alphaPoint, mergeAlpha); else + if (CFFI.enabled) lime_image_data_util_copy_pixels (image, sourceImage, sourceRect, destPoint, alphaImage, alphaPoint, mergeAlpha); else #end { @@ -320,7 +324,7 @@ class ImageDataUtil { if (data == null) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_fill_rect.call (image, rect, (fillColor >> 16) & 0xFFFF, (fillColor) & 0xFFFF); else // TODO: Better Int32 solution + if (CFFI.enabled) lime_image_data_util_fill_rect (image, rect, (fillColor >> 16) & 0xFFFF, (fillColor) & 0xFFFF); else // TODO: Better Int32 solution #end { @@ -357,7 +361,7 @@ class ImageDataUtil { if (format == ARGB32) color = ((color & 0xFFFFFF) << 8) | ((color >> 24) & 0xFF); #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_flood_fill.call (image, x, y, (color >> 16) & 0xFFFF, (color) & 0xFFFF); else // TODO: Better Int32 solution + if (CFFI.enabled) lime_image_data_util_flood_fill (image, x, y, (color >> 16) & 0xFFFF, (color) & 0xFFFF); else // TODO: Better Int32 solution #end { @@ -647,7 +651,7 @@ class ImageDataUtil { #end #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_get_pixels.call (image, rect, format, byteArray); else + if (CFFI.enabled) lime_image_data_util_get_pixels (image, rect, format, byteArray); else #end { @@ -709,7 +713,7 @@ class ImageDataUtil { if (image.buffer.data == null || sourceImage.buffer.data == null) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_merge.call (image, sourceImage, sourceRect, destPoint, redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier); else + if (CFFI.enabled) lime_image_data_util_merge (image, sourceImage, sourceRect, destPoint, redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier); else #end { @@ -762,7 +766,7 @@ class ImageDataUtil { if (data == null || !image.buffer.transparent) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_multiply_alpha.call (image); else + if (CFFI.enabled) lime_image_data_util_multiply_alpha (image); else #end { @@ -792,7 +796,7 @@ class ImageDataUtil { var newBuffer = new ImageBuffer (new UInt8Array (newWidth * newHeight * 4), newWidth, newHeight); #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_resize.call (image, newBuffer, newWidth, newHeight); else + if (CFFI.enabled) lime_image_data_util_resize (image, newBuffer, newWidth, newHeight); else #end { @@ -894,7 +898,7 @@ class ImageDataUtil { if (data == null) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_set_format.call (image, format); else + if (CFFI.enabled) lime_image_data_util_set_format (image, format); else #end { @@ -1022,7 +1026,7 @@ class ImageDataUtil { if (image.buffer.data == null) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_set_pixels.call (image, rect, byteArray, format); else + if (CFFI.enabled) lime_image_data_util_set_pixels (image, rect, byteArray, format); else #end { @@ -1069,7 +1073,7 @@ class ImageDataUtil { if (data == null) return; #if ((cpp || neko) && !disable_cffi) - if (!System.disableCFFI) lime_image_data_util_unmultiply_alpha.call (image); else + if (CFFI.enabled) lime_image_data_util_unmultiply_alpha (image); else #end { @@ -1100,18 +1104,18 @@ class ImageDataUtil { #if (cpp || neko || nodejs) - private static var lime_image_data_util_color_transform = System.loadPrime ("lime", "lime_image_data_util_color_transform", "ooov"); - private static var lime_image_data_util_copy_channel = System.loadPrime ("lime", "lime_image_data_util_copy_channel", "ooooiiv"); - private static var lime_image_data_util_copy_pixels = System.loadPrime ("lime", "lime_image_data_util_copy_pixels", "oooooobv"); - private static var lime_image_data_util_fill_rect = System.loadPrime ("lime", "lime_image_data_util_fill_rect", "ooiiv"); - private static var lime_image_data_util_flood_fill = System.loadPrime ("lime", "lime_image_data_util_flood_fill", "oiiiiv"); - private static var lime_image_data_util_get_pixels = System.loadPrime ("lime", "lime_image_data_util_get_pixels", "ooiov"); - private static var lime_image_data_util_merge = System.loadPrime ("lime", "lime_image_data_util_merge", "ooooiiiiv"); - private static var lime_image_data_util_multiply_alpha = System.loadPrime ("lime", "lime_image_data_util_multiply_alpha", "ov"); - private static var lime_image_data_util_resize = System.loadPrime ("lime", "lime_image_data_util_resize", "ooiiv"); - private static var lime_image_data_util_set_format = System.loadPrime ("lime", "lime_image_data_util_set_format", "oiv"); - private static var lime_image_data_util_set_pixels = System.loadPrime ("lime", "lime_image_data_util_set_pixels", "oooiv"); - private static var lime_image_data_util_unmultiply_alpha = System.loadPrime ("lime", "lime_image_data_util_unmultiply_alpha", "ov"); + @:cffi private static function lime_image_data_util_color_transform (image:Dynamic, rect:Dynamic, colorMatrix:Dynamic):Void; + @:cffi private static function lime_image_data_util_copy_channel (image:Dynamic, sourceImage:Dynamic, sourceRect:Dynamic, destPoint:Dynamic, srcChannel:Int, destChannel:Int):Void; + @:cffi private static function lime_image_data_util_copy_pixels (image:Dynamic, sourceImage:Dynamic, sourceRect:Dynamic, destPoint:Dynamic, alphaImage:Dynamic, alphaPoint:Dynamic, mergeAlpha:Bool):Void; + @:cffi private static function lime_image_data_util_fill_rect (image:Dynamic, rect:Dynamic, rg:Int, ba:Int):Void; + @:cffi private static function lime_image_data_util_flood_fill (image:Dynamic, x:Int, y:Int, rg:Int, ba:Int):Void; + @:cffi private static function lime_image_data_util_get_pixels (image:Dynamic, rect:Dynamic, format:Int, bytes:Dynamic):Void; + @:cffi private static function lime_image_data_util_merge (image:Dynamic, sourceImage:Dynamic, sourceRect:Dynamic, destPoint:Dynamic, redMultiplier:Int, greenMultiplier:Int, blueMultiplier:Int, alphaMultiplier:Int):Void; + @:cffi private static function lime_image_data_util_multiply_alpha (image:Dynamic):Void; + @:cffi private static function lime_image_data_util_resize (image:Dynamic, buffer:Dynamic, width:Int, height:Int):Void; + @:cffi private static function lime_image_data_util_set_format (image:Dynamic, format:Int):Void; + @:cffi private static function lime_image_data_util_set_pixels (image:Dynamic, rect:Dynamic, bytes:Dynamic, format:Int):Void; + @:cffi private static function lime_image_data_util_unmultiply_alpha (image:Dynamic):Void; #end diff --git a/lime/system/CFFI.hx b/lime/system/CFFI.hx index 0b517bb42..ed60b87c9 100644 --- a/lime/system/CFFI.hx +++ b/lime/system/CFFI.hx @@ -1,25 +1,532 @@ -package lime.system; +package lime.system; #if !macro -import lime.system.System; +#if sys +import sys.io.Process; +#end + + +class CFFI { + + + @:noCompletion private static var __moduleNames:Map = null; + + #if neko + private static var __loadedNekoAPI:Bool; + #elseif nodejs + private static var __nodeNDLLModule:Dynamic; + #end + + public static var available:Bool; + public static var enabled:Bool; + + + private static function __init__ ():Void { + + #if (cpp || neko || nodejs) + available = true; + enabled = #if disable_cffi false; #else true; #end + #else + available = false; + enabled = false; + #end + + } + + + /** + * Tries to load a native CFFI primitive on compatible platforms + * @param library The name of the native library (such as "lime") + * @param method The exported primitive method name + * @param args The number of arguments + * @param lazy Whether to load the symbol immediately, or to allow lazy loading + * @return The loaded method + */ + public static function load (library:String, method:String, args:Int = 0, lazy:Bool = false):Dynamic { + + #if (disable_cffi || macro) + var enabled = false; + #end + + #if optional_cffi + if (library != "lime" || method != "neko_init") { + + lazy = true; + + } + #end + + if (!enabled) { + + return Reflect.makeVarArgs (function (__) return {}); + + } + + var result:Dynamic = null; + + #if (!disable_cffi && !macro) + #if (sys && !html5) + + if (__moduleNames == null) __moduleNames = new Map (); + + if (lazy) { + + __moduleNames.set (library, library); + + try { + + #if lime_legacy + if (library == "lime") return null; + #elseif !lime_hybrid + if (library == "lime-legacy") return null; + #end + + #if neko + result = neko.Lib.loadLazy (library, method, args); + #elseif cpp + result = cpp.Lib.loadLazy (library, method, args); + #end + + } catch (e:Dynamic) {} + + } else { + + #if (iphone || emscripten || android || static_link) + return cpp.Lib.load (library, method, args); + #end + + + if (__moduleNames.exists (library)) { + + #if cpp + return cpp.Lib.load (__moduleNames.get (library), method, args); + #elseif neko + return neko.Lib.load (__moduleNames.get (library), method, args); + #elseif nodejs + return untyped __nodeNDLLModule.load_lib (__moduleNames.get (library), method, args); + #else + return null; + #end + + } + + #if waxe + if (library == "lime") { + + flash.Lib.load ("waxe", "wx_boot", 1); + + } + #elseif nodejs + if (__nodeNDLLModule == null) { + + __nodeNDLLModule = untyped require('ndll'); + + } + #end + + __moduleNames.set (library, library); + + result = __tryLoad ("./" + library, library, method, args); + + if (result == null) { + + result = __tryLoad (".\\" + library, library, method, args); + + } + + if (result == null) { + + result = __tryLoad (library, library, method, args); + + } + + if (result == null) { + + var slash = (__sysName ().substr (7).toLowerCase () == "windows") ? "\\" : "/"; + var haxelib = __findHaxelib ("lime"); + + if (haxelib != "") { + + result = __tryLoad (haxelib + slash + "ndll" + slash + __sysName () + slash + library, library, method, args); + + if (result == null) { + + result = __tryLoad (haxelib + slash + "ndll" + slash + __sysName() + "64" + slash + library, library, method, args); + + } + + } + + } + + __loaderTrace ("Result : " + result); + + } + + #if neko + if (library == "lime" && method != "neko_init") { + + __loadNekoAPI (lazy); + + } + #end + + #end + #else + + result = function (_, _, _, _, _, _) { return { }; }; + + #end + + return result; + + } + + + #if ((haxe_ver >= 3.2) && !debug_cffi) + public static inline macro function loadPrime (library:String, method:String, signature:Expr, lazy:Bool = false) { + + var signatureString = ""; + var signatureType = Context.typeExpr (signature); + + switch (signatureType.t) { + + case TFun (args, result): + + for (arg in args) { + + switch (TypeTools.toString (arg.t)) { + + case "Int", "Int16", "Int32": signatureString += "i"; + case "Bool": signatureString += "b"; + case "Float32": signatureString += "f"; + case "Float", "Float64": signatureString += "d"; + case "String": signatureString += "s"; + case "ConstCharStar": signatureString += "c"; + case "Void": if (signatureString.length > 0) signatureString += "v"; + default: signatureString += "o"; + + } + + } + + switch (TypeTools.toString (result)) { + + case "Int", "Int16", "Int32": signatureString += "i"; + case "Bool": signatureString += "b"; + case "Float32": signatureString += "f"; + case "Float", "Float64": signatureString += "d"; + case "String": signatureString += "s"; + case "ConstCharStar": signatureString += "c"; + case "Void": signatureString += "v"; + default: signatureString += "o"; + + } + + case TInst (_.get () => { pack: [], name: "String" }, _): + + signatureString = ExprTools.getValue (signature); + + case TAbstract (_.get () => { pack: [], name: "Int" }, _): + + var typeString = "Dynamic"; + var args:Int = ExprTools.getValue (signature); + + for (i in 0...args) { + + typeString += "->Dynamic"; + + } + + return Context.parse ('new cpp.Callable<$typeString> (lime.system.CFFI.load ("$library", "$method", $args, $lazy))', Context.currentPos ()); + + default: + + } + + if (signatureString == null || signatureString == "") { + + throw "Invalid function signature"; + + } + + var parts = signatureString.split (""); + + var cppMode = Context.defined ("cpp"); + var typeString, expr; + + if (parts.length == 1) { + + typeString = "Void"; + + } else { + + typeString = __codeToType (parts.shift (), cppMode); + + } + + for (part in parts) { + + typeString += "->" + __codeToType (part, cppMode); + + } + + if (cppMode) { + + typeString = "cpp.Callable<" + typeString + ">"; + expr = 'new $typeString (cpp.Prime._loadPrime ("$library", "$method", "$signatureString", $lazy))'; + + } else { + + var args = signatureString.length - 1; + + if (args > 5) { + + args = -1; + + } + + expr = 'new cpp.Callable<$typeString> (lime.system.CFFI.load ("$library", "$method", $args, $lazy))'; + + } + + return Context.parse (expr, Context.currentPos ()); + + } + #else + public static function loadPrime (library:String, method:String, signature:String):Dynamic { + + var args = signature.length - 1; + + if (args > 5) { + + args = -1; + + } + + // TODO: Need a macro function for debug to work on C++ + + #if (!debug_cffi || cpp) + + return { call: CFFI.load (library, method, args) }; + + #else + + var handle = CFFI.load (library, method, args); + return { call: Reflect.makeVarArgs (function (args) { + + #if neko + Sys.println ('$library@$method'); + #if debug_cffi_args + Sys.println (args); + #end + #else + trace ('$library@$method'); + #if debug_cffi_args + trace (args); + #end + #end + + return Reflect.callMethod (handle, handle, args); + + }) }; + + #end + + } + #end + + + private static function __findHaxelib (library:String):String { + + #if (sys && !html5) + + try { + + var proc = new Process ("haxelib", [ "path", library ]); + + if (proc != null) { + + var stream = proc.stdout; + + try { + + while (true) { + + var s = stream.readLine (); + + if (s.substr (0, 1) != "-") { + + stream.close (); + proc.close (); + __loaderTrace ("Found haxelib " + s); + return s; + + } + + } + + } catch(e:Dynamic) { } + + stream.close (); + proc.close (); + + } + + } catch (e:Dynamic) { } + + #end + + return ""; + + } + + + private static function __loaderTrace (message:String) { + + #if (sys && !html5) + #if cpp + var get_env = cpp.Lib.load ("std", "get_env", 1); + var debug = (get_env ("OPENFL_LOAD_DEBUG") != null); + #else + var debug = (Sys.getEnv ("OPENFL_LOAD_DEBUG") !=null); + #end + + if (debug) { + + Sys.println (message); + + } + #end + + } + + + #if neko + private static function __loadNekoAPI (lazy:Bool):Void { + + if (!__loadedNekoAPI) { + + try { + + var init = load ("lime", "neko_init", 5); + + if (init != null) { + + __loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime")); + init (function(s) return new String (s), function (len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false); + + } else if (!lazy) { + + throw ("Could not find NekoAPI interface."); + + } + + #if lime_hybrid + var init = load ("lime-legacy", "neko_init", 5); + + if (init != null) { + + __loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime-legacy")); + init (function(s) return new String (s), function (len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false); + + } else if (!lazy) { + + throw ("Could not find NekoAPI interface."); + + } + #end + + } catch (e:Dynamic) { + + if (!lazy) { + + throw ("Could not find NekoAPI interface."); + + } + + } + + __loadedNekoAPI = true; + + } + + } + #end + + + private static function __sysName ():String { + + #if (sys && !html5) + #if cpp + var sys_string = cpp.Lib.load ("std", "sys_string", 0); + return sys_string (); + #else + return Sys.systemName (); + #end + #else + return null; + #end + + } + + + private static function __tryLoad (name:String, library:String, func:String, args:Int):Dynamic { + + #if sys + + try { + + #if cpp + var result = cpp.Lib.load (name, func, args); + #elseif (neko) + var result = neko.Lib.load (name, func, args); + #elseif nodejs + var result = untyped __nodeNDLLModule.load_lib (name, func, args); + #else + var result = null; + #end + + if (result != null) { + + __loaderTrace ("Got result " + name); + __moduleNames.set (library, name); + return result; + + } + + } catch (e:Dynamic) { + + __loaderTrace ("Failed to load : " + name); + + } + + #end + + return null; + + } + + +} + + +#else + -#if macro import haxe.macro.Context; import haxe.macro.Expr; import haxe.macro.Type; + using haxe.macro.ComplexTypeTools; +using haxe.macro.ExprTools; using haxe.macro.Tools; -#end - -#if !macro -@:genericBuild(lime.system.CFFI.buildInstance()) -#end +using haxe.macro.TypeTools; -@:dce class CFFI { +class CFFI { - #if macro public static function build (defaultLibrary:String = "lime"):Array { var pos = Context.currentPos (); @@ -68,12 +575,32 @@ using haxe.macro.Tools; } - var type = getFunctionType (typeArgs, fun.ret.toType ()); - var typeString = type.string; + var type = __getFunctionType (typeArgs, fun.ret.toType ()); + + var typeString = type.string; + var typeSignature = type.signature; + var cffiExpr; + + if (Context.defined ("cpp")) { + + cffiExpr = 'new cpp.Callable<$typeString> (cpp.Prime._loadPrime ("$library", "$method", "$typeSignature", $lazy))'; + + } else { + + var args = typeSignature.length - 1; + + if (args > 5) { + + args = -1; + + } + + cffiExpr = 'new cpp.Callable<$typeString> (lime.system.CFFI.load ("$library", "$method", $args, $lazy))'; + + } - var cffiExpr = 'new lime.system.CFFI<$typeString> ("$library", "$method", $lazy)'; var cffiName = "cffi_" + field.name; - var cffiType = TPath ( { pack: [ "lime", "system" ], name: "CFFI", params: [ TPType (TFun (type.args, type.result).toComplexType ()) ] } ); + var cffiType = TPath ( { pack: [ "cpp" ], name: "Callable", params: [ TPType (TFun (type.args, type.result).toComplexType ()) ] } ); newFields.push ( { name: cffiName, access: [ APrivate, AStatic ], kind: FieldType.FVar (cffiType, Context.parse (cffiExpr, pos)), pos: pos } ); @@ -115,91 +642,30 @@ using haxe.macro.Tools; } - private static function buildInstance ():ComplexType { + private static function __codeToType (code:String, forCpp:Bool):String { - var typeArgs = []; - var typeResult = null; - var typeString; - var typeSignature = ""; - - switch (Context.getLocalType ()) { + switch (code) { - case TInst (_, [ TFun (args, result) ]): - - var type = getFunctionType (args, result); - typeArgs = type.args; - typeResult = type.result; - typeString = type.string; - typeSignature = type.signature; - + case "b" : return "Bool"; + case "i" : return "Int"; + case "d" : return "Float"; + case "s" : return "String"; + case "f" : return forCpp ? "cpp.Float32" : "Float"; + case "o" : return forCpp ? "cpp.Object" : "Dynamic"; + case "v" : return forCpp ? "cpp.Void" : "Void"; + case "c" : + if (forCpp) + return "cpp.ConstCharStar"; + throw "const char * type only supported in cpp mode"; default: - - throw false; + throw "Unknown signature type :" + code; } - var typeParam = TFun (typeArgs, typeResult); - - var pos = Context.currentPos (); - var name = "CFFI$" + StringTools.replace (typeString, ".", "_"); - - try { - - Context.getType ("lime.system." + name); - - } catch (e:Dynamic) { - - var constructor:String; - - if (Context.defined ("cpp")) { - - constructor = 'this = new cpp.Callable<$typeString> (cpp.Prime._loadPrime (library, method, "$typeSignature", lazy))'; - - } else { - - var args = typeSignature.length - 1; - - if (args > 5) { - - args = -1; - - } - - constructor = 'this = new cpp.Callable<$typeString> (lime.system.System.load (library, method, $args, lazy))'; - - } - - var constructor = { - pos: pos, - name: "new", - kind: FFun ({ - args: [ { name: "library", opt: false, type: macro :String }, { name: "method", opt: false, type: macro :String }, { name: "lazy", opt: true, value: macro false, type: macro :Bool } ], - ret: null, - expr: Context.parse (constructor, pos) - }), - access: [ APublic, AInline ] - }; - - var callable = TPath ( { pack: [ "cpp" ], name: "Callable", params: [ TPType (typeParam.toComplexType ()) ] } ); - - Context.defineType ({ - pos: pos, - pack: [ "lime", "system" ], - name: name, - kind: TDAbstract (callable, null, [ callable ]), - fields: [ constructor ], - params: [ { name: "T" } ], - meta: [ { name: ":dce", pos: pos }, { name: ":forward", pos: pos } ] - }); - - } - - return TPath ( { pack: [ "lime", "system" ], name: name, params: [ TPType (typeParam.toComplexType ()) ] } ); - } - private static function getFunctionType (args:Array<{ name : String, opt : Bool, t : Type }>, result:Type) { + private static function __getFunctionType (args:Array<{ name : String, opt : Bool, t : Type }>, result:Type) { var isCPP = Context.defined ("cpp"); @@ -378,7 +844,9 @@ using haxe.macro.Tools; return { args: typeArgs, result: typeResult, string: typeString, signature: typeSignature, }; } - #end -} \ No newline at end of file +} + + +#end \ No newline at end of file diff --git a/lime/system/Clipboard.hx b/lime/system/Clipboard.hx index 4ead0e2a6..d3419d7e8 100644 --- a/lime/system/Clipboard.hx +++ b/lime/system/Clipboard.hx @@ -5,6 +5,10 @@ package lime.system; import flash.desktop.Clipboard in FlashClipboard; #end +#if !macro +@:build(lime.system.CFFI.build()) +#end + class Clipboard { @@ -22,7 +26,7 @@ class Clipboard { private static function get_text ():String { #if (cpp || neko || nodejs) - return lime_clipboard_get_text.call (); + return lime_clipboard_get_text (); #elseif flash if (FlashClipboard.generalClipboard.hasFormat (TEXT_FORMAT)) { @@ -39,7 +43,7 @@ class Clipboard { private static function set_text (value:String):String { #if (cpp || neko || nodejs) - lime_clipboard_set_text.call (value); + lime_clipboard_set_text (value); return value; #elseif flash FlashClipboard.generalClipboard.setData (TEXT_FORMAT, value); @@ -59,8 +63,8 @@ class Clipboard { #if (cpp || neko || nodejs) - private static var lime_clipboard_get_text = System.loadPrime ("lime", "lime_clipboard_get_text", "s"); - private static var lime_clipboard_set_text = System.loadPrime ("lime", "lime_clipboard_set_text", "sv"); + @:cffi private static function lime_clipboard_get_text ():String; + @:cffi private static function lime_clipboard_set_text (text:String):Void; #end diff --git a/lime/system/System.hx b/lime/system/System.hx index d1676b6ac..41b46cf37 100644 --- a/lime/system/System.hx +++ b/lime/system/System.hx @@ -1,17 +1,8 @@ package lime.system; -import lime.math.Rectangle; - -#if !macro import lime.app.Application; -#else -import haxe.macro.Context; -import haxe.macro.Expr; -import haxe.macro.ExprTools; -import haxe.macro.TypeTools; -import cpp.Prime; -#end +import lime.math.Rectangle; #if flash import flash.system.Capabilities; @@ -31,6 +22,10 @@ import js.Browser; import sys.io.Process; #end +#if !macro +@:build(lime.system.CFFI.build()) +#end + @:access(lime.system.Display) @:access(lime.system.DisplayMode) @@ -49,15 +44,6 @@ class System { public static var userDirectory (get, null):String; - @:noCompletion private static var __moduleNames:Map = null; - - #if neko - private static var __loadedNekoAPI:Bool; - #elseif nodejs - private static var __nodeNDLLModule:Dynamic; - #end - - #if (js && html5) @:keep @:expose("lime.embed") public static function embed (element:Dynamic, width:Null = null, height:Null = null, background:String = null, assetsPrefix:String = null) { @@ -124,7 +110,6 @@ class System { public static function exit (code:Int):Void { #if sys - #if !macro if (Application.current != null) { // TODO: Clean exit? @@ -132,63 +117,16 @@ class System { Application.current.onExit.dispatch (code); } - #end Sys.exit (code); #end } - static private function findHaxeLib (library:String):String { - - #if (sys && !html5) - - try { - - var proc = new Process ("haxelib", [ "path", library ]); - - if (proc != null) { - - var stream = proc.stdout; - - try { - - while (true) { - - var s = stream.readLine (); - - if (s.substr (0, 1) != "-") { - - stream.close (); - proc.close (); - loaderTrace ("Found haxelib " + s); - return s; - - } - - } - - } catch(e:Dynamic) { } - - stream.close (); - proc.close (); - - } - - } catch (e:Dynamic) { } - - #end - - return ""; - - } - - public static function getDisplay (id:Int):Display { - #if !macro #if (cpp || neko || nodejs) - var displayInfo:Dynamic = lime_system_get_display.call (id); + var displayInfo:Dynamic = lime_system_get_display (id); if (displayInfo != null) { @@ -230,7 +168,6 @@ class System { } #end - #end return null; @@ -243,8 +180,8 @@ class System { return flash.Lib.getTimer (); #elseif js return cast Date.now ().getTime (); - #elseif (!disable_cffi && !macro) - return cast lime_system_get_timer.call (); + #elseif !disable_cffi + return cast lime_system_get_timer (); #elseif cpp return Std.int (untyped __global__.__time_stamp () * 1000); #elseif sys @@ -256,476 +193,13 @@ class System { } - /** - * Tries to load a native CFFI primitive on compatible platforms - * @param library The name of the native library (such as "lime") - * @param method The exported primitive method name - * @param args The number of arguments - * @param lazy Whether to load the symbol immediately, or to allow lazy loading - * @return The loaded method - */ - public static function load (library:String, method:String, args:Int = 0, lazy:Bool = false):Dynamic { + public static inline function load (library:String, method:String, args:Int = 0, lazy:Bool = false):Dynamic { - #if (disable_cffi || macro) - var disableCFFI = true; - #end - - #if optional_cffi - if (library != "lime" || method != "neko_init") { - - lazy = true; - - } - #end - - if (disableCFFI) { - - return Reflect.makeVarArgs (function (__) return {}); - - } - - var result:Dynamic = null; - - #if (!disable_cffi && !macro) - #if (sys && !html5) - - if (__moduleNames == null) __moduleNames = new Map (); - - if (lazy) { - - __moduleNames.set (library, library); - - try { - - #if lime_legacy - if (library == "lime") return null; - #elseif !lime_hybrid - if (library == "lime-legacy") return null; - #end - - #if neko - result = neko.Lib.loadLazy (library, method, args); - #elseif cpp - result = cpp.Lib.loadLazy (library, method, args); - #end - - } catch (e:Dynamic) {} - - } else { - - #if (iphone || emscripten || android || static_link) - return cpp.Lib.load (library, method, args); - #end - - - if (__moduleNames.exists (library)) { - - #if cpp - return cpp.Lib.load (__moduleNames.get (library), method, args); - #elseif neko - return neko.Lib.load (__moduleNames.get (library), method, args); - #elseif nodejs - return untyped __nodeNDLLModule.load_lib (__moduleNames.get (library), method, args); - #else - return null; - #end - - } - - #if waxe - if (library == "lime") { - - flash.Lib.load ("waxe", "wx_boot", 1); - - } - #elseif nodejs - if (__nodeNDLLModule == null) { - - __nodeNDLLModule = untyped require('ndll'); - - } - #end - - __moduleNames.set (library, library); - - result = tryLoad ("./" + library, library, method, args); - - if (result == null) { - - result = tryLoad (".\\" + library, library, method, args); - - } - - if (result == null) { - - result = tryLoad (library, library, method, args); - - } - - if (result == null) { - - var slash = (sysName ().substr (7).toLowerCase () == "windows") ? "\\" : "/"; - var haxelib = findHaxeLib ("lime"); - - if (haxelib != "") { - - result = tryLoad (haxelib + slash + "ndll" + slash + sysName () + slash + library, library, method, args); - - if (result == null) { - - result = tryLoad (haxelib + slash + "ndll" + slash + sysName() + "64" + slash + library, library, method, args); - - } - - } - - } - - loaderTrace ("Result : " + result); - - } - - #if neko - if (library == "lime" && method != "neko_init") { - - loadNekoAPI (lazy); - - } - #end - - #end - #else - - result = function (_, _, _, _, _, _) { return { }; }; - - #end - - return result; + return CFFI.load (library, method, args, lazy); } - #if macro - private static function __codeToType (code:String, forCpp:Bool):String { - - switch (code) { - - case "b" : return "Bool"; - case "i" : return "Int"; - case "d" : return "Float"; - case "s" : return "String"; - case "f" : return forCpp ? "cpp.Float32" : "Float"; - case "o" : return forCpp ? "cpp.Object" : "Dynamic"; - case "v" : return forCpp ? "cpp.Void" : "Void"; - case "c" : - if (forCpp) - return "cpp.ConstCharStar"; - throw "const char * type only supported in cpp mode"; - default: - throw "Unknown signature type :" + code; - - } - - } - #end - - - #if ((haxe_ver >= 3.2) && !debug_cffi) - public static inline macro function loadPrime (library:String, method:String, signature:Expr, lazy:Bool = false) { - - var signatureString = ""; - var signatureType = Context.typeExpr (signature); - - switch (signatureType.t) { - - case TFun (args, result): - - for (arg in args) { - - switch (TypeTools.toString (arg.t)) { - - case "Int", "Int16", "Int32": signatureString += "i"; - case "Bool": signatureString += "b"; - case "Float32": signatureString += "f"; - case "Float", "Float64": signatureString += "d"; - case "String": signatureString += "s"; - case "ConstCharStar": signatureString += "c"; - case "Void": if (signatureString.length > 0) signatureString += "v"; - default: signatureString += "o"; - - } - - } - - switch (TypeTools.toString (result)) { - - case "Int", "Int16", "Int32": signatureString += "i"; - case "Bool": signatureString += "b"; - case "Float32": signatureString += "f"; - case "Float", "Float64": signatureString += "d"; - case "String": signatureString += "s"; - case "ConstCharStar": signatureString += "c"; - case "Void": signatureString += "v"; - default: signatureString += "o"; - - } - - case TInst (_.get () => { pack: [], name: "String" }, _): - - signatureString = ExprTools.getValue (signature); - - case TAbstract (_.get () => { pack: [], name: "Int" }, _): - - var typeString = "Dynamic"; - var args:Int = ExprTools.getValue (signature); - - for (i in 0...args) { - - typeString += "->Dynamic"; - - } - - return Context.parse ('new cpp.Callable<$typeString> (System.load ("$library", "$method", $args, $lazy))', Context.currentPos ()); - - default: - - } - - if (signatureString == null || signatureString == "") { - - throw "Invalid function signature"; - - } - - var parts = signatureString.split (""); - - var cppMode = Context.defined ("cpp"); - var typeString, expr; - - if (parts.length == 1) { - - typeString = "Void"; - - } else { - - typeString = __codeToType (parts.shift (), cppMode); - - } - - for (part in parts) { - - typeString += "->" + __codeToType (part, cppMode); - - } - - if (cppMode) { - - typeString = "cpp.Callable<" + typeString + ">"; - expr = 'new $typeString (cpp.Prime._loadPrime ("$library", "$method", "$signatureString", $lazy))'; - - } else { - - var args = signatureString.length - 1; - - if (args > 5) { - - args = -1; - - } - - expr = 'new cpp.Callable<$typeString> (System.load ("$library", "$method", $args, $lazy))'; - - } - - return Context.parse (expr, Context.currentPos ()); - - } - #else - public static function loadPrime (library:String, method:String, signature:String):Dynamic { - - var args = signature.length - 1; - - if (args > 5) { - - args = -1; - - } - - // TODO: Need a macro function for debug to work on C++ - - #if (!debug_cffi || cpp) - - return { call: System.load (library, method, args) }; - - #else - - var handle = System.load (library, method, args); - return { call: Reflect.makeVarArgs (function (args) { - - #if neko - Sys.println ('$library@$method'); - #if debug_cffi_args - Sys.println (args); - #end - #else - trace ('$library@$method'); - #if debug_cffi_args - trace (args); - #end - #end - - return Reflect.callMethod (handle, handle, args); - - }) }; - - #end - - } - #end - - - private static function sysName ():String { - - #if (sys && !html5) - - #if cpp - - var sys_string = cpp.Lib.load ("std", "sys_string", 0); - return sys_string (); - - #else - - return Sys.systemName (); - - #end - - #else - - return null; - - #end - - } - - - private static function tryLoad (name:String, library:String, func:String, args:Int):Dynamic { - - #if sys - - try { - - #if cpp - var result = cpp.Lib.load (name, func, args); - #elseif (neko) - var result = neko.Lib.load (name, func, args); - #elseif nodejs - var result = untyped __nodeNDLLModule.load_lib (name, func, args); - #else - var result = null; - #end - - if (result != null) { - - loaderTrace ("Got result " + name); - __moduleNames.set (library, name); - return result; - - } - - } catch (e:Dynamic) { - - loaderTrace ("Failed to load : " + name); - - } - - #end - - return null; - - } - - - private static function loaderTrace (message:String) { - - #if (sys && !html5) - - #if cpp - - var get_env = cpp.Lib.load ("std", "get_env", 1); - var debug = (get_env ("OPENFL_LOAD_DEBUG") != null); - - #else - - var debug = (Sys.getEnv ("OPENFL_LOAD_DEBUG") !=null); - - #end - - if (debug) { - - Sys.println (message); - - } - - #end - - } - - - #if neko - - private static function loadNekoAPI (lazy:Bool):Void { - - if (!__loadedNekoAPI) { - - try { - - var init = load ("lime", "neko_init", 5); - - if (init != null) { - - loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime")); - init (function(s) return new String (s), function (len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false); - - } else if (!lazy) { - - throw ("Could not find NekoAPI interface."); - - } - - #if lime_hybrid - var init = load ("lime-legacy", "neko_init", 5); - - if (init != null) { - - loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime-legacy")); - init (function(s) return new String (s), function (len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false); - - } else if (!lazy) { - - throw ("Could not find NekoAPI interface."); - - } - #end - - } catch (e:Dynamic) { - - if (!lazy) { - - throw ("Could not find NekoAPI interface."); - - } - - } - - __loadedNekoAPI = true; - - } - - } - - #end - - // Get & Set Methods @@ -735,8 +209,8 @@ class System { private static function get_applicationDirectory ():String { - #if ((cpp || neko || nodejs) && !macro) - return lime_system_get_directory.call (SystemDirectory.APPLICATION, null, null); + #if (cpp || neko || nodejs) + return lime_system_get_directory (SystemDirectory.APPLICATION, null, null); #elseif flash if (Capabilities.playerType == "Desktop") { @@ -759,7 +233,6 @@ class System { var company = "MyCompany"; var file = "MyApplication"; - #if !macro if (Application.current != null && Application.current.config != null) { if (Application.current.config.company != null) { @@ -775,10 +248,9 @@ class System { } } - #end - #if ((cpp || neko || nodejs) && !macro) - return lime_system_get_directory.call (SystemDirectory.APPLICATION_STORAGE, company, file); + #if (cpp || neko || nodejs) + return lime_system_get_directory (SystemDirectory.APPLICATION_STORAGE, company, file); #elseif flash if (Capabilities.playerType == "Desktop") { @@ -798,8 +270,8 @@ class System { private static function get_desktopDirectory ():String { - #if ((cpp || neko || nodejs) && !macro) - return lime_system_get_directory.call (SystemDirectory.DESKTOP, null, null); + #if (cpp || neko || nodejs) + return lime_system_get_directory (SystemDirectory.DESKTOP, null, null); #elseif flash if (Capabilities.playerType == "Desktop") { @@ -819,8 +291,8 @@ class System { private static function get_documentsDirectory ():String { - #if ((cpp || neko || nodejs) && !macro) - return lime_system_get_directory.call (SystemDirectory.DOCUMENTS, null, null); + #if (cpp || neko || nodejs) + return lime_system_get_directory (SystemDirectory.DOCUMENTS, null, null); #elseif flash if (Capabilities.playerType == "Desktop") { @@ -840,8 +312,8 @@ class System { private static function get_fontsDirectory ():String { - #if ((cpp || neko || nodejs) && !macro) - return lime_system_get_directory.call (SystemDirectory.FONTS, null, null); + #if (cpp || neko || nodejs) + return lime_system_get_directory (SystemDirectory.FONTS, null, null); #else return null; #end @@ -851,8 +323,8 @@ class System { private static function get_numDisplays ():Int { - #if ((cpp || neko || nodejs) && !macro) - return lime_system_get_num_displays.call (); + #if (cpp || neko || nodejs) + return lime_system_get_num_displays (); #else return 1; #end @@ -862,8 +334,8 @@ class System { private static function get_userDirectory ():String { - #if ((cpp || neko || nodejs) && !macro) - return lime_system_get_directory.call (SystemDirectory.USER, null, null); + #if (cpp || neko || nodejs) + return lime_system_get_directory (SystemDirectory.USER, null, null); #elseif flash if (Capabilities.playerType == "Desktop") { @@ -901,11 +373,11 @@ class System { - #if ((cpp || neko || nodejs) && !macro) - private static var lime_system_get_directory = new CFFIString->String->String> ("lime", "lime_system_get_directory"); - private static var lime_system_get_display = new CFFIDynamic> ("lime", "lime_system_get_display"); - private static var lime_system_get_num_displays = new CFFIInt> ("lime", "lime_system_get_num_displays"); - private static var lime_system_get_timer = new CFFIFloat> ("lime", "lime_system_get_timer"); + #if (cpp || neko || nodejs) + @:cffi private static function lime_system_get_directory (type:Int, company:String, title:String):String; + @:cffi private static function lime_system_get_display (index:Int):Dynamic; + @:cffi private static function lime_system_get_num_displays ():Int; + @:cffi private static function lime_system_get_timer ():Float; #end diff --git a/lime/text/Font.hx b/lime/text/Font.hx index f466e0cf5..72288dc16 100644 --- a/lime/text/Font.hx +++ b/lime/text/Font.hx @@ -4,21 +4,25 @@ package lime.text; import lime.graphics.Image; import lime.graphics.ImageBuffer; import lime.math.Vector2; +import lime.system.System; import lime.utils.ByteArray; import lime.utils.UInt8Array; -import lime.system.System; #if (js && html5) import js.html.CanvasElement; import js.html.CanvasRenderingContext2D; #end -@:access(lime.text.Glyph) +#if !macro +@:build(lime.system.CFFI.build()) +#end #if (!display && !nodejs) @:autoBuild(lime.Assets.embedFont()) #end +@:access(lime.text.Glyph) + class Font { @@ -58,7 +62,7 @@ class Font { #if (cpp || neko || nodejs) if (src == null) throw "Uninitialized font handle."; - var data:Dynamic = lime_font_outline_decompose.call (src, 1024 * 20); + var data:Dynamic = lime_font_outline_decompose (src, 1024 * 20); return data; #else @@ -101,7 +105,7 @@ class Font { public function getGlyph (character:String):Glyph { #if (cpp || neko || nodejs) - return lime_font_get_glyph_index.call (src, character); + return lime_font_get_glyph_index (src, character); #else return -1; #end @@ -112,7 +116,7 @@ class Font { public function getGlyphs (characters:String = #if (display && haxe_ver < "3.2") "" #else "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^`'\"/\\&*()[]{}<>|:;_-+=?,. " #end):Array { #if (cpp || neko || nodejs) - var glyphs:Dynamic = lime_font_get_glyph_indices.call (src, characters); + var glyphs:Dynamic = lime_font_get_glyph_indices (src, characters); return glyphs; #else return null; @@ -124,7 +128,7 @@ class Font { public function getGlyphMetrics (glyph:Glyph):GlyphMetrics { #if (cpp || neko || nodejs) - var value:Dynamic = lime_font_get_glyph_metrics.call (src, glyph); + var value:Dynamic = lime_font_get_glyph_metrics (src, glyph); var metrics = new GlyphMetrics (); metrics.advance = new Vector2 (value.horizontalAdvance, value.verticalAdvance); @@ -144,12 +148,12 @@ class Font { #if (cpp || neko || nodejs) - lime_font_set_size.call (src, fontSize); + lime_font_set_size (src, fontSize); var bytes = new ByteArray (); bytes.endian = (System.endianness == BIG_ENDIAN ? "bigEndian" : "littleEndian"); - if (lime_font_render_glyph.call (src, glyph, bytes)) { + if (lime_font_render_glyph (src, glyph, bytes)) { bytes.position = 0; @@ -202,12 +206,12 @@ class Font { } - lime_font_set_size.call (src, fontSize); + lime_font_set_size (src, fontSize); var bytes = new ByteArray (); bytes.endian = (System.endianness == BIG_ENDIAN ? "bigEndian" : "littleEndian"); - if (lime_font_render_glyphs.call (src, glyphList, bytes)) { + if (lime_font_render_glyphs (src, glyphList, bytes)) { bytes.position = 0; @@ -352,12 +356,11 @@ class Font { #if (cpp || neko || nodejs) - //src = lime_font_load.call (bytes); src = lime_font_load (bytes); if (src != null && name == null) { - name = cast lime_font_get_family_name.call (src); + name = cast lime_font_get_family_name (src); } @@ -372,12 +375,11 @@ class Font { #if (cpp || neko || nodejs) - //src = lime_font_load.call (__fontPath); src = lime_font_load (__fontPath); if (src != null && name == null) { - name = cast lime_font_get_family_name.call (src); + name = cast lime_font_get_family_name (src); } @@ -396,7 +398,7 @@ class Font { private function get_ascender ():Int { #if (cpp || neko || nodejs) - return lime_font_get_ascender.call (src); + return lime_font_get_ascender (src); #else return 0; #end @@ -407,7 +409,7 @@ class Font { private function get_descender ():Int { #if (cpp || neko || nodejs) - return lime_font_get_descender.call (src); + return lime_font_get_descender (src); #else return 0; #end @@ -418,7 +420,7 @@ class Font { private function get_height ():Int { #if (cpp || neko || nodejs) - return lime_font_get_height.call (src); + return lime_font_get_height (src); #else return 0; #end @@ -429,7 +431,7 @@ class Font { private function get_numGlyphs ():Int { #if (cpp || neko || nodejs) - return lime_font_get_num_glyphs.call (src); + return lime_font_get_num_glyphs (src); #else return 0; #end @@ -440,7 +442,7 @@ class Font { private function get_underlinePosition ():Int { #if (cpp || neko || nodejs) - return lime_font_get_underline_position.call (src); + return lime_font_get_underline_position (src); #else return 0; #end @@ -451,7 +453,7 @@ class Font { private function get_underlineThickness ():Int { #if (cpp || neko || nodejs) - return lime_font_get_underline_thickness.call (src); + return lime_font_get_underline_thickness (src); #else return 0; #end @@ -462,7 +464,7 @@ class Font { private function get_unitsPerEM ():Int { #if (cpp || neko || nodejs) - return lime_font_get_units_per_em.call (src); + return lime_font_get_units_per_em (src); #else return 0; #end @@ -478,23 +480,22 @@ class Font { #if (cpp || neko || nodejs) - private static var lime_font_get_ascender = System.loadPrime ("lime", "lime_font_get_ascender", "di"); - private static var lime_font_get_descender = System.loadPrime ("lime", "lime_font_get_descender", "di"); - private static var lime_font_get_family_name = System.loadPrime ("lime", "lime_font_get_family_name", "do"); - private static var lime_font_get_glyph_index = System.loadPrime ("lime", "lime_font_get_glyph_index", "dsi"); - private static var lime_font_get_glyph_indices = System.loadPrime ("lime", "lime_font_get_glyph_indices", "dso"); - private static var lime_font_get_glyph_metrics = System.loadPrime ("lime", "lime_font_get_glyph_metrics", "dio"); - private static var lime_font_get_height = System.loadPrime ("lime", "lime_font_get_height", "di"); - private static var lime_font_get_num_glyphs = System.loadPrime ("lime", "lime_font_get_num_glyphs", "di"); - private static var lime_font_get_underline_position = System.loadPrime ("lime", "lime_font_get_underline_position", "di"); - private static var lime_font_get_underline_thickness = System.loadPrime ("lime", "lime_font_get_underline_thickness", "di"); - private static var lime_font_get_units_per_em = System.loadPrime ("lime", "lime_font_get_units_per_em", "di"); - //private static var lime_font_load:Dynamic = System.loadPrime ("lime", "lime_font_load", "oo"); - private static var lime_font_load:Dynamic = System.load ("lime", "lime_font_load", 1); - private static var lime_font_outline_decompose = System.loadPrime ("lime", "lime_font_outline_decompose", "dio"); - private static var lime_font_render_glyph = System.loadPrime ("lime", "lime_font_render_glyph", "diob"); - private static var lime_font_render_glyphs = System.loadPrime ("lime", "lime_font_render_glyphs", "doob"); - private static var lime_font_set_size = System.loadPrime ("lime", "lime_font_set_size", "div"); + @:cffi private static function lime_font_get_ascender (handle:Float):Int; + @:cffi private static function lime_font_get_descender (handle:Float):Int; + @:cffi private static function lime_font_get_family_name (handle:Float):Dynamic; + @:cffi private static function lime_font_get_glyph_index (handle:Float, character:String):Int; + @:cffi private static function lime_font_get_glyph_indices (handle:Float, characters:String):Dynamic; + @:cffi private static function lime_font_get_glyph_metrics (handle:Float, index:Int):Dynamic; + @:cffi private static function lime_font_get_height (handle:Float):Int; + @:cffi private static function lime_font_get_num_glyphs (handle:Float):Int; + @:cffi private static function lime_font_get_underline_position (handle:Float):Int; + @:cffi private static function lime_font_get_underline_thickness (handle:Float):Int; + @:cffi private static function lime_font_get_units_per_em (handle:Float):Int; + @:cffi private static function lime_font_load (data:Dynamic):Dynamic; + @:cffi private static function lime_font_outline_decompose (handle:Float, size:Int):Dynamic; + @:cffi private static function lime_font_render_glyph (handle:Float, index:Int, data:Dynamic):Bool; + @:cffi private static function lime_font_render_glyphs (handle:Float, indices:Dynamic, data:Dynamic):Bool; + @:cffi private static function lime_font_set_size (handle:Float, size:Int):Void; #end diff --git a/lime/text/TextLayout.hx b/lime/text/TextLayout.hx index a5122678c..78a57fde4 100644 --- a/lime/text/TextLayout.hx +++ b/lime/text/TextLayout.hx @@ -5,6 +5,10 @@ import lime.math.Vector2; import lime.system.System; import lime.utils.ByteArray; +#if !macro +@:build(lime.system.CFFI.build()) +#end + @:access(lime.text.Font) @@ -42,7 +46,7 @@ class TextLayout { __dirty = true; #if (cpp || neko || nodejs) - __handle = lime_text_layout_create.call (__direction, __script, __language); + __handle = lime_text_layout_create (__direction, __script, __language); #end } @@ -62,7 +66,7 @@ class TextLayout { } - var data = lime_text_layout_position.call (__handle, font.src, size, text, __buffer); + var data = lime_text_layout_position (__handle, font.src, size, text, __buffer); if (__buffer.length > 4) { @@ -126,7 +130,7 @@ class TextLayout { __direction = value; #if (cpp || neko || nodejs) - lime_text_layout_set_direction.call (__handle, value); + lime_text_layout_set_direction (__handle, value); #end __dirty = true; @@ -176,7 +180,7 @@ class TextLayout { __language = value; #if (cpp || neko || nodejs) - lime_text_layout_set_language.call (__handle, value); + lime_text_layout_set_language (__handle, value); #end __dirty = true; @@ -200,7 +204,7 @@ class TextLayout { __script = value; #if (cpp || neko || nodejs) - lime_text_layout_set_script.call (__handle, value); + lime_text_layout_set_script (__handle, value); #end __dirty = true; @@ -240,11 +244,11 @@ class TextLayout { #if (cpp || neko || nodejs) - private static var lime_text_layout_create = System.loadPrime ("lime", "lime_text_layout_create", "isso"); - private static var lime_text_layout_position = System.loadPrime ("lime", "lime_text_layout_position", "ddisoo"); - private static var lime_text_layout_set_direction = System.loadPrime ("lime", "lime_text_layout_set_direction", "div"); - private static var lime_text_layout_set_language = System.loadPrime ("lime", "lime_text_layout_set_language", "dsv"); - private static var lime_text_layout_set_script = System.loadPrime ("lime", "lime_text_layout_set_script", "dsv"); + @:cffi private static function lime_text_layout_create (direction:Int, script:String, language:String):Dynamic; + @:cffi private static function lime_text_layout_position (textHandle:Float, fontHandle:Float, size:Int, textString:String, data:Dynamic):Dynamic; + @:cffi private static function lime_text_layout_set_direction (textHandle:Float, direction:Int):Void; + @:cffi private static function lime_text_layout_set_language (textHandle:Float, language:String):Void; + @:cffi private static function lime_text_layout_set_script (textHandle:Float, script:String):Void; #end diff --git a/lime/ui/FileDialog.hx b/lime/ui/FileDialog.hx index 992fd7969..7d6d0ee62 100644 --- a/lime/ui/FileDialog.hx +++ b/lime/ui/FileDialog.hx @@ -3,13 +3,16 @@ package lime.ui; import lime.app.Event; import lime.system.BackgroundWorker; -import lime.system.System; import lime.utils.Resource; #if sys import sys.io.File; #end +#if !macro +@:build(lime.system.CFFI.build()) +#end + class FileDialog { @@ -42,15 +45,15 @@ class FileDialog { case OPEN: - worker.sendComplete (lime_file_dialog_open_file.call (filter, defaultPath)); + worker.sendComplete (lime_file_dialog_open_file (filter, defaultPath)); case OPEN_MULTIPLE: - worker.sendComplete (lime_file_dialog_open_files.call (filter, defaultPath)); + worker.sendComplete (lime_file_dialog_open_files (filter, defaultPath)); case SAVE: - worker.sendComplete (lime_file_dialog_save_file.call (filter, defaultPath)); + worker.sendComplete (lime_file_dialog_save_file (filter, defaultPath)); } @@ -113,7 +116,7 @@ class FileDialog { worker.doWork.add (function (_) { - worker.sendComplete (lime_file_dialog_open_file.call (filter, defaultPath)); + worker.sendComplete (lime_file_dialog_open_file (filter, defaultPath)); }); @@ -156,7 +159,7 @@ class FileDialog { worker.doWork.add (function (_) { - worker.sendComplete (lime_file_dialog_save_file.call (filter, defaultPath)); + worker.sendComplete (lime_file_dialog_save_file (filter, defaultPath)); }); @@ -199,9 +202,9 @@ class FileDialog { #if (cpp || neko || nodejs) - private static var lime_file_dialog_open_file = System.loadPrime ("lime", "lime_file_dialog_open_file", "sss"); - private static var lime_file_dialog_open_files = System.loadPrime ("lime", "lime_file_dialog_open_files", "sso"); - private static var lime_file_dialog_save_file = System.loadPrime ("lime", "lime_file_dialog_save_file", "sss"); + @:cffi private static function lime_file_dialog_open_file (filter:String, defaultPath:String):String; + @:cffi private static function lime_file_dialog_open_files (filter:String, defaultPath:String):Dynamic; + @:cffi private static function lime_file_dialog_save_file (filter:String, defaultPath:String):String; #end diff --git a/lime/ui/Gamepad.hx b/lime/ui/Gamepad.hx index b1756e3b4..924f5eb87 100644 --- a/lime/ui/Gamepad.hx +++ b/lime/ui/Gamepad.hx @@ -2,7 +2,10 @@ package lime.ui; import lime.app.Event; -import lime.system.System; + +#if !macro +@:build(lime.system.CFFI.build()) +#end class Gamepad { @@ -32,7 +35,7 @@ class Gamepad { public static function addMappings (mappings:Array):Void { #if (cpp || neko || nodejs) - lime_gamepad_add_mappings.call (mappings); + lime_gamepad_add_mappings (mappings); #end } @@ -48,7 +51,7 @@ class Gamepad { @:noCompletion private inline function get_guid ():String { #if (cpp || neko || nodejs) - return lime_gamepad_get_device_guid.call (this.id); + return lime_gamepad_get_device_guid (this.id); #else return null; #end @@ -59,7 +62,7 @@ class Gamepad { @:noCompletion private inline function get_name ():String { #if (cpp || neko || nodejs) - return lime_gamepad_get_device_name.call (this.id); + return lime_gamepad_get_device_name (this.id); #else return null; #end @@ -75,9 +78,9 @@ class Gamepad { #if (cpp || neko || nodejs) - private static var lime_gamepad_add_mappings = System.loadPrime ("lime", "lime_gamepad_add_mappings", "ov"); - private static var lime_gamepad_get_device_guid = System.loadPrime ("lime", "lime_gamepad_get_device_guid", "is"); - private static var lime_gamepad_get_device_name = System.loadPrime ("lime", "lime_gamepad_get_device_name", "is"); + @:cffi private static function lime_gamepad_add_mappings (mappings:Dynamic):Void; + @:cffi private static function lime_gamepad_get_device_guid (id:Int):String; + @:cffi private static function lime_gamepad_get_device_name (id:Int):String; #end diff --git a/lime/utils/ByteArray.hx b/lime/utils/ByteArray.hx index 81edd61a6..564bff4dd 100644 --- a/lime/utils/ByteArray.hx +++ b/lime/utils/ByteArray.hx @@ -8,7 +8,6 @@ import haxe.io.Input; import haxe.zip.Compress; //import haxe.zip.Flush; import haxe.zip.Uncompress; -import lime.system.System; import lime.utils.ArrayBuffer; import lime.utils.CompressionAlgorithm; import lime.utils.IDataInput; @@ -29,6 +28,10 @@ import cpp.NativeArray; import sys.io.File; #end +#if !macro +@:build(lime.system.CFFI.build()) +#end + @:autoBuild(lime.Assets.embedFile()) @@ -328,8 +331,8 @@ class ByteArray #if !js extends Bytes implements ArrayAccess implements IDa public static function readFile (path:String):ByteArray { - #if !html5 - var data:Dynamic = lime_bytes_read_file.call (path); + #if (!html5 && !macro) + var data:Dynamic = lime_bytes_read_file (path); if (data != null) return ByteArray.fromBytes (@:privateAccess new Bytes (data.length, data.b)); #end return null; @@ -905,10 +908,10 @@ class ByteArray #if !js extends Bytes implements ArrayAccess implements IDa } - #if (cpp || neko || nodejs) + #if ((cpp || neko || nodejs) && !macro) public static function __fromNativePointer (data:Dynamic, length:Int):ByteArray { - var bytes:Dynamic = lime_bytes_from_data_pointer.call (data, length); + var bytes:Dynamic = lime_bytes_from_data_pointer (data, length); return ByteArray.fromBytes (@:privateAccess new Bytes (bytes.length, bytes.b)); } @@ -941,10 +944,10 @@ class ByteArray #if !js extends Bytes implements ArrayAccess implements IDa #end - #if (cpp || neko || nodejs) + #if ((cpp || neko || nodejs) && !macro) public function __getNativePointer ():Dynamic { - return lime_bytes_get_data_pointer.call (this); + return lime_bytes_get_data_pointer (this); } #end @@ -1102,9 +1105,12 @@ class ByteArray #if !js extends Bytes implements ArrayAccess implements IDa - private static var lime_bytes_from_data_pointer = System.loadPrime ("lime", "lime_bytes_from_data_pointer", "dio"); - private static var lime_bytes_get_data_pointer = System.loadPrime ("lime", "lime_bytes_get_data_pointer", "od"); - private static var lime_bytes_read_file = System.loadPrime ("lime", "lime_bytes_read_file", "so"); + #if !macro + @:cffi private static function lime_bytes_from_data_pointer (data:Float, length:Int):Dynamic; + @:cffi private static function lime_bytes_get_data_pointer (data:Dynamic):Float; + @:cffi private static function lime_bytes_read_file (path:String):Dynamic; + #end + } diff --git a/lime/utils/LZMA.hx b/lime/utils/LZMA.hx index 5c0b06467..701fe8b0e 100644 --- a/lime/utils/LZMA.hx +++ b/lime/utils/LZMA.hx @@ -2,7 +2,10 @@ package lime.utils; import haxe.io.Bytes; -import lime.system.System; + +#if !macro +@:build(lime.system.CFFI.build()) +#end class LZMA { @@ -10,8 +13,8 @@ class LZMA { public static function decode (bytes:ByteArray):ByteArray { - #if (cpp || neko || nodejs) - var data:Dynamic = lime_lzma_decode.call (bytes); + #if ((cpp || neko || nodejs) && !macro) + var data:Dynamic = lime_lzma_decode (bytes); return ByteArray.fromBytes (@:privateAccess new Bytes (data.length, data.b)); #else return null; @@ -22,8 +25,8 @@ class LZMA { public static function encode (bytes:ByteArray):ByteArray { - #if (cpp || neko || nodejs) - var data:Dynamic = lime_lzma_encode.call (bytes); + #if ((cpp || neko || nodejs) && !macro) + var data:Dynamic = lime_lzma_encode (bytes); return ByteArray.fromBytes (@:privateAccess new Bytes (data.length, data.b)); #else return null; @@ -39,9 +42,9 @@ class LZMA { - #if (cpp || neko || nodejs) - private static var lime_lzma_decode = System.loadPrime ("lime", "lime_lzma_decode", "oo"); - private static var lime_lzma_encode = System.loadPrime ("lime", "lime_lzma_encode", "oo"); + #if ((cpp || neko || nodejs) && !macro) + @:cffi private static function lime_lzma_decode (data:Dynamic):Dynamic; + @:cffi private static function lime_lzma_encode (data:Dynamic):Dynamic; #end diff --git a/lime/vm/NekoVM.hx b/lime/vm/NekoVM.hx index ef1cf5a48..3d29eb399 100644 --- a/lime/vm/NekoVM.hx +++ b/lime/vm/NekoVM.hx @@ -1,7 +1,9 @@ package lime.vm; -import lime.system.System; +#if !macro +@:build(lime.system.CFFI.build()) +#end class NekoVM { @@ -9,12 +11,12 @@ class NekoVM { public static function loadModule (path:String):Void { - lime_neko_execute.call (path); + lime_neko_execute (path); } - private static var lime_neko_execute = System.loadPrime ("lime", "lime_neko_execute", "sv"); + @:cffi private static function lime_neko_execute (module:String):Void; } \ No newline at end of file diff --git a/project/src/graphics/cairo/CairoBindings.cpp b/project/src/graphics/cairo/CairoBindings.cpp index fac6011f5..7a0159dc8 100644 --- a/project/src/graphics/cairo/CairoBindings.cpp +++ b/project/src/graphics/cairo/CairoBindings.cpp @@ -730,6 +730,13 @@ namespace lime { } + void lime_cairo_set_fill_rule (double handle, int cap) { + + cairo_set_fill_rule ((cairo_t*)(intptr_t)handle, (cairo_fill_rule_t)cap); + + } + + void lime_cairo_set_font_face (double handle, double face) { cairo_set_font_face ((cairo_t*)(intptr_t)handle, (cairo_font_face_t*)(intptr_t)face); @@ -751,13 +758,6 @@ namespace lime { } - void lime_cairo_set_fill_rule (double handle, int cap) { - - cairo_set_fill_rule ((cairo_t*)(intptr_t)handle, (cairo_fill_rule_t)cap); - - } - - void lime_cairo_set_line_cap (double handle, int cap) { cairo_set_line_cap ((cairo_t*)(intptr_t)handle, (cairo_line_cap_t)cap); diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index 123aba67d..be60b35da 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -9,8 +9,8 @@ import haxe.Serializer; import haxe.Unserializer; import haxe.io.Path; import haxe.rtti.Meta; +import lime.system.CFFI; import lime.tools.helpers.*; -import lime.system.System; import lime.tools.platforms.*; import lime.project.*; import sys.io.File; @@ -363,7 +363,7 @@ class CommandLineTools { if (args.length > 0 && args[0].toLowerCase () == "rebuild") { - System.disableCFFI = true; + CFFI.enabled = false; } @@ -371,7 +371,7 @@ class CommandLineTools { if (arg == "-nocffi" || arg == "-rebuild") { - System.disableCFFI = true; + CFFI.enabled = false; }