Skip to content

Commit

Permalink
Copypaste SDL_NSLog to UIKit backend, document it as such
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jul 18, 2019
1 parent 0481c0b commit 7e0cc7e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SDL_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
__android_log_write(SDL_android_priority[priority], tag, message);
}
#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
/* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now.
#elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))
/* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now.
*/
extern void SDL_NSLog(const char *text);
{
Expand Down
3 changes: 3 additions & 0 deletions src/video/cocoa/SDL_cocoavideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@
*
* This doesn't really have aything to do with the interfaces of the SDL video
* subsystem, but we need to stuff this into an Objective-C source code file.
*
* NOTE: This is copypasted in src/video/uikit/SDL_uikitvideo.m! Be sure both
* versions remain identical!
*/

void SDL_NSLog(const char *text)
Expand Down
6 changes: 6 additions & 0 deletions src/video/uikit/SDL_uikitvideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,18 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
*
* This doesn't really have aything to do with the interfaces of the SDL video
* subsystem, but we need to stuff this into an Objective-C source code file.
*
* NOTE: This is copypasted from src/video/cocoa/SDL_cocoavideo.m! Thus, if
* Cocoa is supported, we use that one instead. Be sure both versions remain
* identical!
*/

#if !defined(SDL_VIDEO_DRIVER_COCOA)
void SDL_NSLog(const char *text)
{
NSLog(@"%s", text);
}
#endif /* SDL_VIDEO_DRIVER_COCOA */

/*
* iOS Tablet detection
Expand Down

0 comments on commit 7e0cc7e

Please sign in to comment.