ios: Get it to compile even though it doesn't work at all

This commit is contained in:
UnknownShadow200 2021-01-10 23:38:21 +11:00
parent 19cdffd5f2
commit 3fd48f49bb
4 changed files with 70 additions and 12 deletions

View File

@ -128,6 +128,17 @@ NOTE: You have to change entry->d_type == DT_DIR to Directory_Exists(&path) (TOD
The generated javascript file has some issues. [See here for how to fix](doc/compile-fixes.md#webclient-patches)
#### Android
Use Android Studio or run gradlew in android folder (TODO explain more detailed)
#### iOS
```clang *.c interop_ios.m -framework UIKit -framework OpenGLES -framework Foundation -lobjc```
iOS version is unfinished because of lack of access to suitable devices for me to test with
##### Other
You'll have to write the necessary code. You should read portability.md in doc folder.

View File

@ -28,11 +28,20 @@ void Clipboard_RequestText(RequestClipboardCallback callback, void* obj) {
}
#endif
#ifdef CC_BUILD_IOS
/* iOS implements some functions in external interop_ios.m file */
#define CC_MAYBE_OBJC extern
#else
/* All other platforms implement internally in this file */
#define CC_MAYBE_OBJC static
#endif
static int cursorPrevX, cursorPrevY;
static cc_bool cursorVisible = true;
/* Gets the position of the cursor in screen or window coordinates. */
static void Cursor_GetRawPos(int* x, int* y);
static void Cursor_DoSetVisible(cc_bool visible);
CC_MAYBE_OBJC void Cursor_GetRawPos(int* x, int* y);
CC_MAYBE_OBJC void Cursor_DoSetVisible(cc_bool visible);
void Cursor_SetVisible(cc_bool visible) {
if (cursorVisible == visible) return;
@ -71,7 +80,7 @@ static void DefaultDisableRawMouse(void) {
}
/* The actual windowing system specific method to display a message box */
static void ShowDialogCore(const char* title, const char* msg);
CC_MAYBE_OBJC void ShowDialogCore(const char* title, const char* msg);
void Window_ShowDialog(const char* title, const char* msg) {
/* Ensure cursor is visible while showing message box */
cc_bool visible = cursorVisible;

View File

@ -121,14 +121,10 @@ FT_BEGIN_HEADER
/* providing a new configuration file. */
/* */
#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
/* no Carbon frameworks for 64bit 10.4.x */
/* AvailabilityMacros.h is available since Mac OS X 10.2, */
/* so guess the system version by maximum errno before inclusion */
#include <errno.h>
#ifdef ECANCELED /* defined since 10.2 */
#include "AvailabilityMacros.h"
#endif
/* don't enable mac support on iPhone/iPad */
#ifndef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
#define FT_MACINTOSH 1
#endif
#elif defined( __SC__ ) || defined( __MRC__ )
/* Classic MacOS compilers */

View File

@ -1,6 +1,7 @@
#include "Window.h"
#include "Platform.h"
#include "String.h"
#include "Errors.h"
#include <UIKit/UIPasteboard.h>
void Clipboard_GetText(cc_string* value) {
@ -21,18 +22,59 @@ void Clipboard_SetText(const cc_string* value) {
NSString* str;
int len;
Platform_EncodeString(raw, value);
Platform_EncodeUtf8(raw, value);
str = [NSString stringWithUTF8String:raw];
[UIPasteboard generalPasteboard].string = str;
[str release];
}
/*########################################################################################################################*
*---------------------------------------------------------Window----------------------------------------------------------*
*#########################################################################################################################*/
void Cursor_GetRawPos(int* x, int* y) { *x = 0; *y = 0; }
void Cursor_SetPosition(int x, int y) { }
void Cursor_DoSetVisible(cc_bool visible) { }
void Window_SetTitle(const cc_string* title) {
/* TODO: Implement this somehow */
}
void Window_Init(void) { }
void Window_Create(int width, int height) { }
void Window_SetSize(int width, int height) { }
void Window_Close(void) { }
void Window_Show(void) { }
void Window_ProcessEvents(void) { }
void ShowDialogCore(const char* title, const char* msg) { }
void Window_OpenKeyboard(const struct OpenKeyboardArgs* args) { }
void Window_SetKeyboardText(const cc_string* text) { }
void Window_CloseKeyboard(void) { }
int Window_GetWindowState(void) { return WINDOW_STATE_NORMAL; }
cc_result Window_EnterFullscreen(void) { return ERR_NOT_SUPPORTED; }
cc_result Window_ExitFullscreen(void) { return ERR_NOT_SUPPORTED; }
void Window_AllocFramebuffer(struct Bitmap* bmp) { }
void Window_DrawFramebuffer(Rect2D r) { }
void Window_FreeFramebuffer(struct Bitmap* bmp) { }
void Window_EnableRawMouse(void) { }
void Window_UpdateRawMouse(void) { }
void Window_DisableRawMouse(void) { }
/*########################################################################################################################*
*--------------------------------------------------------GLContext--------------------------------------------------------*
*#########################################################################################################################*/
void GLContext_Create(void) { }
void GLContext_Update(void) { }
cc_bool GLContext_TryRestore(void) { return false; }
void GLContext_Free(void) { }
void* GLContext_GetAddress(const char* function) { return NULL; }
cc_bool GLContext_SwapBuffers(void) { return false; }
void GLContext_SetFpsLimit(cc_bool vsync, float minFrameMs) { }
void GLContext_GetApiInfo(cc_string* info) { }