Skip to content

Commit 573af84

Browse files
committed
Implement SDL3
1 parent 2fdc4b4 commit 573af84

File tree

105 files changed

+15803
-7265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+15803
-7265
lines changed

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
5555
path = project/lib/lzma
5656
url = https://github.com/openfl/liblzma
5757
shallow = true
58-
[submodule "project/lib/tinyfiledialogs"]
59-
path = project/lib/tinyfiledialogs
60-
url = https://github.com/openfl/libtinyfiledialogs
61-
shallow = true
6258
[submodule "project/lib/efsw"]
6359
path = project/lib/efsw
6460
url = https://github.com/SpartanJ/efsw
-3.31 MB
Binary file not shown.

dependencies/angle/libegl.dll

-131 KB
Binary file not shown.

dependencies/angle/libglesv2.dll

-3.22 MB
Binary file not shown.

include.xml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,37 @@
9797
<dependency path="dependencies/webgl-debug.js" if="html5 webgl-debug" embed="true" />
9898
<dependency path="dependencies/stats.min.js" if="html5 stats" embed="true" />
9999

100-
<dependency path="dependencies/angle/d3dcompiler_47.dll" if="windows angle" unless="static_link" />
101-
<dependency path="dependencies/angle/libegl.dll" if="windows angle" unless="static_link" />
102-
<dependency path="dependencies/angle/libglesv2.dll" if="windows angle" unless="static_link" />
100+
<section if="ios">
101+
<dependency name="AudioToolbox.framework" />
102+
<dependency name="AVFoundation.framework" />
103+
<dependency name="CoreAudio.framework" />
104+
<dependency name="CoreBluetooth.framework" />
105+
<dependency name="CoreGraphics.framework" />
106+
<dependency name="CoreHaptics.framework" />
107+
<dependency name="CoreMotion.framework" />
108+
<dependency name="CoreText.framework" />
109+
<dependency name="Foundation.framework" />
110+
<dependency name="GameController.framework" />
111+
<dependency name="MediaPlayer.framework" />
112+
<dependency name="Metal.framework" />
113+
<dependency name="OpenGLES.framework" />
114+
<dependency name="QuartzCore.framework" />
115+
<dependency name="UIKit.framework" />
116+
</section>
103117

104-
<!-- TODO: Move to template or move all template dependencies to XML? -->
105-
<!-- <dependency name="CoreBluetooth.framework" if="ios" /> -->
118+
<section if="tvos">
119+
<dependency name="AudioToolbox.framework" />
120+
<dependency name="AVFoundation.framework" />
121+
<dependency name="CoreAudio.framework" />
122+
<dependency name="CoreBluetooth.framework" />
123+
<dependency name="CoreGraphics.framework" />
124+
<dependency name="Foundation.framework" />
125+
<dependency name="GameController.framework" />
126+
<dependency name="MediaPlayer.framework" />
127+
<dependency name="OpenGLES.framework" />
128+
<dependency name="QuartzCore.framework" />
129+
<dependency name="UIKit.framework" />
130+
</section>
106131

107132
<define name="native-trace" if="flash" unless="haxe-trace || haxetrace" />
108133
<define name="fdb" if="flash debug" unless="nofdb" />

project/Build.xml

100755100644
Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<xml>
22
<set name="HXCPP_CPP20" value="1" />
3+
<set name="OBJC_ARC" value="1" if="apple" />
34

45
<include name="${HXCPP}/build-tool/BuildCommon.xml" />
56

