New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question]How to integrate SDL2 #14
Comments
I have a demo with SDL through ctypes in the python bindings tutorial. Using it directly with C/C++ should be easier, but I haven't finished the C/C++ library yet. My roadmap to that currently is:
|
Thank you for your reply, looking forward to developing games and videos directly using c/c++, such as ffmpeg and SDL2 etc. |
If you want to develop games, I also want to include something like a direct rendering feature. Android 8.0+ supports something called Native Hardware Buffers. These are buffers that live in graphics memory and that can be passed around between programs. I want to make it possible that the plugin just continuously displays the contents of a Native Hardware Buffer and the client gets a reference and can create an OpenGL drawing surface with it. That way you can use graphics acceleration and it doesn't need any additional copying of the image. |
Yes, your way is very flexible for debugging native graphics programs, because there is no need to compile and generate an apk every time and then install it to check the running status. |
Hello, I also have some questions regarding the cpp plugin. |
SDL support would either require the game to be modified (to support drawing to the provided buffer and receiving events properly) or an additional backend to be added to the SDL in the Termux repositories. |
How hard will be the first one? Will it be just changing a few lines or modifying every SDL call in the game. |
Converting the plugin events to SDL events should be easy, but I don't know how exactly GLES works with SDL. SDL will probably throw an error when trying to create a window, you need to receive the buffer to draw to from the plugin as an AHardwareBuffer, get the image from that, construct a framebuffer with that image and bind GLES to that framebuffer. Keep in mind I haven't worked with GLES or SDL myself. |
@captain1947 The C library is now mostly finished, with an example for GLES integration: https://github.com/tareksander/termux-gui-c-bindings/blob/main/tutorial/c/buffer_gl.c |
Sorry for replying late, I finally got time to check it but sadly it doesn't do what I wanted. The rendering part doesn't need to be changed and sdl can draw on the framebuffer you expose but the problem lies in the input part. The only way to get input is by using your api. The sdl input api isn't working. Instead I am looking forward to another project by you (termux-gfx-wrapper). |
I'm also working on a custom Wayland compositor build on Termux:GUI, that will solve the input problem, and will have support for termux-gfx-wrapper. The goal is to have Linux apps integrate seamlessly into the Android experience. |
It's not an issue just asking for help, because I haven't studied your project in depth yet
I wonder if it is possible to support SDL2 with c/c++, I have seen someone using
termux-gui
andffplay.py
to play video.The text was updated successfully, but these errors were encountered: