Merge branch 'openfl:develop' into submodules

This commit is contained in:
player-03
2022-12-01 11:58:25 -05:00
committed by GitHub
43 changed files with 527 additions and 322 deletions

View File

@@ -57,6 +57,7 @@ namespace lime {
virtual void SetMouseLock (bool mouseLock) = 0;
virtual bool SetResizable (bool resizable) = 0;
virtual void SetTextInputEnabled (bool enable) = 0;
virtual void SetTextInputRect (Rectangle *rect) = 0;
virtual const char* SetTitle (const char* title) = 0;
virtual void WarpMouse (int x, int y) = 0;

View File

@@ -3668,6 +3668,23 @@ namespace lime {
}
void lime_window_set_text_input_rect (value window, value rect) {
Window* targetWindow = (Window*)val_data (window);
Rectangle _rect = Rectangle (rect);
targetWindow->SetTextInputRect (&_rect);
}
HL_PRIM void HL_NAME(hl_window_set_text_input_rect) (HL_CFFIPointer* window, Rectangle* rect) {
Window* targetWindow = (Window*)window->ptr;
targetWindow->SetTextInputRect (rect);
}
value lime_window_set_title (value window, HxString title) {
Window* targetWindow = (Window*)val_data (window);
@@ -3931,6 +3948,7 @@ namespace lime {
DEFINE_PRIME2v (lime_window_set_mouse_lock);
DEFINE_PRIME2 (lime_window_set_resizable);
DEFINE_PRIME2v (lime_window_set_text_input_enabled);
DEFINE_PRIME2v (lime_window_set_text_input_rect);
DEFINE_PRIME2 (lime_window_set_title);
DEFINE_PRIME3v (lime_window_warp_mouse);
DEFINE_PRIME2 (lime_zlib_compress);
@@ -4114,6 +4132,7 @@ namespace lime {
DEFINE_HL_PRIM (_VOID, hl_window_set_mouse_lock, _TCFFIPOINTER _BOOL);
DEFINE_HL_PRIM (_BOOL, hl_window_set_resizable, _TCFFIPOINTER _BOOL);
DEFINE_HL_PRIM (_VOID, hl_window_set_text_input_enabled, _TCFFIPOINTER _BOOL);
DEFINE_HL_PRIM (_VOID, hl_window_set_text_input_rect, _TCFFIPOINTER _TRECTANGLE);
DEFINE_HL_PRIM (_STRING, hl_window_set_title, _TCFFIPOINTER _STRING);
DEFINE_HL_PRIM (_VOID, hl_window_warp_mouse, _TCFFIPOINTER _I32 _I32);
DEFINE_HL_PRIM (_TBYTES, hl_zlib_compress, _TBYTES _TBYTES);

View File

@@ -1050,6 +1050,23 @@ namespace lime {
}
void SDLWindow::SetTextInputRect (Rectangle * rect) {
SDL_Rect bounds = { 0, 0, 0, 0 };
if (rect) {
bounds.x = rect->x;
bounds.y = rect->y;
bounds.w = rect->width;
bounds.h = rect->height;
}
SDL_SetTextInputRect(&bounds);
}
const char* SDLWindow::SetTitle (const char* title) {
SDL_SetWindowTitle (sdlWindow, title);

View File

@@ -51,6 +51,7 @@ namespace lime {
virtual void SetMouseLock (bool mouseLock);
virtual bool SetResizable (bool resizable);
virtual void SetTextInputEnabled (bool enabled);
virtual void SetTextInputRect (Rectangle *rect);
virtual const char* SetTitle (const char* title);
virtual void WarpMouse (int x, int y);

View File

@@ -81,7 +81,7 @@ namespace lime {
static int VorbisFile_BufferClose (VorbisFile_Buffer* src) {
free (src);
delete src;
return 0;
}
@@ -154,8 +154,8 @@ namespace lime {
if (ov_open_callbacks (buffer, vorbisFile, NULL, 0, VORBIS_FILE_BUFFER_CALLBACKS) != 0) {
free (buffer);
free (vorbisFile);
delete buffer;
delete vorbisFile;
return 0;
}
@@ -178,7 +178,7 @@ namespace lime {
if (ov_open_callbacks (file, vorbisFile, NULL, 0, VORBIS_FILE_FILE_CALLBACKS) != 0) {
free (vorbisFile);
delete vorbisFile;
lime::fclose (file);
return 0;

View File

@@ -1287,6 +1287,13 @@ namespace lime {
}
static int seek_callback (void *userp, curl_off_t offset, int origin) {
if (origin == SEEK_SET) {
readBytesPosition[userp] = offset;
return CURL_SEEKFUNC_OK;
}
return CURL_SEEKFUNC_CANTSEEK;
}
static size_t read_callback (void *buffer, size_t size, size_t nmemb, void *userp) {
@@ -1634,6 +1641,9 @@ namespace lime {
readBytesPosition[handle] = 0;
readBytesRoot[handle] = new ValuePointer (bytes);
// seek function is needed to support redirects
curl_easy_setopt (easy_handle, CURLOPT_SEEKFUNCTION, seek_callback);
curl_easy_setopt (easy_handle, CURLOPT_SEEKDATA, handle);
code = curl_easy_setopt (easy_handle, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt (easy_handle, CURLOPT_READDATA, handle);
@@ -2061,6 +2071,8 @@ namespace lime {
readBytesPosition[handle] = 0;
readBytesRoot[handle] = new ValuePointer ((vobj*)bytes);
curl_easy_setopt (easy_handle, CURLOPT_SEEKFUNCTION, seek_callback);
curl_easy_setopt (easy_handle, CURLOPT_SEEKDATA, handle);
code = curl_easy_setopt (easy_handle, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt (easy_handle, CURLOPT_READDATA, handle);