This commit is contained in:
Михаил Капелько committed 2026-10-23 06:57:04 +03:00
1 parent 4b70bd9906
commit e0f54dde75
7 files changed
+38 -43

No files matched your search

+28 -5
View File
@@ -1,6 +1,8 @@
#ifndef OGS_MAHJONG_RAYLIB_BRIDGE_H
#define OGS_MAHJONG_RAYLIB_BRIDGE_H
#include <TargetConditionals.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -14,6 +16,31 @@ typedef struct raybri_config {
float ground_size; // ground plane extent
} raybri_config;
// The bridge always renders into a GL context owned by the app (no raylib
// window), but the platform setup and the current feature set differ:
// macOS renders the textured cube through raybri.c, iOS currently only clears
// its EGL/ANGLE drawable through raybriIOS.c. The common names keep the Swift
// call sites and lifecycle symmetrical.
// Resize the drawable (backing pixels). On macOS this only records the size;
// on iOS it recreates the EGL window surface when it changes.
void raybri_resize(int width, int height);
// Release the GL/EGL resources owned by the bridge.
void raybri_shutdown(void);
#if TARGET_OS_IPHONE
// Initialise EGL (ANGLE) on the given CALayer and bring up rlgl.
// Returns 1 on success, 0 on failure.
int raybri_init(void *layer, int width, int height);
// Render one frame: clear the drawable to a time-based background colour and
// present it. `time` is monotonically increasing seconds.
void raybri_render(double time);
#else
// Initialise the OpenGL-backed raylib scene (no raylib window is created).
// The four shader sources come from renderConstShader.swift.
void raybri_init(
@@ -27,17 +54,13 @@ void raybri_init(
// Load the textured cube glTF model.
void raybri_load_model(const char *gltf_path);
// Resize the viewport.
void raybri_resize(int width, int height);
// Cube rotation, driven by the application (Euler angles, degrees).
void raybri_set_rotation(float x_deg, float y_deg, float z_deg);
// Render one frame.
void raybri_render(void);
// Release all GPU resources.
void raybri_shutdown(void);
#endif
#ifdef __cplusplus
}