choice idle background not visible in Android build

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Nasedo
Newbie
Posts: 7
Joined: Sun Dec 31, 2017 8:50 am
Completed: nothing so far
Projects: Back to the school
Location: London, UK
Contact:

choice idle background not visible in Android build

#1 Post by Nasedo »

Welcome!

My first post and first problem. I'm using Pen'Py for couple months already, most of the things are perfectly clear for me but, I have one problem. I will try to describe it as it is.

When I'm testing game (Windows) and building Windows distribution - everything is fine, as meant to be. But today, just for my curiosity I tried to build Android release and test it. Everything is working fine... but Choice Menu is not displaying it's background.

Obviously I have the following files as in Windows version I have no problems at all.
gui/button/choice_idle_background.png
gui/button/choice_hover_background.png

I changed those for non-transparent ones, it didn't help. Those backgrounds are not visible and choosing anything from Choice Menu is really hard. I tried to change colour and helps a bit, but using different background colours whatever colour I pick, is not visible or barely visible.

Anyone could help me? I will appreciate any tips.

Btw. Pen'Py is excellent, I'm really proud I choosed Ren'Py as my VN engine. I compared with VN Maker and Tyrano Builder - and honestly Ren'Py wins!

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: choice idle background not visible in Android build

#2 Post by PyTom »

Can you put together a short demo of the problem, and post it?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Nasedo
Newbie
Posts: 7
Joined: Sun Dec 31, 2017 8:50 am
Completed: nothing so far
Projects: Back to the school
Location: London, UK
Contact:

Re: choice idle background not visible in Android build

#3 Post by Nasedo »

This is one of the examples:

Code: Select all

menu:
    "Question?"
    
    "Answer 1":
        jump a1label
    
    "Answer 2":
        jump a2label
As I mentioned, it's a simplest menu to create. Everything works fine on PC (Windows 7 / 8.1) 32 / 64bit. Only when I building Android distribution, there's no background in menu - it's completely transparent. Only text is visible on the screen.
PC version has background and its colour displayed properly.

Menu works fine on both platforms - Android and Windows, but on Android is barely readable (due lack of background).

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: choice idle background not visible in Android build

#4 Post by Remix »

Which release of Ren'py are you using? (click the [About] button on the development Launcher, base middle)

Without seeing your gui.rpy (to see all the style hierarchy that choices might use) and screens.rpy (to see that all those styles cascade properly) we'd just be guessing until we can run up an apk and reproduce the same error.

As a step to help focus debugging, could you try an apk with slight changes to screens.rpy?
Basically, hard-code the button backgrounds into the screen choice...

Code: Select all

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            textbutton i.caption:
                action i.action
                background "gui/button/choice_idle_background.png" # if these are Frames or somesuch, adjust as needed
                hover_background "gui/button/choice_hover_background.png"
That code basically just tells Ren'py to ignore the style hierarchy and just use the defined images instead, so it might circumnavigate the problem. If it does, the issue lies somewhere in how (whichever version of Android) interprets the style in (whichever version of Ren'py)
Frameworks & Scriptlets:

User avatar
Nasedo
Newbie
Posts: 7
Joined: Sun Dec 31, 2017 8:50 am
Completed: nothing so far
Projects: Back to the school
Location: London, UK
Contact:

Re: choice idle background not visible in Android build

#5 Post by Nasedo »

I'm using 6.99.13.2919

My gui.rpy and screens.rpy weren't altered at all. Both files are default.

I tried to implement your advice, it's a little bit better than before (on Android), however:

Code: Select all

menu:
    "What happen if the answer will be longer than one line?"
    
    "I'm afraid only first line of the choice will have its background but second line will have a transparent background":
        jump a1label
    
    "It will be disaster.":
        jump a2label
As I wrote in my code - this could be a temporary solution. It ruins both versions, PC and Android.

Android:
1. If the choice will be longer than one line, pre-defined background will cover only first line.
2. Background will not appears centrally, but its aligned to the left.

PC / Windows:
1. If the choice will be longer than one line, pre-defined background will cover only first line. With default settings choice backgrounds being enlarged to the size of choice.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: choice idle background not visible in Android build

#6 Post by Remix »

Ok, so Android can find and use the file if it is hard-coded into the screens.rpy rather than determined through navigating the styles...

With it aligning to the left rather than centrally behind the text makes me think that Android (version N.N) is not attributing any styles to the button part of the textbutton and is only using them for the text part (a textbutton is basically just a text widget inside a button widget).

To quick-fix it, you'd have to pretty much go through all the style declarations in gui.rpy for 'gui.choice...' and 'gui.button...' , decide if they affect the background and then hard-code those into screen choice - adding additional 'background_{style}' (or is it 'button_{style}'?) ones to adjust it (e.g. background_xalign 0.5 and (at a guess) background_xfill True).

