Code Monkey home page Code Monkey logo

termux-sdl's Introduction

termux-sdl

This is a termux sdl plugin for compiling and running SDL2 and native app.

How to running SDL2 and native activity program:

Download the Termux app, then execute the command pkg install clang

# compile examples
cd examples/SDL2/draw2

# create build directory
mkdir build && cd build

# execute cmake 
cmake ..

# start running
make run

# compile your own program, please refer to examples 


Using github actions to auto building debug app

If you want to use github actions to build debug app.
please fork this repository, then execute the command as below.

# clone your own repository
git clone https://github.com/your_repository/termux-sdl

# change to the termux-sdl directory
cd termux-sdl

# add a tag v2.5 v3.0 ..etc
git tag -a v3.0 -m "release 3.0 version" 

# push tag to trigger the github actions
# or you can modify the workflow file to change the trigger conditions
git push origin --tag

Using ffplay to play video and audio

At the same time, I added ffplay, so it can also be used as a local player.

ffplay has implemented a progress bar and time display.
swipe the left side of the screen to control the brightness, swipe the right side of the screen to control the volume.
the progress bar is drawn by SDL2_gfx, the time is drawn by SDL2_ttf.

# copy ffplay to /data/data/com.termux/files/usr/bin
cp example/SDL2/ffplay/ffplay /data/data/com.termux/files/usr/bin
chmod 755 /data/data/com.termux/files/usr/bin/ffplay

# play video
ffplay -i /sdcard/video/test.mp4

# play music whit 1.5x speed
ffplay -af atempo=1.5 -i /sdcard/music/hello.flac

# 2x speed playback
ffplay -af atempo=2.0 -vf setpts=1/2*PTS -i /sdcard/video/test.mp4

# play at any speed: atempo=x setpts=1/x*PTS

# no window title(set title is null)
ffplay -window_title -i /sdcard/video/test.mp4

# full screen
ffplay -fs -i /sdcard/video/test.mp4

How to use SDL_AndroidLogPrint method to print log click here for example.


Issues

  • There are still some problems with ffplay, when playing at playback speed, drag the progress bar, the time is inaccurate, and the video and audio are not synchronized.

  • You can also add some external libraries, such as libx264 libx265 fdk-aac etc, to better support ffplay.

termux-sdl's People

Contributors

lzhiyong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

termux-sdl's Issues

question

how to use it on proot-distro virtualized environment?

too dumb to figure out how to use graphics in Termux

ok , so i want to use sdl2 ta draw some graphics , anything would do even a simple red rectangle.
i guess you can do that with C++ and sdl right ? so what exactly do i need to do ?
like what apps do i need to install to see the graphical output ? and just tell me every steps

Example won't run, please advise.

So, I have gone through the install process on Termux, built the example as described in the reader, but get the following error when I do the "make run " step.

I'd appreciate it if you would be kind enough to tell me what I have done wrong if it is an obvious error on my part.

Thanks!

~/.../draw2/build $ ls CMakeCache.txt Makefile libdraw2.so CMakeFiles cmake_install.cmake ~/.../draw2/build $ make run [ 66%] Built target draw2 grep: warning: stray \ before - [100%] start running SDL2 program draw2 Starting: Intent { cmp=com.termux.sdl/.TermuxSDLActivity (has extras) } Error type 3 Error: Activity class {com.termux.sdl/com.termux.sdl.TermuxSDLActivity} does not exist. make[3]: *** [CMakeFiles/run.dir/build.make:71: CMakeFiles/run] Error 2 make[2]: *** [CMakeFiles/Makefile2:110: CMakeFiles/run.dir/all] Error 2 make[1]: *** [CMakeFiles/Makefile2:117: CMakeFiles/run.dir/rule] Error 2 make: *** [Makefile:137: run] Error 2

Examples fail to run

This is a great work.

I haven't yet gotten any examples to run.

When I launch termux-sdl I see a rapidly spinning cube.
If I then do make run in draw2/build or drawchessboard/build or showimage/build, I see a slowly spinning cube regardless which example I ran.
If I close termux-sdl, and then do make run, it opens the app and immediately closes. If I return to termux-sdl manually from the app switcher, it immediately closes again. If I relaunch it from the home screen manually, I see a rapidly spinning cube.

If I do make run in native/plasma/build and termux-sdl is already running, I see a slowly spinning cube. If I close termux-sdl and try again, I see an empty window with the title "termux-native". There is no content to the window and no menu to view a log. I get the same empty window for vulkan/build and colors/build.

Those are all the examples I've tried so far.

I'm just on an android phone right now, so I don't have a logcat or anything, I'm sorry. The phone is a BBB100-1 running Android 8.1.0 and kernel 3.18.71-perf-gc7467a0 aarch64.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.