@@ -23,6 +24,7 @@
2324
<set name="LIME_MBEDTLS" value="1" unless="emscripten || winrt" />
2425
<!-- <set name="LIME_NEKO" value="1" if="linux" /> -->
2526
<set name="LIME_OGG" value="1" />
27+
<set name="LIME_GLAD" value="1" />
2628
<set name="LIME_OPENALSOFT" value="1" if="windows || linux || mac || android || iphone" unless="tvos" />
2729
<set name="LIME_OPENAL" value="1" if="webassembly || tvos" />
2830
<set name="LIME_MOJOAL" value="1" if="switch || static_link || winrt || mojoal" unless="LIME_OPENAL || iphone LIME_OPENALSOFT" />
@@ -33,11 +35,6 @@
3335
<set name="LIME_PIXMAN" value="1" />
3436
<set name="LIME_PNG" value="1" />
3537
<set name="LIME_SDL" value="1" />
36-
<!-- <set name="LIME_SDL_ANGLE" value="1" if="windows" unless="static_link" /> -->
37-
<set name="LIME_SDL_ANGLE" value="1" if="windows LIME_SDL_ANGLE" unless="static_link" />
38-
<set name="LIME_SDL_ANGLE" value="1" if="windows angle" unless="static_link" />
39-
<set name="LIME_SDL_ANGLE" value="1" if="winrt" />
40-
<set name="LIME_TINYFILEDIALOGS" value="1" if="windows || mac || linux" unless="winrt || emscripten" />
4138
<set name="LIME_VORBIS" value="1" />
4239
<!-- <set name="LIME_VPX" value="1" />
4340
<set name="LIME_WEBM" value="1" /> -->
@@ -53,8 +50,10 @@
5350
<set name="NATIVE_TOOLKIT_HAVE_PNG" value="1" if="LIME_PNG" />
5451
<set name="NATIVE_TOOLKIT_HAVE_SDL" value="1" if="LIME_SDL" />
5552

56-
<set name="NATIVE_TOOLKIT_SDL_STATIC" value="1" />
57-
<set name="NATIVE_TOOLKIT_SDL_ANGLE" value="1" if="LIME_SDL_ANGLE" />
53+
<set name="NATIVE_TOOLKIT_HAVE_GLAD" value="1" if="LIME_GLAD" />
54+
55+
<set name="NATIVE_TOOLKIT_GLAD_GL" value="1" if="windows || mac || linux" />
56+
<set name="NATIVE_TOOLKIT_GLAD_GLES2" value="1" if="android || rpi || emscripten || tizen || ios || tvos" />
5857

5958
<files id="lime">
6059

@@ -184,6 +183,13 @@
184183

185184
</section>
186185

186+
<section if="LIME_GLAD">
187+
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/glad/include/" />
188+
189+
<compilerflag value="-DLIME_GL" if="NATIVE_TOOLKIT_GLAD_GL" />
190+
<compilerflag value="-DLIME_GLES2" if="NATIVE_TOOLKIT_GLAD_GLES2" />
191+
</section>
192+
187193
<section if="LIME_OPENAL">
188194

189195
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/openal/include/" unless="LIME_MOJOAL || emscripten" />
@@ -257,7 +263,6 @@
257263
</section>
258264

259265
<compilerflag value="-DLIME_SDL" />
260-
<compilerflag value="-DNATIVE_TOOLKIT_SDL_ANGLE" if="NATIVE_TOOLKIT_SDL_ANGLE" />
261266
<compilerflag value="-D__IPHONEOS__" if="ios || tvos" />
262267
<compilerflag value="-D__APPLETVOS__" if="tvos" />
263268
<compilerflag value="-DAPPLETV" if="tvos" />
@@ -273,15 +278,6 @@
273278

274279
</section>
275280

276-
<section if="LIME_TINYFILEDIALOGS">
277-
278-
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/tinyfiledialogs/" />
279-
<compilerflag value="-DLIME_TINYFILEDIALOGS" />
280-
281-
<file name="src/ui/FileDialog.cpp" />
282-
283-
</section>
284-
285281
<section if="LIME_VORBIS">
286282

287283
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/ogg/include/" />
@@ -326,6 +322,7 @@
326322
<file name="src/system/System.mm" if="ios" />
327323
<file name="src/system/ValuePointer.cpp" />
328324
<file name="src/ui/DropEvent.cpp" />
325+
<file name="src/ui/FileDialog.cpp" />
329326
<file name="src/ui/GamepadEvent.cpp" />
330327
<file name="src/ui/Haptic.mm" if="ios" />
331328
<file name="src/ui/JoystickEvent.cpp" />
@@ -355,6 +352,7 @@
355352
<include name="lib/faudio-files.xml" if="LIME_FAUDIO" />
356353
<include name="lib/freetype-files.xml" />
357354
<include name="lib/harfbuzz-files.xml" />
355+
<include name="lib/glad-files.xml" />
358356
<include name="lib/jpeg-files.xml" />
359357
<include name="lib/lzma-files.xml" />
360358
<include name="lib/mbedtls-files.xml" />
@@ -365,7 +363,6 @@
365363
<include name="lib/pixman-files.xml" />
366364
<include name="lib/png-files.xml" />
367365
<include name="lib/sdl-files.xml" />
368-
<include name="lib/tinyfiledialogs-files.xml" />
369366
<include name="lib/vorbis-files.xml" />
370367
<include name="lib/vpx-files.xml" />
371368
<include name="lib/webm-files.xml" />
@@ -398,7 +395,7 @@
398395
<files id="native-toolkit-pixman" if="LIME_PIXMAN" />
399396
<files id="native-toolkit-png" if="LIME_PNG" />
400397
<files id="native-toolkit-sdl" if="LIME_SDL" unless="emscripten" />
401-
<files id="native-toolkit-tinyfiledialogs" if="LIME_TINYFILEDIALOGS" />
398+
<files id="native-toolkit-glad" if="LIME_GLAD" />
402399
<files id="native-toolkit-vorbis" if="LIME_VORBIS" />
403400
<files id="native-toolkit-vpx" if="LIME_VPX" />
404401
<files id="native-toolkit-webm" if="LIME_WEBM" />
@@ -471,19 +468,24 @@
471468
<vflag name="-rpath" value="/opt/homebrew/lib" if="HXCPP_ARM64"/>
472469

