Forums

OverviewV-Play 1 Support › Android APK Version of App is Wrong

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #7192

    Preston

    Hi,

    I’ve converted the filename to ascii and have finally built the APK for my App.

    After testing it on a actual Samsung device, I’ve found:

    1.) The characters are not showing properly.  Therefore there is a font problem.  This problem does not show when I’m using the desktop.

    Here is an example of the kind of fonts I should see:

    ཀ    ཁ    ག    ང    ཅ     ཆ    ཇ    ཉ    ཏ    ཐ     ད    ན

    But instead of those texts, I am seeing a box with a x inside it….

    2.) On the scenes where I use a Flickable component, there are 2 problems:

    1.) The Scaling is wrong and it is not proportionate to the screen size and it is not the same as the desktop version’s scaling

    2.) The orientation and positioning of the item/items inside the Flickable is “off” from where it is suppose to be.

    The best way to understand what I’m saying is by checking my app in action.

    Kindly check out any of my recent builds and click on any of the options on the first screen.

    This is what you will observe:

    1.) If you click on any of the options you will see that the font is off

    2.) If you choose “Five Vowels”, this is a good example of the right scaling and positioning I want, but this Scene does not use Flickable.

    3.) If you choose any except “Thirty Consonants” and “Five Vowels” then you will see what I mean about scaling and positioning being off, probably due to Flickable.

    This is a sample template that I use across those “Scenes” using Flickable:

    Am I using Flickable incorrectly???? How should I use it???  How do I fix the font problem????

    Thank you…..

    // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
    import QtQuick 1.1
    import VPlay 1.0
    
    SceneBase {
    
        property bool onOrOff
        onOnOrOffChanged: {
            toggleSplBtn.color = (onOrOff == true) ? "red" : "darkblue"
        }
    
        Sound {
            id: soundChosen
        }
    
        SimpleButton {
            id: toggleSplBtn
            anchors.top: parent.top
            anchors.right: parent.right
    
            z: 10
    
            text: "Spell"
    
            Component.onCompleted: {
                if(onOrOff == true){
                    toggleSplBtn.color = "red"
                }else{
                    toggleSplBtn.color = "darkblue"
                }
            }
    
            onClicked: {
                onOrOff = !onOrOff
                console.debug(onOrOff)
            }
        }
    
        SimpleButton {
            anchors.left: parent.left
            anchors.bottom: parent.bottom
    
            text: "Back"
            z: 10
    
            onClicked: {
                console.debug("BACK TO MAIN MENU")
                window.state = "menu"
            }
        }
    
        Flickable {
            id: flickable
    
            //contentY: 100
            interactive: true
            flickableDirection: flickable.VerticalFlick
            anchors.fill: parent
            //width: 200
            //height: 200
            contentWidth: parent.width
            //contentHeight: 1000
    
            Scene {
                id: movableScene
    
                EntityManager {
                    id: entityManager
                    entityContainer: movableScene
                }
    
                property url jsonFile: "json/ThirtyConsonantsWithVowels.json"
    
                Component {
                        id: btnComp
    
                        EntityBase {
    
                            id: entityBaseX
    
                            property int index: 1
                            property string character
                            property double spacing: 50
                            property double widthValue: 40
                            property double heightValue: 40
                            property double numOfCol: 8
                            property double widthOfSet: numOfCol * spacing
    
                            entityId: index
                            entityType: "buttonEntity"
                            SimpleButton {
                                id: btn
    
                                property int col: index % numOfCol + 1
                                property int row: Math.floor(index / numOfCol) + 1
    
                                x: col * spacing + (parent.parent.width -  widthOfSet)/2 - spacing + (spacing - widthValue)/2
                                y: row * spacing
    
                                width: widthValue
                                height: heightValue
    
                                //text: col + "/" + row
                                text: character
    
                                property url jsonAudioFile: "json/TibUnicodeToDecimal.json"
                                onClicked: {
                                    console.debug("button " + btn.text + " clicked")
    
                                    var data = fileUtils.readFile(jsonAudioFile)
    
                                    var jsonObj = JSON.parse(data)
                                    console.debug("jsonObj")
                                    console.debug(jsonObj)
                                    console.debug(jsonObj[btn.text])
    
                                    var filename = jsonObj[btn.text]
    
                                    if(onOrOff){
                                        soundChosen.source = "snd/" + filename + "-complete" + ".wav"
                                        soundChosen.play()
    
                                    }else{
                                        soundChosen.source = "snd/" + filename + ".wav"
                                        soundChosen.play()
    
                                    }
                                    console.debug(soundChosen.source)
                                }
                            }
                            Component.onCompleted: console.debug("btn created " + index)
                        }
                }
    
                Component.onCompleted: {
                    console.debug("Flickable - Component.onCompleted")
                    console.debug(jsonFile)
                    console.debug("inside consonantsPlusVowels")
                    var data = fileUtils.readFile(jsonFile)
                    console.debug(data)
    
                    var jsonObj = JSON.parse(data)
                    console.debug("jsonObj")
                    console.debug(jsonObj)
    
                    for(var i = 0; i < jsonObj.length; i++)
                    {
                        console.debug(jsonObj[i])
                        entityManager.createEntityFromComponentWithProperties(btnComp, {index: i, character: jsonObj[i]})
                        console.debug("create button")
                    }
    
                    var entity = entityManager.getEntityById(1)
                    console.debug("numOfCol ****************")
                    console.debug(entity.numOfCol)
    
                    var numOfRow = jsonObj.length / entity.numOfCol
    
                    var size = numOfRow * entity.spacing + entity.spacing + entity.spacing
                    flickable.contentHeight = size
                }
            }
        }
    }
    

     

    • This topic was modified 4 years, 4 months ago.
    #7195

    Christian
    V-Play Team

    Hi bliss,

    I have two suggestions you could try before investigating any further:

    • Scenes are for handling of different screen sizes and proportions. You should always have scenes as top level items in your game window. Please do not put another Scene object inside a Scene (as is in your Flickable). You can just use Item there.
    • If the Flickable should be scrolling up and down, the vertical direction is set correctly, but you also need to set the height of the content (like the commented out property contentHeight, you could try with contentHeight: childrenRect.height

    You can test it on desktop with the shortcut keys 1-6 on the keyboard, this will resize the window in common smartphone/tablet sizes.

    Hope this helps!

    Cheers,
    Chrisu

    #7196

    Preston

    Hi Chrisu,

     

    Thank you for your excellent way of explaining and guiding.

    I have taken out the Scene inside the Flickable and changed it to Item.

    I also set the contentHeight as childrenRect.height.

    It’s now working correctly in terms of positioning and scaling…

    Now only the Font problem remains.

    Thank you.

     

    #7198

    Christian
    V-Play Team

    Hi again,

    no problem, I’m glad you got it to work.

    The font problem will be a bit harder to solve I’m afraid. Not all characters are supported on Android’s default fonts.

    V-Play (Qt itself, actually) supports loading your own fonts with FontLoader – http://qt-project.org/doc/qt-4.8/qml-fontloader.html

    You could try finding a font that supports all characters and loading it from your app’s resouces, I think that would work.

    But maybe it’s just an encoding problem – see this StackOverflow post for example.

    I hope you will find a solution!

    Cheers,
    Chrisu

    #7200

    Preston

    Hi Chrisu

     

    Thank you very much.  Your advise is right on the dot.

    FontLoader did work for me perfectly.

     

    Thank you.

Viewing 5 posts - 1 through 5 (of 5 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support