Skip to content
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

[Feature Request]: [android] option to modify GUI joystick/buttons (e.g. make partially transparent/relocate on screen or shrink) #6992

Open
SugarRayLua opened this issue Feb 27, 2024 · 5 comments
Labels
enhancement New feature or request platform support

Comments

@SugarRayLua
Copy link

Feature Type

Touch Controls

Describe

Just starting playing DevilutionX on small Android phone (Titan Pocket). Overall plays well and although small, the main bottom display with menu, inv, spell works fine but the movement joystick, # of potions tracking circle and buttons are all much larger and take up most of the central screen making it difficult to see the player and the rest of the screen. (Controls work fine and correct proportion when playing on my iOS tablet). Would it be possible to add and option to either make the joystick or the buttons/potion tracking circle partially transparent or allow the player to either shrink the size of those controls or relocate them on the screen (e.g. choose to perhaps move them to more to or right of the screen)?

I realize may be difficult to accommodate the multiple possible screen sizes.

Thanks for considering.

@SugarRayLua SugarRayLua added the enhancement New feature or request label Feb 27, 2024
@julealgon
Copy link
Contributor

Pretty sure there are plans to make the GUI eventually fully customizable via lua scripts or some other mechanism.

Related:

@SugarRayLua
Copy link
Author

Thanks, @julealgon, that would be great! Attached is what it looks like currently on my android device 🙁
Screenshot_20240227-080756

@StephenCWills
Copy link
Member

FYI, if you are willing and able to create your own build, you can modify the size and position easily enough. It's all computed based on dpi in this location.

int screenPixels = std::min(gnScreenWidth, gnScreenHeight);
int inputMargin = screenPixels / 10;
int menuButtonWidth = screenPixels / 10;
int directionPadSize = screenPixels / 4;
int padButtonSize = roundToInt(1.1 * screenPixels / 10);
int padButtonSpacing = inputMargin / 3;
float hdpi;
float vdpi;
int displayIndex = SDL_GetWindowDisplayIndex(ghMainWnd);
if (SDL_GetDisplayDPI(displayIndex, nullptr, &hdpi, &vdpi) == 0) {
int clientWidth;
int clientHeight;
if (renderer != nullptr)
SDL_GetRendererOutputSize(renderer, &clientWidth, &clientHeight);
else
SDL_GetWindowSize(ghMainWnd, &clientWidth, &clientHeight);
hdpi *= static_cast<float>(gnScreenWidth) / clientWidth;
vdpi *= static_cast<float>(gnScreenHeight) / clientHeight;
float dpi = std::min(hdpi, vdpi);
inputMargin = roundToInt(0.25 * dpi);
menuButtonWidth = roundToInt(0.2 * dpi);
directionPadSize = roundToInt(dpi);
padButtonSize = roundToInt(0.3 * dpi);
padButtonSpacing = roundToInt(0.1 * dpi);
}

I had originally thought to make these parameters adjustable in the INI, but never really got around to it. Now we have Lua so I'm hoping to get started on customizing the UI soon. I think converting the touch controls to Lua would be a great start.

@SugarRayLua
Copy link
Author

Thanks, @StephenCWills ! That looks straightforward enough. I'm not a C programmer but have an online friend who is and has Android so will see if I can work with him. I do program in Lua so if can't get the build working will look out for your Lua UI customization 👍😊

@julealgon
Copy link
Contributor

@SugarRayLua
I do program in Lua

Name checks out 😂 (....sorry, couldn't resist Reddit-level joke)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request platform support
Projects
None yet
Development

No branches or pull requests

4 participants