Open pachuco opened 7 months ago
If you want to draw using the CPU, this is the right approach. The TGUI_EVENT_CONFIG
event can give you the current Activity size, you can request the initial size with tgui_activity_get_configuration
. Buffers are created with tgui_add_buffer
and have to be deleted with tgui_delete_buffer
, otherwise you'll leak memory. To change the buffer you'd create a new buffer with the right size, set the ImageView to display that buffer, refresh the ImageView, and finally delete the old buffer.
If you want me to review more of your code, you should use less swearwords for variables.
https://gist.github.com/pachuco/4c769f1a55d1745fd38b76ea445ed3cc/a32a529b49dcef579641701c5b90e0b64a4e6a9b Ok, now I'm cooking with gas! There is now issue where turning the phone will sometimes not update dimensions accordingly(buffer displayed as mailboxed image). Maybe I should be using surface view instead?
If you want me to review more of your code, you should use less swearwords for variables. Since I am in position of beggar and not chooser, it's a fair trade. I cleaned the code. Haha, you should see VibeJive project on my git for cringe-inducing 2010-era namings!
If I clean it up sufficienly, maybe I can submit it later as PR, before taking code in my direction.
Do the config events with the correct dimensions arrive?
SurfaceView is for Android 8.0+, and you can use it with CPU rendering, though the intended use case is GPU rendering.
What is the lifecycle of a buffer and how do I change the buffer in case of screen orientation change(treating it like "windows has changed size, new buffer needed" on desktop)? tgui_create_image_view(), is this even the right type of view I need?
Basically I want to create bitmap gui that always occupies full screen and handles rotation.
https://gist.github.com/pachuco/4c769f1a55d1745fd38b76ea445ed3cc/fd91f9747c7694ef19c01ce1b9faaa8d103c0e83 This is my code so far. Feel free to poke at other deficiencies.