This should likely be listed as a bug, especially as it affects a recent release of Ren'py

What version of Android is your test misbehaving on?
Frameworks & Scriptlets:

User avatar
Nasedo
Newbie
Posts: 7
Joined: Sun Dec 31, 2017 8:50 am
Completed: nothing so far
Projects: Back to the school
Location: London, UK
Contact:

Re: choice idle background not visible in Android build

#7 Post by Nasedo »

Remix wrote: Mon Jan 01, 2018 7:58 am With it aligning to the left rather than centrally behind the text makes me think that Android (version N.N) is not attributing any styles to the button part of the textbutton and is only using them for the text part (a textbutton is basically just a text widget inside a button widget).

To quick-fix it, you'd have to pretty much go through all the style declarations in gui.rpy for 'gui.choice...' and 'gui.button...' , decide if they affect the background and then hard-code those into screen choice - adding additional 'background_{style}' (or is it 'button_{style}'?) ones to adjust it (e.g. background_xalign 0.5 and (at a guess) background_xfill True).

This should likely be listed as a bug, especially as it affects a recent release of Ren'py

What version of Android is your test misbehaving on?
Aligning to the left is not only one problem as I reported. As my choices could be one-lined or two-lined, in my opinion I can't create any particular style. Correct me please if I'm wrong. Then if I use constant width of this background, I cannot (or I don't know how) create two backgrounds having different height depending on length of the text given in the choice. I'm not sure if I confused you more.

I have only one Android phone with OS version 6.0 (upgrade is not possible).

I think the temporary solution is create blank (black) background - cut scene and choice menu display on this background, make choice and return back to the scene or jump to another if its related with choice made.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: choice idle background not visible in Android build

#8 Post by Remix »

The
button_xfill True
hard-coded as a setting in screens.rpy *might* make the background scale for multi-line choices (then again it *might* make it fill the screen - maybe someone else knows the correct style to add).
Alternatively, you could set the background as a Frame rather than image, which *should* scale to cover multi-line

Code: Select all

            textbutton i.caption:
                action i.action
                background Frame("gui/button/choice_idle_background.png", 20, 0) # if these are Frames or somesuch, adjust as needed
                hover_background Frame("gui/button/choice_hover_background.png", 20, 0)
                # optional
                focus_mask Frame("gui/button/choice_idle_background.png", 20, 0) # make the frame clickable/sensitive
                size_group "uniform_width_choices"
                xmaximum 760 # max width
                # etc
note: some might need 'button_' as a prefix... mid code elsewhere, so no time to test
Frameworks & Scriptlets:

algvil
Newbie
Posts: 1
Joined: Mon Feb 12, 2018 10:57 am
Contact:

Re: choice idle background not visible in Android build

#9 Post by algvil »

I fix it with:

screen choice(items):
style_prefix "choice"
vbox:
for i in items:
textbutton i.caption action i.action background gui.choice_menu_background

in screens rpy

and

define gui.choice_menu_background = "gui/button/choice_hover_background.png"
in gui.rpy

User avatar
apexchimps
Regular
Posts: 29
Joined: Mon Jan 25, 2016 6:12 pm
Completed: Detective Max, Nick's Night Out!, Arthur & Susan: Almost Detectives
Projects: Arthur & Susan: Almost Detectives
Contact:

Re: choice idle background not visible in Android build

#10 Post by apexchimps »

Hi,

I came accross this same bug. I fixed it by copying choice_idle_background.png:

From: game\gui\button
To: game\gui\phone\button

It has been driving me crazy for days.

Hope it helps.

Best regards!

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: choice idle background not visible in Android build

#11 Post by Imperf3kt »

apexchimps wrote: Sun Oct 21, 2018 3:41 pm Hi,

I came accross this same bug. I fixed it by copying choice_idle_background.png:

From: game\gui\button
To: game\gui\phone\button

It has been driving me crazy for days.

Hope it helps.

Best regards!
This is the same fix I found and reported a while back.
It does not seem to be fixed yet.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

jwilliams77
Newbie
Posts: 21
Joined: Sun Apr 19, 2015 8:35 pm
Contact:

Re: choice idle background not visible in Android build

#12 Post by jwilliams77 »

Confirming latest version of Ren'py still has this bug; ironically I found this was an issue by watching a 2 year old video of my game on youtube with an android port I didn't create lol.

Copying the file works (at least solved the menu issue for me) so thank you very, very much for posting a fix to solve the menu lacking the background images. The text was near impossible to read without.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]