Skip to content

Commit 8470ea8

Browse files
committed
Implement SDL3
1 parent 2fdc4b4 commit 8470ea8

File tree

107 files changed

+16532
-7426
lines changed

Some content is hidden

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

107 files changed

+16532
-7426
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: 28 additions & 37 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

@@ -30,14 +31,10 @@
3031
<set name="LIME_OPENAL" value="1" if="LIME_OPENALSOFT" />
3132
<set name="LIME_OPENAL" value="1" if="LIME_MOJOAL" />
3233
<set name="LIME_OPENGL" value="1" />
34+
<set name="LIME_GLAD" value="1" if="LIME_OPENGL" unless="ios || tvos" />
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,9 +50,6 @@
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" />
58-
5953
<files id="lime">
6054

6155
<compilerflag value="-Iinclude" />
@@ -200,8 +194,16 @@
200194

201195
<section if="LIME_OPENGL">
202196

197+
<section if="LIME_GLAD">
198+
199+
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/glad/include/" />
200+
<compilerflag value="-DLIME_GLAD" />
201+
202+
</section>
203+
204+
<compilerflag value="-DLIME_OPENGL_GL" if="windows || mac || linux" />
205+
<compilerflag value="-DLIME_OPENGL_GLES2" if="android || rpi || emscripten || tizen || ios || tvos" />
203206
<compilerflag value="-DLIME_OPENGL" />
204-
<compilerflag value="-I${DEVELOPER_DIR}/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS${TVOS_VER}.sdk/" if="tvos" />
205207

206208
<file name="src/graphics/opengl/OpenGLBindings.cpp" />
207209

@@ -257,7 +259,6 @@
257259
</section>
258260

259261
<compilerflag value="-DLIME_SDL" />
260-
<compilerflag value="-DNATIVE_TOOLKIT_SDL_ANGLE" if="NATIVE_TOOLKIT_SDL_ANGLE" />
261262
<compilerflag value="-D__IPHONEOS__" if="ios || tvos" />
262263
<compilerflag value="-D__APPLETVOS__" if="tvos" />
263264
<compilerflag value="-DAPPLETV" if="tvos" />
@@ -273,15 +274,6 @@
273274

274275
</section>
275276

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-
285277
<section if="LIME_VORBIS">
286278

287279
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/ogg/include/" />
@@ -326,6 +318,7 @@
326318
<file name="src/system/System.mm" if="ios" />
327319
<file name="src/system/ValuePointer.cpp" />
328320
<file name="src/ui/DropEvent.cpp" />
321+
<file name="src/ui/FileDialog.cpp" />
329322
<file name="src/ui/GamepadEvent.cpp" />
330323
<file name="src/ui/Haptic.mm" if="ios" />
331324
<file name="src/ui/JoystickEvent.cpp" />
@@ -355,6 +348,7 @@
355348
<include name="lib/faudio-files.xml" if="LIME_FAUDIO" />
356349
<include name="lib/freetype-files.xml" />
357350
<include name="lib/harfbuzz-files.xml" />
351+
<include name="lib/glad-files.xml" />
358352
<include name="lib/jpeg-files.xml" />
359353
<include name="lib/lzma-files.xml" />
360354
<include name="lib/mbedtls-files.xml" />
@@ -365,7 +359,6 @@
365359
<include name="lib/pixman-files.xml" />
366360
<include name="lib/png-files.xml" />
367361
<include name="lib/sdl-files.xml" />
368-
<include name="lib/tinyfiledialogs-files.xml" />
369362
<include name="lib/vorbis-files.xml" />
370363
<include name="lib/vpx-files.xml" />
371364
<include name="lib/webm-files.xml" />
@@ -398,7 +391,7 @@
398391
<files id="native-toolkit-pixman" if="LIME_PIXMAN" />
399392
<files id="native-toolkit-png" if="LIME_PNG" />
400393
<files id="native-toolkit-sdl" if="LIME_SDL" unless="emscripten" />
401-
<files id="native-toolkit-tinyfiledialogs" if="LIME_TINYFILEDIALOGS" />
394+
<files id="native-toolkit-glad" if="LIME_GLAD" />
402395
<files id="native-toolkit-vorbis" if="LIME_VORBIS" />
403396
<files id="native-toolkit-vpx" if="LIME_VPX" />
404397
<files id="native-toolkit-webm" if="LIME_WEBM" />
@@ -471,19 +464,24 @@
471464
<vflag name="-rpath" value="/opt/homebrew/lib" if="HXCPP_ARM64"/>
472465

473466
<vflag name="-l" value="iconv" />
474-
<vflag name="-framework" value="IOKit" />
475-
<vflag name="-framework" value="Foundation" />
476467
<vflag name="-framework" value="AppKit" />
477468
<vflag name="-framework" value="AudioToolbox" />
478469
<vflag name="-framework" value="AudioUnit" />
470+
<vflag name="-framework" value="AVFoundation" />
479471
<vflag name="-framework" value="Carbon" />
480472
<vflag name="-framework" value="Cocoa" />
481473
<vflag name="-framework" value="CoreAudio" />
474+
<vflag name="-framework" value="CoreBluetooth" />
475+
<vflag name="-framework" value="CoreHaptics" />
476+
<vflag name="-framework" value="CoreMedia" />
482477
<vflag name="-framework" value="CoreVideo" />
483478
<vflag name="-framework" value="ForceFeedback" />
484-
<vflag name="-framework" value="OpenAL" />
485479
<vflag name="-framework" value="OpenGL" />
480+
<vflag name="-framework" value="Foundation" />
481+
<vflag name="-framework" value="GameController" />
482+
<vflag name="-framework" value="IOKit" />
486483
<vflag name="-framework" value="SystemConfiguration" />
484+
<vflag name="-framework" value="UniformTypeIdentifiers" />
487485

488486
<lib name="/opt/local/lib/libgc.a" if="LIME_NEKO" />
489487
<lib name="-lm" if="LIME_NEKO" />
@@ -503,7 +501,6 @@
503501
<lib name="-lm" />
504502
<lib name="-lEGL" />
505503
<lib name="-lGLESv2" />
506-
<lib name="-lGLESv1_CM" />
507504
<lib name="-lOpenSLES" />
508505

509506
</section>
@@ -520,40 +517,34 @@
520517

521518
<section if="tvos">
522519

523-
<vflag name="-framework" value="UIKit" />
524-
<vflag name="-framework" value="Foundation" />
525520
<vflag name="-framework" value="AudioToolbox" />
526521
<vflag name="-framework" value="AudioUnit" />
527522
<vflag name="-framework" value="CoreAudio" />
523+
<vflag name="-framework" value="CoreBluetooth" />
528524
<vflag name="-framework" value="CoreVideo" />
525+
<vflag name="-framework" value="Foundation" />
529526
<vflag name="-framework" value="GameController" />
530-
<vflag name="-framework" value="OpenAL" />
531527
<vflag name="-framework" value="OpenGLES" />
532-
<!-- <vflag name="-framework" value="CoreBluetooth" /> -->
528+
<vflag name="-framework" value="UIKit" />
533529

534530
<lib name="-ldl" />
535-
<lib name="-lEGL" />
536-
<lib name="-lGLESv3" />
537531

538532
</section>
539533

540534
<section if="ios">
541535

542-
<vflag name="-framework" value="UIKit" />
543-
<vflag name="-framework" value="Foundation" />
544536
<vflag name="-framework" value="AudioToolbox" />
545537
<vflag name="-framework" value="AudioUnit" />
546538
<vflag name="-framework" value="CoreAudio" />
539+
<vflag name="-framework" value="CoreBluetooth" />
547540
<vflag name="-framework" value="CoreMotion" />
548541
<vflag name="-framework" value="CoreText" />
549542
<vflag name="-framework" value="CoreVideo" />
550-
<vflag name="-framework" value="OpenAL" />
543+
<vflag name="-framework" value="Foundation" />
551544
<vflag name="-framework" value="OpenGLES" />
552-
<!-- <vflag name="-framework" value="CoreBluetooth" /> -->
545+
<vflag name="-framework" value="UIKit" />
553546

554547
<lib name="-ldl" />
555-
<lib name="-lEGL" />
556-
<lib name="-lGLESv3" />
557548

558549
</section>
559550

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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,16 @@ 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 ();
3736
static std::wstring* GetDirectory (SystemDirectory type, const char* company, const char* title);
3837
static void* GetDisplay (bool useCFFIValue, int id);
3938
#ifdef IPHONE
4039
static std::wstring* GetIOSDirectory (SystemDirectory type);
41-
static bool GetIOSTablet ();
4240
#endif
43-
#if defined(ANDROID) || defined (IPHONE)
4441
static int GetFirstGyroscopeSensorId ();
4542
static int GetFirstAccelerometerSensorId ();
46-
#endif
4743
#if defined (IPHONE)
4844
static void showIOSAlert (const char* message, const char* title);
4945
#endif
@@ -60,6 +56,7 @@ namespace lime {
6056
static bool SetAllowScreenTimeout (bool allow);
6157
static int GetDisplayOrientation (int displayIndex);
6258
static std::wstring* GetHint (const char* key);
59+
static void SetHint (const char* key, const char* value);
6360
#if defined(HX_WINDOWS) && !defined (HX_WINRT)
6461
static bool SetWindowsConsoleMode (int handleType, int mode);
6562
#endif
@@ -86,7 +83,7 @@ namespace lime {
8683

8784

8885
extern int fclose (FILE_HANDLE *stream);
89-
extern FILE_HANDLE *fdopen (int fd, const char *mode);
86+
//extern FILE_HANDLE *fdopen (int fd, const char *mode);
9087
extern FILE_HANDLE *fopen (const char *filename, const char *mode);
9188
//extern FILE* freopen (const char *filename, const char *mode, FILE *stream);
9289
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)