is it possible to use a splashscreen on Android? didnt fount anything here (http://felgo.com/doc/vplay-deployment/)
Tagged: Android, splashscreeen
-
AuthorPosts
-
January 24, 2014 at 19:27 #6514
Felgo User
January 25, 2014 at 01:41 #6517
Michael
I’m pretty sure your question was asked previously on this forum, and the answer then was no.
Cheers, Michael.
January 25, 2014 at 01:43 #6519
Felgo User
ok, without search hard to find 😉
thanks anyway.
will this implemented in the near future?
January 26, 2014 at 12:17 #6531
Michael
@phips28, FYI, I found the android spashscreen info I referred to in my previous post in the link here
If it works for you, please let me know as I’m interested too.
January 26, 2014 at 14:14 #6533
Felgo User
hmm, i know this already. but the screen on the android device will be black till the whole scene finished loading. no alternative for me. :/
January 26, 2014 at 14:19 #6534
Michael
I guess it’s ideal if v-play team can inject an optional loading screen/animation scene or component for us to hide the black or gap (so to speak).
January 26, 2014 at 14:20 #6535
Felgo User
yeah this would be great! a 2-5 sec blackscreen is not the best way to start a game 😀
January 26, 2014 at 16:35 #6538
Martin
we second that request! 😉
January 26, 2014 at 16:58 #6539
ChristianFelgo TeamHi,
you can implement a custom splash screen both on iOS & Android by loading a single scene first which shows your splash image or whatever. After that one is loaded, you can load your other scenes and thus not have a black image. This is done in Squaby and in the example folder in te MultiSceneMultiLevelDynamic project available since daily build v1.5.2.
Cheers, Chris
January 26, 2014 at 20:05 #6546
Felgo User
If i try this with 2 Timer and 2 Loader in the main.qml like in squaby, the SplashScreen appears. but the window size is wrong. (only on android, on desktop and ios all is fine) see images:
Phone: https://www.dropbox.com/s/4kjdz15o73qt06l/phone.JPG
Tablet: https://www.dropbox.com/s/5lry2xix52bjm8m/tablet.JPG
main.qml:
import VPlay 1.0 import QtQuick 1.1 // Plugins import VPlay.plugins.gamecenter 1.0 import VPlay.plugins.flurry 1.0 import VPlay.plugins.facebook 1.0 import VPlay.plugins.store 1.0 import "base" import "values" import "entities" import "gnView" // add this for Meego, to fix the portrait mode issue there //import com.nokia.meego 1.0 //Page { // main with Android Splashscreen GameWindow { id: window // depending on which window size is defined as start resolution here, the corresponding image sizes get loaded here! so for testing hd2 images, at least use factor 3.5 // the window size can be changed at runtime by pressing the keys 1-6 (see GameWindow.qml) width: 480*2//*1.5//854// // for testing on desktop with the highest res, use *1.5 so the -hd2 textures are used height: 320*2//*1.5//480// displayFpsEnabled: false fpsTextItem.color: "white" state: "main" // use BackgroundMusic for long-playing background sounds BackgroundMusic { id: backgroundMusic source: system.isPlatform(System.Meego) || system.isPlatform(System.Symbian) ? "snd/bg-slow-mono.ogg" : "snd/bg-slow.wav" // muted: settings.soundEnabled } // Custom font loading of ttf fonts FontLoader { id: fontHUD source: "fonts/MoonFlowerBold.ttf" } Timer { id: splashScreenOff repeat: false interval: system.isPlatform(System.IOS) ? 0 : 1000 onTriggered: { if(splashLoader.item) { splashLoader.item.exitScene() } } } Timer { id: startLoading repeat: false interval: system.isPlatform(System.IOS) ? 0 : 500 // on iOS start in 0ms onTriggered: { // load actual game implLoader.source = "MainItem.qml" } } Connections { target: splashLoader.item ? splashLoader.item : null onLoadingFinished: { if(implLoader.item) { implLoader.item.activateMain() } // unload splashscreen splashLoader.source = "" } } Loader { id: splashLoader source: "SplashScreen.qml" onLoaded: { if(item) { item.enterScene() loadItemWithCocos(item) } startLoading.start() } } Loader { id: implLoader onLoaded: { console.log("implLoader onLoaded") if(item) { loadItemWithCocos(item) splashScreenOff.start() } } } onStateChanged: { if(implLoader.item) implLoader.item.state = state } } //} // add this when building for MeeGo
MainItem.qml:
import VPlay 1.0 import QtQuick 1.1 // Plugins import VPlay.plugins.gamecenter 1.0 import VPlay.plugins.flurry 1.0 import VPlay.plugins.facebook 1.0 import VPlay.plugins.store 1.0 import "base" import "values" import "entities" import "gnView" // add this for Meego, to fix the portrait mode issue there //import com.nokia.meego 1.0 //Page { Item { // width: 480*2 // height: 320*2 function activateMain() { // fade in state = "main" } property alias level: scene.level property alias player: scene.player // start position of the player property int startPositionX: 70 property int startPositionY: 60 // for loading the stored highscore property int maximumHighscore: 0 property int lastScore: 0 property variant levelScores: ({}) property variant currentSelectedLevel: ({}) // stores the levelPack datas LevelPacks{ id:levelPacks } property variant currentSelectedPack: ({}) // no ads purchase property bool purchasedNoAdsPackage: noadsGood.purchased Component.onCompleted: { // get called if the whole scene is loaded finished, and repeater is finished // Authenticate player to gamecenter gameCenter.authenticateLocalPlayer() if(system.debugBuild) settings.language = "en_EN" else { // enable System language for translations translation.useSystemLanguage = true } console.debug("current language:", settings.language) // Sheduling needs to be turned off on iOS, Android and Mac to avoid small lags during fast movement. if(system.isPlatform(System.IOS) || system.isPlatform(System.Mac) || system.isPlatform(System.Android) ) { vplayScheduler.schedulingMethod = VPlayScheduler.None } console.debug("Component.onCompleted") // Copy/paste into csv file for setting up in-app purchases in platform stores // console.debug(store.printStoreProductLists()) nativeUtils.displayMessageBox("debug","width"+width+", height"+height+", mainScene.width"+mainScene.width+", mainScene.height"+mainScene.height) // load the leveldata with a timer, otherwise the app start will be blocked for the loading time(1sec) //initializeAll.start() } Â // functions.... onLevelScoresChanged: { } onMaximumHighscoreChanged: { var storedScore = settings.getValue("maximumHighscore") console.debug("onMaximumHighscoreChanged: settings.highscore from", storedScore, "to", maximumHighscore) // if not stored anything yet, store the new value // or if a new highscore is reached, store that // if the same score is submitted, call reportScore() too to update the score on GameCenter if(!storedScore || maximumHighscore > storedScore) { console.debug("onMaximumHighscoreChanged: stored improved highscore from", storedScore, "to", maximumHighscore) settings.setValue("maximumHighscore", maximumHighscore) // this call posts the highscore both to Felgo Game Network and GameCenter, because gameCenterItem is set in VPGN gameNetwork.reportScore(maximumHighscore) } } LevelEditor { id: levelEditor applicationJSONLevelsDirectory: "JSONLevels/" } // // use BackgroundMusic for long-playing background sounds // BackgroundMusic { // id: backgroundMusic // source: system.isPlatform(System.Meego) || system.isPlatform(System.Symbian) ? "snd/bg-slow-mono.ogg" : "snd/bg-slow.wav" // // muted: settings.soundEnabled // } // if star collieded Sound { id: starSound source: "./snd/pling.wav" } // other item plugins // this scene is set to visible when loaded initially, so its opacity value gets set to 1 in a PropertyChange below MainScene { id: mainScene // when opacity is 0, visible gets set to false in SceneBase opacity: 0 } GrumpyDudeScene { id: scene // when opacity is 0, visible gets set to false in SceneBase opacity: 0 onVisibleChanged: console.debug("GameScene changed visible to", visible) } GameOverScene { id: gameOverScene // when opacity is 0, visible gets set to false in SceneBase opacity: 0 } LevelSelectScene { id: levelSelectScene onLevelPressed: window.state = "game" // when opacity is 0, visible gets set to false in SceneBase opacity: 0 } LevelFinishedScene { id: levelFinishedScene // when opacity is 0, visible gets set to false in SceneBase opacity: 0 } CreditsScene { id: creditsScene // when opacity is 0, visible gets set to false in SceneBase opacity: 0 } HelpScene { id: helpScene // when opacity is 0, visible gets set to false in SceneBase opacity: 0 } VPlayGameNetworkScene { id: vplayGameNetworkScene opacity: 0 } LevelEditorScene { id: levelEditorScene opacity: 0 } LevelPackScene { id: levelPackScene opacity: 0 } // for creating & removing entities EntityManager { id: entityManager entityContainer: scene poolingEnabled: true // entity pooling works since version 0.9.4, so use it // required for LevelEditor, so the entities can be created by entityType dynamicCreationEntityList: [ Qt.resolvedUrl("entities/Platform.qml"), Qt.resolvedUrl("entities/Goal.qml"), Qt.resolvedUrl("entities/Star.qml")] } // this gets used for analytics, to know which state was ended before property string lastActiveState: "" onStateChanged: { console.debug("GrumpyDudeMain: changed state to", state) if(state === "main") activeScene = mainScene else if(state === "game") activeScene = scene else if(state === "gameOver") activeScene = gameOverScene else if(state === "levelFinished") activeScene = levelFinishedScene else if(state === "credits") activeScene = creditsScene else if(state === "gameNetwork") activeScene = vplayGameNetworkScene else if(state === "selectLevel") activeScene = levelSelectScene else if(state === "levelEditing") activeScene = levelEditorScene else if(state === "help") activeScene = helpScene else if(state === "selectLevelPack") activeScene = levelPackScene if(lastActiveState === "main") { flurry.endTimedEvent("Display.Main") } else if(lastActiveState === "game") { flurry.endTimedEvent("Display.Game") // NOTE: Android doesnt support endTimedEventWithParams yet!?! http://stackoverflow.com/questions/12205860/android-flurry-and-endtimedevent //flurry.endTimedEvent("Display.Game", { "score": lastScore, "collectedStars" : player.collectedStars, "scoreForStars": player.collectedStars*player.bonusScoreForStar }) // thus emit them with own events } else if(lastActiveState === "gameOver") { flurry.endTimedEvent("Display.GameOver") } else if(lastActiveState === "levelFinished") { flurry.endTimedEvent("Display.LevelFinished") } else if(lastActiveState === "credits") { flurry.endTimedEvent("Display.Credits") } else if(lastActiveState === "gameNetwork") { flurry.endTimedEvent("Display.VPlayGameNetwork") } else if(lastActiveState === "selectLevel") { flurry.endTimedEvent("Display.LevelSelect") } else if(lastActiveState === "levelEditing") { flurry.endTimedEvent("Display.LevelEditor") } else if(lastActiveState === "help") { flurry.endTimedEvent("Display.Help") } else if(lastActiveState === "selectLevelPack") { flurry.endTimedEvent("Display.LevelPack") } if(state === "main") { flurry.logTimedEvent("Display.Main") } else if(state === "game") { flurry.logTimedEvent("Display.Game") } else if(state === "gameOver") { flurry.logTimedEvent("Display.GameOver") } else if(state === "levelFinished") { flurry.logTimedEvent("Display.LevelFinished") } else if(state === "credits") { flurry.logTimedEvent("Display.Credits") } else if(state === "gameNetwork") { flurry.logTimedEvent("Display.VPlayGameNetwork") } else if(state === "selectLevel") { flurry.logTimedEvent("Display.LevelSelect") } else if(state === "levelEditing") { flurry.logTimedEvent("Display.LevelEditor") } else if(state === "help") { flurry.logTimedEvent("Display.Help") } else if(state === "selectLevelPack") { flurry.logTimedEvent("Display.LevelPack") } lastActiveState = state } state: "main" // use one of the following states to start with another state when launching the game // state: "game" //state: "gameOver" // these states are switched when the play button is pressed in MainScene, when the game is lost and when the Continue button is pressed in GameOverScene states: [ State { name: "main" // by switching the propery to 1, which is by default set to 0 above, the Behavior defined in SceneBase takes care of animating the opacity of the new Scene from 0 to 1, and the one of the old scene from 1 to 0 PropertyChanges { target: mainScene; opacity: 1} }, State { name: "game" PropertyChanges { target: scene; opacity: 1} StateChangeScript { script: { console.debug("entered state 'game' with levelId: '"+currentSelectedLevel.levelId+"': "+JSON.stringify(currentSelectedLevel)) scene.state = "" scene.enterScene(); } } }, State { name: "gameOver" PropertyChanges { target: gameOverScene; opacity: 1} StateChangeScript { script: { console.debug("entered state 'gameOver'") gameOverScene.enterScene(); } } }, State { name: "levelFinished" PropertyChanges { target: levelFinishedScene; opacity: 1} StateChangeScript { script: { console.debug("entered state 'levelFinished'") levelFinishedScene.enterScene(); } } }, State { name: "credits" PropertyChanges { target: creditsScene; opacity: 1} }, State { name: "help" PropertyChanges { target: helpScene; opacity: 1} }, State { name: "gameNetwork" PropertyChanges { target: vplayGameNetworkScene; opacity: 1} }, State { name: "selectLevelPack" PropertyChanges { target: levelPackScene; opacity: 1} StateChangeScript { script: { currentSelectedPack = ({}) } } }, State { name: "selectLevel" PropertyChanges { target: levelSelectScene; opacity: 1} StateChangeScript { script: { levelSelectScene.enterScene() currentSelectedLevel = {} } } }, State { name: "levelEditing" PropertyChanges { target: levelEditorScene; opacity: 1} StateChangeScript { script: { levelEditorScene.clearSceneAndNewLevel() } } } ] } //} // add this when building for MeeGo
i tried with every width/height in the MainItem.. no effect
January 26, 2014 at 20:59 #6547
ChristianFelgo TeamHi,
please change your code so it only uses the relevant part (loading a splash and showing the main scene afterwards).
Did you also have a look at the MultiSceneMultiLevelDynamic example?
A possible fix that I’ve seen from your code, is to try setting the GameWindow width & height to a fixed value like 480×320 or 960×640 (i.e. do not use a multiplication in this binding as this sometimes screws up the loading).
Cheers, Chris
January 26, 2014 at 21:56 #6548
Felgo User
i solved the problem by setting with & height to fixed value 960X640.
the multiplication causes the problem on android devices.
thx chris!!! 😉
You must be logged in to reply to this topic.