473470
<vflag name="-l" value="iconv" />
474-
<vflag name="-framework" value="IOKit" />
475-
<vflag name="-framework" value="Foundation" />
476471
<vflag name="-framework" value="AppKit" />
477472
<vflag name="-framework" value="AudioToolbox" />
478473
<vflag name="-framework" value="AudioUnit" />
474+
<vflag name="-framework" value="AVFoundation" />
479475
<vflag name="-framework" value="Carbon" />
480476
<vflag name="-framework" value="Cocoa" />
481477
<vflag name="-framework" value="CoreAudio" />
478+
<vflag name="-framework" value="CoreBluetooth" />
479+
<vflag name="-framework" value="CoreHaptics" />
480+
<vflag name="-framework" value="CoreMedia" />
482481
<vflag name="-framework" value="CoreVideo" />
483482
<vflag name="-framework" value="ForceFeedback" />
484-
<vflag name="-framework" value="OpenAL" />
485483
<vflag name="-framework" value="OpenGL" />
484+
<vflag name="-framework" value="Foundation" />
485+
<vflag name="-framework" value="GameController" />
486+
<vflag name="-framework" value="IOKit" />
486487
<vflag name="-framework" value="SystemConfiguration" />
488+
<vflag name="-framework" value="UniformTypeIdentifiers" />
487489

488490
<lib name="/opt/local/lib/libgc.a" if="LIME_NEKO" />
489491
<lib name="-lm" if="LIME_NEKO" />
@@ -503,7 +505,6 @@
503505
<lib name="-lm" />
504506
<lib name="-lEGL" />
505507
<lib name="-lGLESv2" />
506-
<lib name="-lGLESv1_CM" />
507508
<lib name="-lOpenSLES" />
508509

509510
</section>
@@ -520,40 +521,34 @@
520521

521522
<section if="tvos">
522523

523-
<vflag name="-framework" value="UIKit" />
524-
<vflag name="-framework" value="Foundation" />
525524
<vflag name="-framework" value="AudioToolbox" />
526525
<vflag name="-framework" value="AudioUnit" />
527526
<vflag name="-framework" value="CoreAudio" />
527+
<vflag name="-framework" value="CoreBluetooth" />
528528
<vflag name="-framework" value="CoreVideo" />
529+
<vflag name="-framework" value="Foundation" />
529530
<vflag name="-framework" value="GameController" />
530-
<vflag name="-framework" value="OpenAL" />
531531
<vflag name="-framework" value="OpenGLES" />
532-
<!-- <vflag name="-framework" value="CoreBluetooth" /> -->
532+
<vflag name="-framework" value="UIKit" />
533533

534534
<lib name="-ldl" />
535-
<lib name="-lEGL" />
536-
<lib name="-lGLESv3" />
537535

538536
</section>
539537

540538
<section if="ios">
541539

542-
<vflag name="-framework" value="UIKit" />
543-
<vflag name="-framework" value="Foundation" />
544540
<vflag name="-framework" value="AudioToolbox" />
545541
<vflag name="-framework" value="AudioUnit" />
546542
<vflag name="-framework" value="CoreAudio" />
543+
<vflag name="-framework" value="CoreBluetooth" />
547544
<vflag name="-framework" value="CoreMotion" />
548545
<vflag name="-framework" value="CoreText" />
549546
<vflag name="-framework" value="CoreVideo" />
550-
<vflag name="-framework" value="OpenAL" />
547+
<vflag name="-framework" value="Foundation" />
551548
<vflag name="-framework" value="OpenGLES" />
552-
<!-- <vflag name="-framework" value="CoreBluetooth" /> -->
549+
<vflag name="-framework" value="UIKit" />
553550

