In connection to the topic discuss here, where Richard stated:
Qiso creates a display group on initiation and all rendering is done to that group, so as long as you initiate before creating other display groups, those groups should naturally sit on top and adding your UI elements to those groups should in turn sit them on top of Qiso.
but Rob also stated
Display objects that are not part of the parent scene or part of the overlay scene (i.e. you did not insert them into the scene group) are always on top of composer managed objects.
I have made a really simple app where the problem can be reproduced.
The code can be found below:
local composer = require( "composer" ) local scene = composer.newScene() local widget = require("widget") local qiso = require "plugin.qisoengine" qiso.setAssetsFolder("assets") -- Enable zooming when the screen is pinched qiso.enablePinchZoom() -- Enable camera panning when the screen is dragged qiso.enableCameraPan() -- Enable the main Qiso loop to render/update our world qiso.activate() -- Load a Lua formatted Tiled Map Editor tilemap into a Qiso map. qiso.loadTiledMap("map2") qiso.setZoomLevel(2) qiso.setMaxZoomLevel(3) print('Qiso stuff') ----------------------------------------------------------------------------------- -- Scene event functions -- ----------------------------------------------------------------------------------- -- create() function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen end -- scene:create() -- show() function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is still off screen (but is about to come on screen) local toolbarGroup = display.newGroup() -- Creates a new display group for the toolbar bar icons -- toolbarGroup.alpha = 1 -- Displays the toolbar -- Delete button to remove an item from the map local deleteButton = widget.newButton( { width = 150, height = 150, defaultFile = "images/delete.png" } ) deleteButton.x = 75 deleteButton.y = display.contentHeight-75 toolbarGroup:insert( deleteButton ) -- Inserts button into toolbar group sceneGroup:insert( toolbarGroup ) -- Inserts button into SceneGroup print('Insert in sceneGroup') elseif ( phase == "did" ) then -- Code here runs when the scene is entirely on screen end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then elseif ( phase == "did" ) then -- Code here runs immediately after the scene goes entirely off screen end end -- destroy() function scene:destroy( event ) local sceneGroup = self.view -- Code here runs prior to the removal of scene's view end -- ----------------------------------------------------------------------------------- -- Scene event function listeners -- ----------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ----------------------------------------------------------------------------------- return scene
When debugging I can see that Qiso is called first, with the console displaying:
Qiso stuff
Insert in sceneGroup
Still, the map is displayed on top of the button as you can see from the attached snapshot.
So I’m looking into a way to insert my display objects into the SceneGroup but keep them at the top, this should work out-of-the-box IMO.
Maybe I need to insert the map in sceneGroup as well? If so, maybe Richard can guide me on how to to that? (i.e. how can I retrieve the group Qiso has created?).
Thanks!
