// UIKitPlatform end-to-end smoke: boots the AppDelegate, installs an // SxGLView with a CAEAGLLayer + GLES3 context + CADisplayLink, and on // every vsync clears the screen to a cycling color. // // Build + run: // sx build --target ios-sim examples/66-uikit-platform.sx \ // -o /tmp/SxUIKitBoot --bundle /tmp/SxUIKitBoot.app \ // --bundle-id co.swipelab.sxuikit -F ~/Library/Frameworks // xcrun simctl install booted /tmp/SxUIKitBoot.app // xcrun simctl launch --console booted co.swipelab.sxuikit // xcrun simctl io booted screenshot /tmp/screen.png #import "modules/std.sx"; #import "modules/std/uikit.sx"; #framework "OpenGLES"; #framework "QuartzCore"; #import "modules/opengl.sx"; #import "modules/platform/uikit.sx"; g_frame_counter : s64 = 0; cycle_frame :: () { fc := g_uikit_plat.begin_frame(); g_frame_counter += 1; phase := g_frame_counter / 30; r : f32 = if (phase % 3) == 0 then 0.8 else 0.1; g : f32 = if (phase % 3) == 1 then 0.8 else 0.1; b : f32 = if (phase % 3) == 2 then 0.8 else 0.1; glViewport(0, 0, fc.pixel_w, fc.pixel_h); glClearColor(r, g, b, 1.0); glClear(GL_COLOR_BUFFER_BIT); g_uikit_plat.end_frame(); } main :: () -> void { plat : *UIKitPlatform = xx malloc(size_of(UIKitPlatform)); plat.init("SxUIKitPlatform", 0, 0); plat.run_frame_loop(closure(cycle_frame)); }