Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

SDL2 Example

This is a copy-paste of Andrew Kelly's SDL Zig Demo but running on Android. The build is setup so you can also target your native operating system as well.

Build and run natively on your operating system or install/run on Android device

zig build run           # Native
zig build run -Dandroid # Android

Build, install to test one target against a local emulator and run

zig build -Dtarget=x86_64-linux-android
adb install ./zig-out/bin/sdl-zig-demo.apk
adb shell am start -S -W -n com.zig.sdl2/com.zig.sdl2.ZigSDLActivity

Build and install for all supported Android targets

zig build -Dandroid=true
adb install ./zig-out/bin/sdl-zig-demo.apk

Uninstall your application

If installing your application fails with something like:

adb: failed to install ./zig-out/bin/sdl2.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.zig.sdl2 signatures do not match newer version; ignoring!]
adb uninstall "com.zig.sdl2"

View logs of application

Powershell (app doesn't need to be running)

adb logcat | Select-String com.zig.sdl2:

Bash (app doesn't need running to be running)

adb logcat com.zig.sdl2:D *:S

Bash (app must be running, logs everything by the process including modules)

adb logcat --pid=`adb shell pidof -s com.zig.sdl2`