-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rcore] Porting raylib to iOS and implement rcore_ios.c
#3880
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
rcore_ios.c
rcore_ios.c
rcore_ios.c
rcore_ios.c
Hi @raysan5 . I need your help. iOS always use a int main(int argc, char * argv[]) {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
} It seems does not expose detailed control to allow us to achieve the following:
What we can do is registering render callbacks via CADisplayLink. I cannot find a way to give users full control of the game loop. I can try a callback-based api like this. However, this requires a minor change of existing raylib projects if they want to run on iOS. extern void ios_ready();
extern void ios_update();
extern void ios_destroy(); Old project should adapt their main function into this in order to be cross-platform between iOS and other platforms: #ifndef PLATFORM_IOS
int main(int argc, char** argv){
// store as global variables if you need
ios_ready();
while(!WindowShouldClose()) ios_update();
ios_destroy();
return 0;
}
#endif |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Question: I see there is a feature: Should I override |
Now |
This comment was marked as outdated.
This comment was marked as outdated.
This reverts commit a552997.
@blueloveTH Excuse my late response and thank you very much for working on this great improvement. iOS platform has been missing from raylib for +10 years and I'm happy to see that some user implemented it. My main concern is the iOS application approach that completely differs from all the other platforms. All raylib examples work exactly as they are on all the supported platforms and requiring a complete re-design for iOS is not the ideal situation. Is it possible to use a similar approach to Android one? Embedding the App management inside raylib? Also note that the provided |
- name: Build Xcode15 project | ||
run: | | ||
cd projects/Xcode15 | ||
curl -L https://github.com/raysan5/raylib/files/14743869/libEGL.xcframework.zip --output libEGL.xcframework.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are those files located? It looks a bit dodgy... isn't there a better approach?
@@ -0,0 +1 @@ | |||
Frameworks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this .gitignore file required? Could't it be avoided?
@@ -815,7 +815,19 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad | |||
#include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers | |||
#endif | |||
|
|||
#if defined(GRAPHICS_API_OPENGL_ES3) | |||
#if defined(PLATFORM_IOS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible I'd prefer to keep rlgl
as platform-agnostic as possible, would it be possible to move this configuration to the build system or rcore.c
instead of manage it here?
#error "GL_GLEXT_PROTOTYPES required on PLATFORM_IOS" | ||
#endif | ||
#include "libGLESv2/GLES/glext.h" | ||
#include "libGLESv2/GLES2/gl2.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why GLES2
and GLES3
are included if only GLES3
is needed?
if(touchs[i] == touch) return i + 1; | ||
} | ||
// clear unused touch pairs before insert | ||
for(int i = 0; i < MAX_TOUCH_POINTS; i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raylib adds one space after if
, else
, for
and always aligns brackets.
|
||
/* main() */ | ||
int main(int argc, char * argv[]) { | ||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine this is the biggest issue with iOS implementation, isn't there another alternative?
Thanks for your review. I am going to resolve them soon. |
Interesting.. will colaborate soon |
Any new progress? |
also interested :D? |
I am a bit busy recently |
I would like to take the initial step to add iOS support for raylib.
I am going to add
rcore_ios.c
and implement an iOS's platform layer.I will update this pr on my progress.
Current Demo (iPhone 8)
RPReplay_Final1711259172.MP4
Steps
libEGL.xcframework
andlibGLESv2.xcframework
rcore_ios.c
and compile raylibFunctions
void PollInputEvents(void)
int InitPlatform(void)
void ClosePlatform(void)
Prebuilt ANGLE libraries for iOS
Users need to add the following ANGLE libraries into Xcode.
libEGL.xcframework.zip
libGLESv2.xcframework.zip
References