554551
<lib name="-ldl" />
555-
<lib name="-lEGL" />
556-
<lib name="-lGLESv3" />
557552

558553
</section>
559554

project/include/app/ApplicationEvent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace lime {
2020
struct ApplicationEvent {
2121

2222
hl_type* t;
23-
int deltaTime;
23+
double deltaTime;
2424
ApplicationEventType type;
2525

2626
static ValuePointer* callback;

project/include/system/Clipboard.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef LIME_SYSTEM_CLIPBOARD_H
22
#define LIME_SYSTEM_CLIPBOARD_H
33

4+
#include <string>
5+
46

57
namespace lime {
68

@@ -10,7 +12,7 @@ namespace lime {
1012

1113
public:
1214

13-
static const char* GetText ();
15+
static std::wstring* GetText ();
1416
static bool HasText ();
1517
static bool SetText (const char* text);
1618

project/include/system/System.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ namespace lime {
3030
static void GCExitBlocking ();
3131
static void GCTryEnterBlocking ();
3232
static void GCTryExitBlocking ();
33-
static int GetTicks ();
3433
static bool GetAllowScreenTimeout ();
3534
static std::wstring* GetDeviceModel ();
3635
static std::wstring* GetDeviceVendor ();
@@ -60,6 +59,7 @@ namespace lime {
6059
static bool SetAllowScreenTimeout (bool allow);
6160
static int GetDisplayOrientation (int displayIndex);
6261
static std::wstring* GetHint (const char* key);
62+
static void SetHint (const char* key, const char* value);
6363
#if defined(HX_WINDOWS) && !defined (HX_WINRT)
6464
static bool SetWindowsConsoleMode (int handleType, int mode);
6565
#endif
@@ -86,7 +86,7 @@ namespace lime {
8686

8787

8888
extern int fclose (FILE_HANDLE *stream);
89-
extern FILE_HANDLE *fdopen (int fd, const char *mode);
89+
//extern FILE_HANDLE *fdopen (int fd, const char *mode);
9090
extern FILE_HANDLE *fopen (const char *filename, const char *mode);
9191
//extern FILE* freopen (const char *filename, const char *mode, FILE *stream);
9292
extern size_t fread (void *ptr, size_t size, size_t count, FILE_HANDLE *stream);

project/include/ui/FileDialog.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
#ifndef LIME_UI_FILE_DIALOG_H
22
#define LIME_UI_FILE_DIALOG_H
33

4-
4+
#include <ui/Window.h>
55
#include <string>
66
#include <vector>
7-
7+
#include <functional>
88

99
namespace lime {
1010

11-
1211
class FileDialog {
1312

14-
public:
13+
public:
1514

16-
static std::wstring* OpenDirectory (std::wstring* title = 0, std::wstring* filter = 0, std::wstring* defaultPath = 0);
17-
static std::wstring* OpenFile (std::wstring* title = 0, std::wstring* filter = 0, std::wstring* defaultPath = 0);
18-
static void OpenFiles (std::vector<std::wstring*>* files, std::wstring* title = 0, std::wstring* filter = 0, std::wstring* defaultPath = 0);
19-
static std::wstring* SaveFile (std::wstring* title = 0, std::wstring* filter = 0, std::wstring* defaultPath = 0);
15+
static void OpenDirectory (Window* window, std::function<void(const char* const*, int, int)> callback, const char* defaultPath = nullptr, bool allowMultiple = false);
16+
static void OpenFile (Window* window, std::function<void(const char* const*, int, int)> callback, const char** names = nullptr, const char** patterns = nullptr, int filterCount = 0, const char* defaultPath = nullptr, bool allowMultiple = false);
17+
static void SaveFile (Window* window, std::function<void(const char* const*, int, int)> callback, const char** names = nullptr, const char** patterns = nullptr, int filterCount = 0, const char* defaultPath = nullptr);
2018

2119
};
2220

23-
2421
}
2522

26-
2723
#endif

0 commit comments

Comments
 (0)