-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: forgot sdl_main module for android
- Loading branch information
1 parent
b4cf9b5
commit bef73c3
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |