From 742406c0cc2fa8b9f3fbfa70724237ffee855278 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 25 May 2018 16:57:41 -0700 Subject: [PATCH] More progress --- lime/_backend/native/NativeRenderer.hx | 4 ++++ project/include/utils/String.h | 23 +++++++++++++++++++++++ project/src/ExternalInterface.cpp | 18 +++++++++++++++--- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 project/include/utils/String.h diff --git a/lime/_backend/native/NativeRenderer.hx b/lime/_backend/native/NativeRenderer.hx index f7a96c7e5..7a5eb9e7c 100644 --- a/lime/_backend/native/NativeRenderer.hx +++ b/lime/_backend/native/NativeRenderer.hx @@ -66,7 +66,11 @@ class NativeRenderer { #else + #if hl + var type = @:privateAccess String.fromUCS2 (NativeCFFI.lime_renderer_get_type (handle)); + #else var type:String = NativeCFFI.lime_renderer_get_type (handle); + #end switch (type) { diff --git a/project/include/utils/String.h b/project/include/utils/String.h new file mode 100644 index 000000000..d890ad474 --- /dev/null +++ b/project/include/utils/String.h @@ -0,0 +1,23 @@ +#ifndef LIME_UTILS_STRING_H +#define LIME_UTILS_STRING_H + + +#include + + +namespace lime { + + + struct HL_String { + + hl_type* t; + unsigned char* bytes; + int length; + + }; + + +} + + +#endif \ No newline at end of file diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index f4611c8fc..ef793732e 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include DEFINE_KIND (k_finalizer); @@ -2168,6 +2169,7 @@ namespace lime { // int32_t color = (colorRG << 16) | colorBA; // int32_t mask = (maskRG << 16) | maskBA; // return ImageDataUtil::Threshold (&_image, &_sourceImage, &_sourceRect, &_destPoint, operation, threshold, color, mask, copySource); + return 0; } @@ -3536,9 +3538,9 @@ namespace lime { } - HL_PRIM HL_CFFIPointer* hl_lime_window_create (HL_CFFIPointer* application, int width, int height, int flags, vbyte* title) { + HL_PRIM HL_CFFIPointer* hl_lime_window_create (HL_CFFIPointer* application, int width, int height, int flags, HL_String* title) { - Window* window = CreateWindow ((Application*)application->ptr, width, height, flags, (const char*)title); + Window* window = CreateWindow ((Application*)application->ptr, width, height, flags, (const char*)title->bytes); return HLCFFIPointer (window, (hl_finalizer)hl_gc_window); } @@ -4167,10 +4169,20 @@ namespace lime { DEFINE_HL_PRIM (_I32, lime_application_quit, TCFFIPOINTER); DEFINE_HL_PRIM (_VOID, lime_application_set_frame_rate, TCFFIPOINTER _F64); DEFINE_HL_PRIM (_BOOL, lime_application_update, TCFFIPOINTER); + DEFINE_HL_PRIM (_VOID, lime_gamepad_add_mappings, _DYN); DEFINE_HL_PRIM (_VOID, lime_image_data_util_fill_rect, TIMAGE TRECTANGLE _I32 _I32); + DEFINE_HL_PRIM (TCFFIPOINTER, lime_renderer_create, TCFFIPOINTER); + DEFINE_HL_PRIM (_VOID, lime_renderer_flip, TCFFIPOINTER); + DEFINE_HL_PRIM (_F64, lime_renderer_get_context, TCFFIPOINTER); + DEFINE_HL_PRIM (_F64, lime_renderer_get_scale, TCFFIPOINTER); + DEFINE_HL_PRIM (_BYTES, lime_renderer_get_type, TCFFIPOINTER); + DEFINE_HL_PRIM (_DYN, lime_renderer_lock, TCFFIPOINTER); + DEFINE_HL_PRIM (_VOID, lime_renderer_make_current, TCFFIPOINTER); + DEFINE_HL_PRIM (_DYN, lime_renderer_read_pixels, TCFFIPOINTER TRECTANGLE TIMAGEBUFFER); + DEFINE_HL_PRIM (_VOID, lime_renderer_unlock, TCFFIPOINTER); DEFINE_HL_PRIM (_VOID, lime_window_alert, TCFFIPOINTER _BYTES _BYTES); DEFINE_HL_PRIM (_VOID, lime_window_close, TCFFIPOINTER); - DEFINE_HL_PRIM (TCFFIPOINTER, lime_window_create, TCFFIPOINTER _I32 _I32 _I32 _BYTES); + DEFINE_HL_PRIM (TCFFIPOINTER, lime_window_create, TCFFIPOINTER _I32 _I32 _I32 _STRING); // DEFINE_PRIME2v (_VOID, lime_window_event_manager_register, TCFFIPOINTER ); DEFINE_HL_PRIM (_VOID, lime_window_focus, TCFFIPOINTER); DEFINE_HL_PRIM (_I32, lime_window_get_display, TCFFIPOINTER);