Android support, attempt-1 #8

Open
kornerr wants to merge 62 commits from and1 into master
pull from: and1
3 changed files with 19 additions and 17 deletions
Showing only changes of commit 7bd72fc60a - Show all commits

No files matched your search

-17
View File
@@ -11,26 +11,9 @@
#include <stdio.h>
static EGLState globalES = {
.caLayer = NULL,
.cfg = NULL,
.ctx = EGL_NO_CONTEXT,
.display = EGL_NO_DISPLAY,
.surface = EGL_NO_SURFACE
};
void raybriInit(void *layer) {
//SetTraceLogLevel(LOG_WARNING);
globalES.caLayer = layer;
if (!eglInit(&globalES)) {
raybriLog("ERROR Could not initialize EGL");
}
if (!eglResetSurface(&globalES)) {
raybriLog("ERROR Could not reset EGL surface");
}
// Initialize raylib graphics layer with a placeholder 1x1 framebuffer size
// Graphics layer includes default texture, shader, render batch and OpenGL state
rlglInit(1, 1);
+11
View File
@@ -12,6 +12,17 @@ func renderInit(_ vm: RenderVM) {
// UIKit has no NSOpenGLContext: EGL/ANGLE renders into the view's layer,
// so the layer is what the bridge needs to create its surface from.
let layer = Unmanaged.passUnretained(vm.glView.layer).toOpaque()
vm.glView.st.caLayer = layer;
if (!eglInit(&vm.glView.st)) {
raybriLog("ERROR Could not initialize EGL");
}
if (!eglResetSurface(&vm.glView.st)) {
raybriLog("ERROR Could not reset EGL surface");
}
eglMakeCurrentContext(&vm.glView.st)
raybriInit(layer)
}
@@ -1,6 +1,14 @@
import UIKit
final class RenderGLView: UIView {
var st: EGLState = {
.caLayer = NULL,
.cfg = NULL,
.ctx = EGL_NO_CONTEXT,
.display = EGL_NO_DISPLAY,
.surface = EGL_NO_SURFACE
};
override init(frame: CGRect) {
super.init(frame: frame)