Skip to content

Commit

Permalink
fix: forgot sdl_main module for android
Browse files Browse the repository at this point in the history
  • Loading branch information
markkimsal committed Sep 29, 2024
1 parent b4cf9b5 commit bef73c3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions zig-src/src/sdl_main.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const std = @import("std");
pub const sdl = @cImport({
@cInclude("SDL.h");
@cInclude("SDL_image.h");
@cInclude("SDL_ttf.h");
@cInclude("SDL_mixer.h");
});
const zig_main = @import("main.zig").main;


pub export fn SDL_main_zig() callconv(.C) i64 {

var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
defer _ = gpa.deinit();

// Parse args into string array (error union needs 'try')
const args = std.process.argsAlloc(allocator) catch {
return -1;
};
defer std.process.argsFree(allocator, args);

// Get and print them!
std.debug.print("There are {d} args:\n", .{args.len});
for(args) |arg| {
std.debug.print(" {s}\n", .{arg});
}
zig_main() catch {
return -1;
};
return 0;
}

0 comments on commit bef73c3

Please sign in to comment.